本文整理汇总了Java中org.apache.commons.collections.Closure.execute方法的典型用法代码示例。如果您正苦于以下问题:Java Closure.execute方法的具体用法?Java Closure.execute怎么用?Java Closure.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections.Closure
的用法示例。
在下文中一共展示了Closure.execute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: up
import org.apache.commons.collections.Closure; //导入方法依赖的package包/类
private IntakeNode up(IntakeNode node, Closure closure) {
//if(node == null)
IntakeNode root = node;
while (root.getParent() != null) {
closure.execute(root);
root = root.getParent();
}
return root;
}
示例2: down
import org.apache.commons.collections.Closure; //导入方法依赖的package包/类
private void down(List<IntakeNode> children, Closure closure) {
for (IntakeNode child : children) {
if (child != null) {
closure.execute(child);
down(child.getChildren(), closure);
}
}
}
示例3: doOnAllPluginJarChangeListener
import org.apache.commons.collections.Closure; //导入方法依赖的package包/类
private void doOnAllPluginJarChangeListener(Closure closure) {
for (WeakReference<PluginJarChangeListener> listener : listeners) {
PluginJarChangeListener changeListener = listener.get();
if (changeListener == null) {
continue;
}
try {
closure.execute(changeListener);
} catch (Exception e) {
LOGGER.warn("Plugin listener failed", e);
}
}
}
示例4: tryCatch
import org.apache.commons.collections.Closure; //导入方法依赖的package包/类
private void tryCatch(User user, Closure closure, String exceptionMessage) {
try {
closure.execute(user);
} catch (Throwable t) {
LOG.warn(String.format("User: %s, Error message: %s", user.getUsername(), exceptionMessage), t);
}
}
示例5: applyTransformations
import org.apache.commons.collections.Closure; //导入方法依赖的package包/类
private static void applyTransformations(Set<SecurityPolicy> policies, Object entity, PropertyAccessor propAccessor)
throws IllegalAccessException, InvocationTargetException {
Transformer transformer = getPropertyTransformer(policies, propAccessor);
if (transformer != null) {
Object originalVal = propAccessor.get(entity);
Object transformedVal = transformer.transform(originalVal);
propAccessor.set(entity, transformedVal);
}
Closure mutator = getPropertyMutator(policies, propAccessor);
if (mutator != null) {
mutator.execute(propAccessor.get(entity));
}
}
示例6: walk
import org.apache.commons.collections.Closure; //导入方法依赖的package包/类
/**
* Walk entries.
*
* @param handler
* handler to call.
* @param filter
* filter to use.
* @throws IllegalArgumentException
* if closure or filter is null.
*/
public void walk(final Closure handler, final Predicate filter) throws IllegalArgumentException {
Assert.assertNotNull(handler, "Handler cannot be null");
Assert.assertNotNull(filter, "Filter cannot be null");
for (KeyValue<?> keyValue : this.entries.values()) {
if (filter.evaluate(keyValue)) {
handler.execute(keyValue);
}
}
}
示例7: walk
import org.apache.commons.collections.Closure; //导入方法依赖的package包/类
/**
* Walk entries.
*
* @param handler
* handler to call.
* @param filter
* filter to use.
* @throws IllegalArgumentException
* if closure or filter is null.
*/
public void walk( final Closure handler, final Predicate filter ) throws IllegalArgumentException {
Assert.assertNotNull( handler, "Handler cannot be null" );
Assert.assertNotNull( filter, "Filter cannot be null" );
for ( KeyValue<?> keyValue : this.entries.values() ) {
if ( filter.evaluate( keyValue ) ) {
handler.execute( keyValue );
}
}
}