public SingleVersion(String version) { Assert.notNull(version, "Version must not be null."); this.version = version; }
public static <ELEMENTTYPE> ELEMENTTYPE[] shiftLeft(ELEMENTTYPE[] source, ELEMENTTYPE[] target) { Assert.isTrue(source.length > 0, "Source array length cannot be zero."); Assert.isTrue(source.length - 1 == target.length, "Destination array must be one element shorter than the source array."); System.arraycopy(source, 1, target, 0, target.length); return target; }
public void setFuture(Future<Void> future) { Assert.notNull(future, "Future must not be null."); this.state.future = future; }
public static <ELEMENTTYPE> ELEMENTTYPE[] copy(ELEMENTTYPE[] source, ELEMENTTYPE[] target) { Assert.isTrue(source.length == target.length, "Source and destination arrays must be of the same length."); System.arraycopy(source, 0, target, 0, source.length); return target; }
protected URLResourceImpl(ResourceFactory factory, Resource<?> parent, URL resource) { super(factory, parent); Assert.notNull(resource, "URL resource cannot be null"); this.resource = resource; }
public static <ELEMENTTYPE> ELEMENTTYPE[] removeElementAtIndex(ELEMENTTYPE[] array, int index) { Assert.isTrue(array.length > 0, "Cannot remove an element from an already empty array."); ELEMENTTYPE[] result = java.util.Arrays.copyOf(array, array.length - 1); if (result.length > 0 && array.length + 1 != index && index != result.length) System.arraycopy(array, index + 1, result, index, array.length - (array.length - index)); return result; } }
public UICategoryImpl(String name, UICategory subCategory) { Assert.notNull(name, "Name must not be null."); this.name = name; this.subCategory = subCategory; }
private AddonRepositoryImpl(LockManager lock, File dir) { // TODO Assert.notNull(lock, "LockManager must not be null."); Assert.notNull(dir, "Addon directory must not be null."); this.addonDir = dir; this.lock = lock; }
public Addon setStatus(AddonStatus status) { Assert.notNull(status, "Status must not be null."); this.state.status = status; return this; }
public void setRunnable(AddonRunnable runnable) { Assert.notNull(runnable, "Runnable must not be null."); this.state.runnable = runnable; }
public URLResourceImpl(ResourceFactory factory, URL resource) { super(factory, null); Assert.notNull(resource, "URL resource cannot be null"); this.resource = resource; }
public Addon setServiceRegistry(ServiceRegistry registry) { Assert.notNull(registry, "Registry must not be null."); this.state.registry = registry; return this; }
public AddonDependencyImpl(LockManager lockManager, Addon dependent, VersionRange dependencyVersionRange, Addon dependency, boolean exported, boolean optional) { Assert.notNull(lockManager, "LockManager must not be null."); Assert.notNull(dependent, "Dependent Addon must not be null."); Assert.notNull(dependencyVersionRange, "VersionRange must not be null."); Assert.notNull(dependency, "Dependency Addon not be null."); this.lockManager = lockManager; this.dependent = dependent; this.dependencyVersionRange = dependencyVersionRange; this.dependency = dependency; this.exported = exported; this.optional = optional; }
public static boolean containsClass(ClassLoader loader, Class<?> type) { Assert.notNull(loader, "Class loader to inspect must not be null."); Assert.notNull(type, "Class to find must not be null."); try { return loader.loadClass(type.getName()).equals(type); } catch (ClassNotFoundException e) { return false; } }
public static <T> Future<T> runAsync(final Callable<T> callable) { Assert.notNull(callable, "Future task must not be null."); ExecutorService executor = Executors.newSingleThreadExecutor(); FutureTask<T> future = new FutureTask<T>(callable); executor.execute(future); executor.shutdown(); return future; }
public static Class<?> loadClass(ClassLoader loader, String typeName) { Assert.notNull(loader, "Class loader to inspect must not be null."); Assert.notNull(typeName, "Class name to load must not be null."); try { return loader.loadClass(typeName); } catch (ClassNotFoundException e) { throw new ContainerException(e); } }
public static Class<?> loadClass(ClassLoader loader, Class<?> type) { Assert.notNull(loader, "Class loader to inspect must not be null."); Assert.notNull(type, "Class to load must not be null."); try { return loader.loadClass(type.getName()); } catch (ClassNotFoundException e) { throw new ContainerException(e); } } }
public static AddonDependencyEntry create(AddonId id, boolean exported, boolean optional) { Assert.notNull(id, "AddonId must not be null."); AddonDependencyEntry entry = new AddonDependencyEntry(); entry.id = id; entry.exported = exported; entry.optional = optional; return entry; }