本文整理了Java中org.jboss.forge.furnace.util.Assert.isTrue()
方法的一些代码示例,展示了Assert.isTrue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.isTrue()
方法的具体详情如下:
包路径:org.jboss.forge.furnace.util.Assert
类名称:Assert
方法名:isTrue
[英]Assert that the given boolean value is true
; otherwise, throw an IllegalArgumentExceptionwith the given message.
[中]断言给定的布尔值为true
;否则,使用给定消息抛出IllegalArgumentException。
代码示例来源:origin: org.jboss.forge.furnace/furnace-manager
private MutableAddonRepository assertMutableRepository(AddonRepository repository)
{
Assert.isTrue(repository instanceof MutableAddonRepository, "Addon repository ["
+ repository.getRootDirectory().getAbsolutePath()
+ "] is not writable.");
return (MutableAddonRepository) repository;
}
代码示例来源:origin: forge/core
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);
}
代码示例来源:origin: org.jboss.forge.furnace/furnace-api
/**
* 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));
}
代码示例来源:origin: org.jboss.forge.addon/ui-api
/**
* @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;
}
代码示例来源:origin: org.jboss.forge.addon/resources-impl
@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);
}
代码示例来源:origin: org.jboss.forge.addon/ui-api
/**
* @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;
}
代码示例来源:origin: org.jboss.forge.addon/ui-api
/**
* @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;
}
代码示例来源:origin: org.jboss.forge.addon/ui-api
/**
* @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;
}
代码示例来源:origin: org.jboss.forge.addon/projects-impl
@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;
}
代码示例来源:origin: org.jboss.forge.addon/javaee-api
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();
}
代码示例来源:origin: org.jboss.forge.addon/facets-impl
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.");
代码示例来源:origin: org.jboss.forge.addon/templates-impl
@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;
}
代码示例来源:origin: org.jboss.forge.addon/facets-impl
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.");
代码示例来源:origin: org.jboss.forge.furnace/furnace-api
/**
* 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);
}
代码示例来源:origin: org.jboss.forge.addon/projects-impl
FacetFactory facetFactory = getFacetFactory();
if (facetTypes != null)
Assert.isTrue(
isBuildable(projectProvider, facetTypes),
"The provided build system ["
代码示例来源:origin: org.jboss.forge.addon/resources-impl
@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
内容来源于网络,如有侵权,请联系作者删除!