Example usage for org.apache.commons.collections.functors NotNullPredicate INSTANCE

List of usage examples for org.apache.commons.collections.functors NotNullPredicate INSTANCE

Introduction

In this page you can find the example usage for org.apache.commons.collections.functors NotNullPredicate INSTANCE.

Prototype

Predicate INSTANCE

To view the source code for org.apache.commons.collections.functors NotNullPredicate INSTANCE.

Click Source Link

Document

Singleton predicate instance

Usage

From source file:info.magnolia.beanmerger.BeanMergerBase.java

@Override
public Object merge(List sources) {
    CollectionUtils.filter(sources, NotNullPredicate.INSTANCE);
    if (sources.isEmpty()) {
        return null;
    }//from  w ww . ja  va 2 s  .  c o  m

    if (sources.size() == 1 || isSimpleType(sources.get(0).getClass())) {
        return sources.get(0);
    }

    if (sources.get(0) instanceof Collection) {
        return mergeCollections(sources);
    }

    if (sources.get(0) instanceof Map) {
        return mergeMaps(sources);
    }

    return mergeBean(sources);
}

From source file:com.anrisoftware.sscontrol.profile.service.ProfilePropertiesImpl.java

@SuppressWarnings("unchecked")
ProfilePropertiesImpl() {/*w  w  w  .  j  a  v  a2 s.  c  om*/
    this.properties = decorate(new HashMap<String, Object>(), NotNullPredicate.INSTANCE,
            NotNullPredicate.INSTANCE);
}

From source file:org.apache.flink.streaming.runtime.tasks.StreamTask.java

@Override
public void triggerCheckpoint(long checkpointId, long timestamp) throws Exception {

    LOG.debug("Starting checkpoint {} on task {}", checkpointId, getName());

    synchronized (checkpointLock) {
        if (isRunning) {
            try {
                // We wrap the states of the chained operators in a list, marking non-stateful operators with null
                List<Tuple2<StateHandle<Serializable>, Map<String, OperatorStateHandle>>> chainedStates = new ArrayList<Tuple2<StateHandle<Serializable>, Map<String, OperatorStateHandle>>>();

                // A wrapper handle is created for the List of statehandles
                WrapperStateHandle stateHandle;
                try {

                    // We construct a list of states for chained tasks
                    for (StreamOperator<?> chainedOperator : outputHandler.getChainedOperators()) {
                        if (chainedOperator instanceof StatefulStreamOperator) {
                            chainedStates.add(((StatefulStreamOperator<?>) chainedOperator)
                                    .getStateSnapshotFromFunction(checkpointId, timestamp));
                        } else {
                            chainedStates.add(null);
                        }//from   www . java2  s . c om
                    }

                    stateHandle = CollectionUtils.exists(chainedStates, NotNullPredicate.INSTANCE)
                            ? new WrapperStateHandle(chainedStates)
                            : null;
                } catch (Exception e) {
                    throw new Exception("Error while drawing snapshot of the user state.", e);
                }

                // now emit the checkpoint barriers
                outputHandler.broadcastBarrier(checkpointId, timestamp);

                // now confirm the checkpoint
                if (stateHandle == null) {
                    getEnvironment().acknowledgeCheckpoint(checkpointId);
                } else {
                    getEnvironment().acknowledgeCheckpoint(checkpointId, stateHandle);
                }
            } catch (Exception e) {
                if (isRunning) {
                    throw e;
                }
            }
        }
    }
}

From source file:org.robotframework.javalib.factory.CompositeKeywordFactory.java

private static List createUniqueListThatDoesntAcceptNullValues() {
    List list = new ArrayList();
    list = SetUniqueList.decorate(list);
    list = PredicatedList.decorate(list, NotNullPredicate.INSTANCE);
    return list;//from  w  ww . j a  v a2s. co  m
}

From source file:org.robotframework.javalib.keyword.KeywordMap.java

public KeywordMap() {
    map = new HashedMap();
    map = PredicatedMap.decorate(map, UniquePredicate.getInstance(), TruePredicate.INSTANCE);
    map = PredicatedMap.decorate(map, NotNullPredicate.INSTANCE, NotNullPredicate.INSTANCE);
}

From source file:org.sipfoundry.sipxconfig.bulk.ldap.AttrMap.java

/**
 * Returns non null LDAP attributes. Used to limit search results.
 *//*from  w ww  .  j a v  a 2s. c om*/
public Collection<String> getLdapAttributes() {
    Collection<String> attrs = new ArrayList<String>(m_user2ldap.values());
    CollectionUtils.filter(attrs, NotNullPredicate.INSTANCE);
    return attrs;
}