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:net.shibboleth.idp.authn.spnego.impl.KerberosSettings.java

/**
 * Collection of realms (KerberosRealmSettings objects).
 * /* w  w w  .  java  2  s.  c om*/
 * @param realms realms to set.
 */
public void setRealms(@Nonnull @NonnullElements final Collection<KerberosRealmSettings> realms) {
    ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
    Constraint.isNotNull(realms, "The realms collection cannot be null");

    realmSettings = new ArrayList<>(Collections2.filter(realms, Predicates.notNull()));
}

From source file:net.shibboleth.idp.authn.impl.ExtractRemoteUser.java

/**
 * Set the list of request headers to check for an identity.
 * // w w w . j av  a  2s.com
 * @param headers list of request headers to check
 */
public void setCheckHeaders(@Nonnull @NonnullElements final Collection<String> headers) {
    ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);

    checkHeaders = Lists.newArrayList(Collections2.filter(headers, Predicates.notNull()));
}

From source file:de.metas.ui.web.handlingunits.process.WEBUI_M_HU_Pick.java

private Stream<HURow> streamHURows() {
    return streamSelectedRows().map(row -> toHURowOrNull(row)).filter(Predicates.notNull())
            .filter(HURow::isTopLevelHU).filter(HURow::isHuStatusActive);
}

From source file:net.shibboleth.idp.attribute.resolver.impl.ad.mapped.MappedAttributeDefinition.java

/**
 * Sets the functions used to map an input value to an output value.
 * //ww w.  ja  v a 2s .c  o  m
 * @param mappings functions used to map an input value to an output value
 */
public synchronized void setValueMaps(@Nullable @NullableElements final Collection<ValueMap> mappings) {
    ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
    ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);

    valueMaps = ImmutableSet.copyOf(Iterables.filter(mappings, Predicates.notNull()));
}

From source file:net.shibboleth.idp.oidc.config.login.LoginConfiguration.java

/**
 * Sets authentication flows./*  ww  w  .  j av a  2s .com*/
 *
 * @param flows the flows
 */
public void setAuthenticationFlows(@Nonnull @NonnullElements final Collection<String> flows) {
    Constraint.isNotNull(flows, "Collection of flows cannot be null");
    this.authenticationFlows = new HashSet(Collections2.filter(flows, Predicates.notNull()));
}

From source file:com.cognifide.aet.worker.impl.ComparatorDispatcherImpl.java

private List<DataFilterJob> getComparatorDataFilters(Comparator comparator) {
    return FluentIterable.from(comparator.getFilters()).transform(new Function<Operation, DataFilterJob>() {
        @Nullable/*from   ww  w  .ja v a 2 s.c o m*/
        @Override
        public DataFilterJob apply(Operation dataFilter) {
            DataFilterJob dataFilterJob = null;
            DataFilterFactory dataFilterFactory = jobRegistry.getDataModifierFactory(dataFilter.getType());
            if (dataFilterFactory != null) {
                try {
                    dataFilterJob = dataFilterFactory.createInstance(dataFilter.getParameters());
                } catch (ParametersException e) {
                    LOGGER.error("Unexpected parameter in {}", dataFilter, e);
                }
            }
            return dataFilterJob;
        }
    }).filter(Predicates.notNull()).toList();
}

From source file:com.google.android.droiddriver.base.AbstractUiElement.java

@Override
public List<UiElement> getChildren(Predicate<? super UiElement> predicate) {
    predicate = Predicates.and(Predicates.notNull(), predicate);
    // TODO: Use internal data when we take snapshot of current node tree.
    ImmutableList.Builder<UiElement> builder = ImmutableList.builder();
    for (int i = 0; i < getChildCount(); i++) {
        UiElement child = getChild(i);/*w  w  w  .jav  a  2 s . c  o m*/
        if (predicate.apply(child)) {
            builder.add(child);
        }
    }
    return builder.build();
}

From source file:com.jaspersoft.android.jaspermobile.util.FavoritesHelper.java

public Cursor queryFavoriteByResource(ResourceLookup resource) {
    JsServerProfile jsServerProfile = jsRestClient.getServerProfile();
    Map<String, String> mapValues = Maps.newHashMap();
    mapValues.put(FavoritesTable.TITLE, resource.getLabel());
    mapValues.put(FavoritesTable.URI, resource.getUri());
    mapValues.put(FavoritesTable.WSTYPE, resource.getResourceType().toString());
    mapValues.put(FavoritesTable.SERVER_PROFILE_ID, jsServerProfile.getId() + "");

    List<String> conditions = Lists.newArrayList();
    for (Map.Entry<String, String> entry : mapValues.entrySet()) {
        if (entry.getValue() == null) {
            conditions.add(entry.getKey() + " IS NULL");
        } else {//from   ww w .  ja v  a 2  s. c om
            conditions.add(entry.getKey() + "=?");
        }
    }

    List<String> args = FluentIterable.from(mapValues.values()).filter(Predicates.notNull()).toList();
    String selection = Joiner.on(" AND ").join(conditions);
    String[] selectionArgs = new String[mapValues.values().size()];
    args.toArray(selectionArgs);

    return context.getContentResolver().query(JasperMobileDbProvider.FAVORITES_CONTENT_URI,
            new String[] { FavoritesTable._ID }, selection, selectionArgs, null);
}

From source file:net.shibboleth.idp.authn.context.RequestedPrincipalContext.java

/**
 * Set list of principals reflecting the request requirements.
 * /*from  w w w . java2 s.  co m*/
 * @param principals list of principals
 */
public void setRequestedPrincipals(@Nonnull @NonnullElements final List<Principal> principals) {
    Constraint.isNotNull(principals, "Principal list cannot be null");

    requestedPrincipals = new ArrayList<>(Collections2.filter(principals, Predicates.notNull()));
}

From source file:net.shibboleth.idp.authn.impl.ValidateRemoteUser.java

/**
 * Set the blacklisted usernames.//ww w  .j a v  a2 s.c  o m
 * 
 * @param blacklist blacklist to set
 */
public void setBlacklistedUsernames(@Nonnull @NonnullElements final Collection<String> blacklist) {
    ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);

    blacklistedUsernames = Sets.newHashSet(Collections2.filter(blacklist, Predicates.notNull()));
}