private MutableAddonRepository assertMutableRepository(AddonRepository repository) { Assert.isTrue(repository instanceof MutableAddonRepository, "Addon repository [" + repository.getRootDirectory().getAbsolutePath() + "] is not writable."); return (MutableAddonRepository) repository; }
public void addIrregular(String singular, String plural) { Assert.isTrue(!Strings.isNullOrEmpty(singular), "singular rule"); Assert.isTrue(!Strings.isNullOrEmpty(plural), "plural rule"); String singularRemainder = singular.length() > 1 ? singular.substring(1) : ""; String pluralRemainder = plural.length() > 1 ? plural.substring(1) : ""; addPluralize("(" + singular.charAt(0) + ")" + singularRemainder + "$", "$1" + pluralRemainder); addSingularize("(" + plural.charAt(0) + ")" + pluralRemainder + "$", "$1" + singularRemainder); }
/** * Calculate the intersection of one or more {@link VersionRange} instances, returning a single {@link VersionRange} * as the result. */ public static VersionRange intersection(VersionRange... ranges) { Assert.notNull(ranges, "Version ranges must not be null."); Assert.isTrue(ranges.length >= 1, "Version ranges must not be empty."); return intersection(Arrays.asList(ranges)); }
/** * @return the delegate bound to this decorator. Never a <code>null</code> reference. * @throws IllegalArgumentException if the delegate returned by {@link #createDelegate()} is <code>null</code> or the * same reference as this decorator class */ protected final UIInput<VALUETYPE> getDelegate() { if (delegate == null) { delegate = createDelegate(); Assert.notNull(delegate, "Delegate cannot be null"); Assert.isTrue(delegate != this, "Decorator cannot delegate to itself"); } return delegate; }
@Override public ResourceMonitor monitor(Resource<?> resource, ResourceFilter resourceFilter) { Assert.notNull(resource, "Resource cannot be null"); Assert.isTrue(resource instanceof FileResource, "Resource must be a FileResource, was " + resource.getClass().getName()); if (!resource.exists()) { throw new IllegalStateException("Resource must exist to be monitored"); } FileResource<?> fileResource = (FileResource<?>) resource; return getFileMonitor().registerMonitor(this, fileResource, resourceFilter); }
/** * @return the delegate bound to this decorator. Never a <code>null</code> reference. * @throws IllegalArgumentException if the delegate returned by {@link #createDelegate()} is <code>null</code> or the * same reference as this decorator class */ protected final UISelectOne<VALUETYPE> getDelegate() { if (delegate == null) { delegate = createDelegate(); Assert.notNull(delegate, "Delegate cannot be null"); Assert.isTrue(delegate != this, "Decorator cannot delegate to itself"); } return delegate; }
/** * @return the delegate bound to this decorator. Never a <code>null</code> reference. * @throws IllegalArgumentException if the delegate returned by {@link #createDelegate()} is <code>null</code> or the * same reference as this decorator class */ protected final UIInputMany<VALUETYPE> getDelegate() { if (delegate == null) { delegate = createDelegate(); Assert.notNull(delegate, "Delegate cannot be null"); Assert.isTrue(delegate != this, "Decorator cannot delegate to itself"); } return delegate; }
/** * @return the delegate bound to this decorator. Never a <code>null</code> reference. * @throws IllegalArgumentException if the delegate returned by {@link #createDelegate()} is <code>null</code> or the * same reference as this decorator class */ protected final UISelectMany<VALUETYPE> getDelegate() { if (delegate == null) { delegate = createDelegate(); Assert.notNull(delegate, "Delegate cannot be null"); Assert.isTrue(delegate != this, "Decorator cannot delegate to itself"); } return delegate; }
@Override public boolean containsProject(Resource<?> bound, Resource<?> target, ProjectProvider buildSystem) { Assert.notNull(bound, "Boundary should not be null"); Assert.isTrue(bound.equals(target) || isParent(bound, target), "Target should be a child of bound"); boolean found = false; Resource<?> r = bound; while (r != null && !found) { found = buildSystem.containsProject(r); if (target.equals(r)) { break; } r = r.getParent(); } return found; }
public RestApplicationClassConfigurationStrategy(JavaClassSource javaClass) { Assert.notNull(javaClass, "JavaClass cannot be null"); Assert.isTrue(javaClass.hasAnnotation(ApplicationPath.class), "@ApplicationPath should be present in the JavaClass"); this.applicationClass = javaClass; this.path = javaClass.getAnnotation(ApplicationPath.class).getStringValue(); }
Assert.isTrue(faceted instanceof MutableFaceted, "The given origin [" + origin + "] is not an instance of [" + MutableFaceted.class.getName() + "], and does not support " + Facet.class.getSimpleName() + " installation."); Assert.isTrue(origin.equals(facet.getFaceted()), "The given origin [" + origin + "] is not an instance of [" + MutableFaceted.class.getName() + "], and does not support " + Facet.class.getSimpleName() + " installation.");
@Override public Template create(Resource<?> template, Class<? extends Template> type) { Assert.notNull(template, "Template resource cannot be null"); Assert.isTrue(template.exists(), "Template does not exist: " + template); for (TemplateGenerator generator : getTemplateGenerators()) { if (generator.handles(type)) { return generator.create(template, type); } } return null; }
Assert.isTrue(faceted instanceof MutableFaceted, "The given origin [" + origin + "] is not an instance of [" + MutableFaceted.class.getName() + "], and does not support " + Facet.class.getSimpleName() + " installation."); Assert.isTrue(origin.equals(facet.getFaceted()), "The given origin [" + origin + "] is not an instance of [" + MutableFaceted.class.getName() + "], and does not support " + Facet.class.getSimpleName() + " installation.");
/** * Calculate the intersection of one or more {@link VersionRange} instances, returning a single {@link VersionRange} * as the result. */ public static VersionRange intersection(Collection<VersionRange> ranges) { Assert.notNull(ranges, "Version ranges must not be null."); Assert.isTrue(ranges.size() >= 1, "Version ranges must not be empty."); Version min = null; Version max = null; boolean minInclusive = false; boolean maxInclusive = false; for (VersionRange range : ranges) { if (min == null || range.getMin().compareTo(min) > 0) { min = range.getMin(); minInclusive = range.isMinInclusive(); } if (max == null || range.getMax().compareTo(max) < 0) { max = range.getMax(); maxInclusive = range.isMaxInclusive(); } } return new DefaultVersionRange(min, minInclusive, max, maxInclusive); }
FacetFactory facetFactory = getFacetFactory(); if (facetTypes != null) Assert.isTrue( isBuildable(projectProvider, facetTypes), "The provided build system ["
@Override public ZipFileResource add(String name, Resource<?> resource) Assert.isTrue(!Strings.isNullOrEmpty(name), "You need to specify a name for the Resource"); Assert.notNull(resource, "You cannot add a null Resource to a zip file"); try