Example usage for org.apache.commons.collections15 Closure execute

List of usage examples for org.apache.commons.collections15 Closure execute

Introduction

In this page you can find the example usage for org.apache.commons.collections15 Closure execute.

Prototype

public void execute(T input);

Source Link

Document

Performs an action on the specified input object.

Usage

From source file:org.springframework.util.ExtendedPlaceholderResolverUtils.java

/**
 * Invokes a {@link Closure} on all the non-<code>null</code> placeholder values
 * @param resolver The {@link NamedExtendedPlaceholderResolver} to query
 * @param closure The {@link Closure} to invoke
 * @throws IllegalArgumentException if no resolver or closure
 *///w  ww  . j  a v a  2 s.co m
public static final void forAllEntriesDo(NamedExtendedPlaceholderResolver resolver,
        Closure<Map.Entry<String, String>> closure) {
    Assert.notNull(resolver, "No resolver");
    Assert.notNull(closure, "No closure");

    Collection<String> names = resolver.getPlaceholderNames();
    if (ExtendedCollectionUtils.isEmpty(names)) {
        return;
    }

    for (String propName : names) {
        String propValue = resolver.resolvePlaceholder(propName);
        if (propValue == null) {
            continue;
        }

        closure.execute(Pair.of(propName, propValue));
    }
}