Example usage for com.google.common.base Predicates notNull

List of usage examples for com.google.common.base Predicates notNull

Introduction

In this page you can find the example usage for com.google.common.base Predicates notNull.

Prototype

@GwtCompatible(serializable = true)
public static <T> Predicate<T> notNull() 

Source Link

Document

Returns a predicate that evaluates to true if the object reference being tested is not null.

Usage

From source file:org.jahia.modules.users.bridge.BridgeUserGroupProvider.java

@Override
public List<String> getMembership(Member member) {
    if (isUserManagerAvailable() && member.getType().equals(Member.MemberType.USER)) {
        JahiaUser user = userManagerProvider.lookupUser(member.getName());
        if (user != null && isGroupManagerAvailable()) {
            List<String> keys = groupManagerProvider.getUserMembership(user);
            return new ArrayList<String>(
                    Collections2.filter(Collections2.transform(keys, new Function<String, String>() {
                        @Nullable//w w w  .ja va2  s. c  o  m
                        @Override
                        public String apply(@Nullable String input) {
                            if (input != null) {
                                JahiaGroup group = groupManagerProvider.lookupGroup(input);
                                if (group != null) {
                                    return group.getName();
                                }
                            }
                            return null;
                        }
                    }), Predicates.notNull()));
        }
    }
    return Collections.emptyList();
}

From source file:brooklyn.entity.proxy.AbstractControllerImpl.java

@Override
public Set<String> getServerPoolAddresses() {
    return ImmutableSet
            .copyOf(Iterables.filter(getAttribute(SERVER_POOL_TARGETS).values(), Predicates.notNull()));
}

From source file:net.shibboleth.idp.attribute.resolver.AbstractAttributeDefinition.java

/**
 * Sets the encoders used to encode the values of this attribute in to protocol specific formats.
 * //from w  w  w.  ja  va2s .  com
 * @param attributeEncoders encoders used to encode the values of this attribute in to protocol specific formats
 */
public void setAttributeEncoders(@Nullable @NullableElements final Set<AttributeEncoder<?>> attributeEncoders) {
    ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
    ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);

    Set<AttributeEncoder<?>> checkedEncoders = new HashSet<>();
    CollectionSupport.addIf(checkedEncoders, attributeEncoders, Predicates.notNull());
    encoders = ImmutableSet.copyOf(checkedEncoders);
}

From source file:com.spectralogic.ds3cli.command.GetDetailedObjects.java

private Predicate<DetailedS3Object> getNamePredicate() {
    if (Guard.isMapNullOrEmpty(this.filterParams)) {
        return Predicates.notNull();
    }/*from w ww  .  ja  v  a2s  .  c  om*/
    final String contains = paramLookup(CONTAINS);
    if (Guard.isStringNullOrEmpty(contains)) {
        return Predicates.notNull();
    }
    return new Predicate<DetailedS3Object>() {
        @Override
        public boolean apply(@Nullable final DetailedS3Object input) {
            return input.getName().contains(contains);
        }
    };
}

From source file:com.isotrol.impe3.nr.api.NodeQueries.java

/**
 * Merges all queries with should boolean operator
 * @param queries NodeQuery queries/*  www .  j  a  v  a  2 s .co  m*/
 * @return NodeQuery with should operator with all queries.
 */
public static NodeQuery any(Iterable<? extends NodeQuery> queries) {
    queries = Iterables.filter(queries, Predicates.notNull());
    final int n = Iterables.size(queries);
    if (n == 0) {
        return null;
    } else if (n == 1) {
        return Iterables.get(queries, 0);
    }
    final NRBooleanQuery q = bool();
    for (NodeQuery c : queries) {
        q.should(c);
    }
    return q;
}

From source file:org.apache.bookkeeper.mledger.impl.ManagedLedgerFactoryImpl.java

/**
 * Helper for getting stats/*from   ww w .j  a  v a 2  s. c  o m*/
 *
 * @return
 */
public Map<String, ManagedLedgerImpl> getManagedLedgers() {
    // Return a view of already created ledger by filtering futures not yet completed
    return Maps.filterValues(Maps.transformValues(ledgers, future -> future.getNow(null)),
            Predicates.notNull());
}

From source file:com.codenvy.flux.watcher.core.FluxMessageBus.java

private Set<String> getMessageTypesFor(FluxMessageHandler messageHandler) {
    final FluxMessageTypes types = messageHandler.getClass().getAnnotation(FluxMessageTypes.class);
    if (types == null) {
        return emptySet();
    }//from  ww w  .  j  a  v a2 s  . c o  m

    return ImmutableSet.copyOf(FluentIterable.from(Arrays.asList(types.value())).filter(Predicates.notNull())
            .transform(new Function<FluxMessageType, String>() {
                @Override
                public String apply(FluxMessageType messageType) {
                    return messageType.value();
                }
            }));
}

From source file:ninja.leaping.permissionsex.backend.memory.MemoryOptionSubjectData.java

@Override
public Map<Set<Entry<String, String>>, Map<String, String>> getAllOptions() {
    return Maps.filterValues(Maps.transformValues(contexts, new Function<DataEntry, Map<String, String>>() {
        @Nullable// ww w .ja va2 s.  c o  m
        @Override
        public Map<String, String> apply(@Nullable DataEntry dataEntry) {
            return dataEntry == null ? null : dataEntry.options;
        }
    }), Predicates.notNull());
}

From source file:com.blackducksoftware.bdio.model.AbstractModel.java

AbstractModel(Type type, Iterable<ModelField<M, ?>> fields) {
    types = ImmutableSet.of(type);
    data = Maps.filterValues(new ModelMap<>(self(), fields), Predicates.notNull());
}

From source file:net.shibboleth.idp.saml.profile.config.saml2.BrowserSSOProfileConfiguration.java

/**
 * Set the name identifier formats to use.
 * /*from  w w  w.j a v  a2 s .c om*/
 * @param formats name identifier formats to use
 */
public void setNameIDFormatPrecedence(@Nonnull @NonnullElements final List<String> formats) {
    Constraint.isNotNull(formats, "List of formats cannot be null");

    nameIDFormatPrecedence = Lists.newArrayList(Collections2.filter(formats, Predicates.notNull()));
}