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.opensaml.xmlsec.encryption.support.ChainingEncryptedKeyResolver.java

/** 
 * Constructor. //from   w  ww  .ja  v  a  2 s .c  o m
 * 
 * @param encKeyResolvers the chain of encrypted key resolvers
 */
public ChainingEncryptedKeyResolver(@Nonnull final List<EncryptedKeyResolver> encKeyResolvers) {
    Constraint.isNotNull(encKeyResolvers, "List of EncryptedKeyResolvers cannot be null");
    resolvers = new ArrayList<>(Collections2.filter(encKeyResolvers, Predicates.notNull()));
}

From source file:controllers.DocumentsController.java

public static Result get(final UUID collection, String document) {
    JsonNode documentNode = Json.parse(document);
    if (documentNode.isTextual()) {
        document = String.format("[%s]", document);
        documentNode = Json.parse(document);
    }/*from w w  w .j a v a  2 s  .c om*/

    if (documentNode.isArray()) {
        Iterator<ViewModel> documents = Iterators.transform(documentNode.getElements(),
                new Function<JsonNode, ViewModel>() {
                    @Override
                    @Nullable
                    public ViewModel apply(@Nullable JsonNode input) {
                        if (!input.isTextual()) {
                            throw new IllegalArgumentException();
                        }
                        return createViewModel(fetchDocument(collection, UuidUtils.create(input.asText())));
                    }
                });

        return ok(Json
                .toJson(Iterators.toArray(Iterators.filter(documents, Predicates.notNull()), ViewModel.class)));
    }

    throw new IllegalArgumentException();
}

From source file:org.opensaml.xmlsec.criterion.EncryptionConfigurationCriterion.java

/**
 * Constructor.//from w w w.jav a2 s.co  m
 *
 * @param configurations varargs array of configuration instances
 */
public EncryptionConfigurationCriterion(
        @Nonnull @NonnullElements @NotEmpty EncryptionConfiguration... configurations) {
    Constraint.isNotNull(configurations, "List of configurations cannot be null");
    configs = new ArrayList<>(Collections2.filter(Arrays.asList(configurations), Predicates.notNull()));
    Constraint.isGreaterThanOrEqual(1, configs.size(), "At least one configuration is required");
}

From source file:org.opensaml.xmlsec.criterion.DecryptionConfigurationCriterion.java

/**
 * Constructor./*from  w  w  w. j av  a  2 s .  co m*/
 *
 * @param configurations varargs array of configuration instances
 */
public DecryptionConfigurationCriterion(
        @Nonnull @NonnullElements @NotEmpty DecryptionConfiguration... configurations) {
    Constraint.isNotNull(configurations, "List of configurations cannot be null");
    configs = new ArrayList<>(Collections2.filter(Arrays.asList(configurations), Predicates.notNull()));
    Constraint.isGreaterThanOrEqual(1, configs.size(), "At least one configuration is required");
}

From source file:io.druid.query.GroupByParallelQueryRunner.java

public GroupByParallelQueryRunner(ExecutorService exec, Supplier<GroupByQueryConfig> configSupplier,
        QueryWatcher queryWatcher, StupidPool<ByteBuffer> bufferPool, Iterable<QueryRunner<T>> queryables) {
    this.exec = MoreExecutors.listeningDecorator(exec);
    this.queryWatcher = queryWatcher;
    this.queryables = Iterables.unmodifiableIterable(Iterables.filter(queryables, Predicates.notNull()));
    this.configSupplier = configSupplier;
    this.bufferPool = bufferPool;
}

From source file:org.opensaml.security.x509.tls.ClientTLSValidationConfigurationCriterion.java

/**
 * Constructor.// www  . j  ava2  s.  co m
 *
 * @param configurations varargs array of configuration instances
 */
public ClientTLSValidationConfigurationCriterion(
        @Nonnull @NonnullElements @NotEmpty ClientTLSValidationConfiguration... configurations) {
    Constraint.isNotNull(configurations, "List of configurations cannot be null");
    configs = new ArrayList<>(Collections2.filter(Arrays.asList(configurations), Predicates.notNull()));
    Constraint.isGreaterThanOrEqual(1, configs.size(), "At least one configuration is required");
}

From source file:org.splevo.jamopp.vpm.analyzer.semantic.JaMoPPSemanticContentProviderSwitch.java

@Override
public Iterable<String> doSwitch(EObject eObject) {
    if (eObject == null) {
        return Lists.newArrayList();
    }//from  w  ww.j  a  v a 2s  .co  m
    Iterable<String> result = super.doSwitch(eObject);
    if (result == null) {
        return Lists.newArrayList();
    }
    return Iterables.filter(result, Predicates.notNull());
}

From source file:org.opensaml.xmlsec.criterion.SignatureSigningConfigurationCriterion.java

/**
 * Constructor.//from  ww  w.  java  2  s.  c o m
 *
 * @param configurations varargs array of configuration instances
 */
public SignatureSigningConfigurationCriterion(
        @Nonnull @NonnullElements @NotEmpty SignatureSigningConfiguration... configurations) {
    Constraint.isNotNull(configurations, "List of configurations cannot be null");
    configs = new ArrayList<>(Collections2.filter(Arrays.asList(configurations), Predicates.notNull()));
    Constraint.isGreaterThanOrEqual(1, configs.size(), "At least one configuration is required");
}

From source file:org.valkyriercp.application.exceptionhandling.LenientSimpleExceptionHandlerDelegate.java

public boolean hasAppropriateHandlerPurged(Throwable throwable) {
    List<Class> transformedList = Lists.transform(throwableClassFQNList, new Function<String, Class>() {
        @Override//from   w w  w.jav a2s  .c o m
        public Class apply(String input) {
            try {
                return Class.forName(input);
            } catch (ClassNotFoundException e) {
                return null;
            }
        }
    });
    for (Class throwableClass : Collections2.filter(transformedList, Predicates.notNull())) {
        if (throwableClass.isInstance(throwable)) {
            return true;
        }
    }
    return false;
}

From source file:org.sonar.server.computation.period.PeriodsHolderImpl.java

@Override
public List<Period> getPeriods() {
    checkHolderIsInitialized();
    return from(Arrays.asList(periods)).filter(Predicates.notNull()).toList();
}