本文整理了Java中com.alibaba.citrus.util.Assert.assertTrue()
方法的一些代码示例,展示了Assert.assertTrue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertTrue()
方法的具体详情如下:
包路径:com.alibaba.citrus.util.Assert
类名称:Assert
方法名:assertTrue
[英]确保表达式为真,否则抛出IllegalArgumentException
。
[中]确保表达式为真,否则抛出IllegalArgumentException
。
代码示例来源:origin: webx/citrus
/**
* 设置parent URI broker。
* <p>
* 每次reset,当前URIBroker的状态将会恢复成和它的parent相同。
* </p>
*/
public void setParent(URIBroker parent) {
assertTrue(!initialized, ILLEGAL_STATE, "already initialized");
if (parent != null) {
this.parent = parent;
}
}
代码示例来源:origin: webx/citrus
@Override
protected boolean filterInputValue(Object inputValue) {
assertTrue(inputValue instanceof AsyncCallbackAdapter, ExceptionType.ILLEGAL_STATE, "<doPerformRunnable> valve should be inside <performRunnableAsync>");
return true;
}
代码示例来源:origin: webx/citrus
/**
* 设置parent URI broker。
* <p>
* 每次reset,当前URIBroker的状态将会恢复成和它的parent相同。
* </p>
*/
public void setParent(URIBroker parent) {
assertTrue(!initialized, ILLEGAL_STATE, "already initialized");
if (parent != null) {
this.parent = parent;
}
}
代码示例来源:origin: webx/citrus
/** 注册一个组件。 */
public void register(String componentPath, PageComponent component) {
assertNotNull(componentPath, "componentPath is null");
assertTrue(componentPath.length() == 0 || !componentPath.startsWith("/") && componentPath.endsWith("/"),
"invalid componentPath: %s", componentPath);
assertTrue(!components.containsKey(componentPath), "duplicated component: %s", componentPath);
components.put(componentPath, component);
}
代码示例来源:origin: webx/citrus
/** 创建一个<code>CitrusMessageFormatter</code>实例。 */
public CitrusMessageFormatter() {
String name = getClass().getName();
assertTrue(name.startsWith(PREFIX) && name.endsWith(SUFFIX), "Unsupported Message class: ", name);
this.bundleName = RB_PACKAGE
+ name.substring(PREFIX.length(), name.length() - SUFFIX.length()).replace('.', '_');
}
代码示例来源:origin: webx/citrus
private static MatchResult createEmptyMatchResult() {
Matcher matcher = Pattern.compile("^$").matcher("");
assertTrue(matcher.find());
return matcher.toMatchResult();
}
代码示例来源:origin: webx/citrus
AbstractBoundedTypeInfo(TypeInfo[] upperBounds) {
assertTrue(!isEmptyArray(upperBounds), "upperBounds is empty");
this.upperBounds = unmodifiableList(asList(upperBounds));
this.baseType = this.upperBounds.get(0);
}
代码示例来源:origin: webx/citrus
public RedirectParameters withTarget(String target) {
assertTrue(uri instanceof TurbineURIBroker, "URI is not a turbine-uri: %s", uriName);
((TurbineURIBroker) uri).setTarget(target);
return this;
}
代码示例来源:origin: webx/citrus
@Override
protected void init() throws Exception {
assertNotNull(key, "no key");
byte[] raw = key.getBytes("UTF-8");
int keySize = getKeySize();
int actualKeySize = raw.length * 8;
assertTrue(keySize == actualKeySize, "Illegal key: expected size=%d, actual size is %d", keySize, actualKeySize);
keySpec = new SecretKeySpec(raw, ALG_NAME);
}
代码示例来源:origin: webx/citrus
/** 取得{@link Map}的value类型。 */
public static TypeInfo resolveMapValue(TypeInfo mapType) {
assertTrue(
mapType != null && mapType instanceof ClassTypeInfo && Map.class.isAssignableFrom(mapType.getRawType()),
"mapType: %s", mapType);
return TYPE_VAR_MAP_VALUE.resolve((ClassTypeInfo) mapType);
}
代码示例来源:origin: webx/citrus
/** 取得{@link Iterator}的element类型。 */
public static TypeInfo resolveIteratorElement(TypeInfo iteratorType) {
assertTrue(
iteratorType != null && iteratorType instanceof ClassTypeInfo
&& Iterator.class.isAssignableFrom(iteratorType.getRawType()), "iteratorType: %s", iteratorType);
return TYPE_VAR_ITERATOR_ELEMENT.resolve((ClassTypeInfo) iteratorType);
}
}
代码示例来源:origin: webx/citrus
/** 取得{@link Map}的value类型。 */
public static TypeInfo resolveMapValue(TypeInfo mapType) {
assertTrue(
mapType != null && mapType instanceof ClassTypeInfo && Map.class.isAssignableFrom(mapType.getRawType()),
"mapType: %s", mapType);
return TYPE_VAR_MAP_VALUE.resolve((ClassTypeInfo) mapType);
}
代码示例来源:origin: webx/citrus
/** 取得{@link Iterable}的element类型。 */
public static TypeInfo resolveIterableElement(TypeInfo iterableType) {
assertTrue(
iterableType != null && iterableType instanceof ClassTypeInfo
&& Iterable.class.isAssignableFrom(iterableType.getRawType()), "iterableType: %s", iterableType);
return TYPE_VAR_ITERABLE_ELEMENT.resolve((ClassTypeInfo) iterableType);
}
代码示例来源:origin: webx/citrus
@SuppressWarnings({ "unchecked", "rawtypes" })
public int compareTo(NumberSupport n) {
Number v1 = getValue();
Number v2 = n.getValue();
assertTrue(v1 instanceof Comparable<?>, "not comparable number: %s", v1);
return ((Comparable) v1).compareTo(v2);
}
代码示例来源:origin: webx/citrus
ParameterizedTypeImpl(RawTypeInfo rawType) {
assertTrue(rawType != null && getTypeParameters(rawType).length > 0, "rawType");
this.rawType = rawType;
this.supertypesLoader = LazyLoader.getDefault(new SupertypesLoader());
}
代码示例来源:origin: webx/citrus
@Override
protected void init() throws Exception {
assertNotNull(controlExporterTarget, "no controlExporterTemplate specified");
assertTrue(templateName != null || moduleName != null, "neither template nor module name was specified");
controlToolName = defaultIfNull(controlToolName, DEFAULT_CONTROL_TOOL_NAME);
substName = defaultIfNull(substName, DEFAULT_SUBSTITUTION_NAME);
}
代码示例来源:origin: webx/citrus
ParameterizedTypeImpl(RawTypeInfo rawType) {
assertTrue(rawType != null && getTypeParameters(rawType).length > 0, "rawType");
this.rawType = rawType;
this.supertypesLoader = LazyLoader.getDefault(new SupertypesLoader());
}
代码示例来源:origin: webx/citrus
private String[] getDefaultValues(Param param, DataResolverContext context) {
String defaultValue = trimToNull(param.defaultValue());
if (defaultValue == null) {
return param.defaultValues();
} else {
// 避免defaultValue和defaultValues同时出现。
assertTrue(isEmptyArray(param.defaultValues()),
"use @Param(... defaultValue=\"...\") or @Param(... defaultValues={...}): %s", context);
return new String[] { defaultValue };
}
}
代码示例来源:origin: webx/citrus
/** 初始化resource loader. */
@Override
public void init(ExtendedProperties configuration) {
rsvc.getLog().info(getLogID() + " : initialization starting.");
springLoader = assertNotNull((ResourceLoader) rsvc.getApplicationAttribute(SPRING_RESOURCE_LOADER_KEY),
SPRING_RESOURCE_LOADER_KEY);
path = normalizeAbsolutePath(configuration.getString("path"), true);
assertTrue(!isEmpty(path), "path");
path += "/";
rsvc.getLog().info(getLogID() + " : set path '" + path + "'");
rsvc.getLog().info(getLogID() + " : initialization complete.");
}
代码示例来源:origin: webx/citrus
/** 初始化resource loader. */
@Override
public void init(ExtendedProperties configuration) {
rsvc.getLog().info(getLogID() + " : initialization starting.");
springLoader = assertNotNull((ResourceLoader) rsvc.getApplicationAttribute(SPRING_RESOURCE_LOADER_KEY),
SPRING_RESOURCE_LOADER_KEY);
path = normalizeAbsolutePath(configuration.getString("path"), true);
assertTrue(!isEmpty(path), "path");
path += "/";
rsvc.getLog().info(getLogID() + " : set path '" + path + "'");
rsvc.getLog().info(getLogID() + " : initialization complete.");
}
内容来源于网络,如有侵权,请联系作者删除!