Example usage for com.google.common.collect MapConstraints notNull

List of usage examples for com.google.common.collect MapConstraints notNull

Introduction

In this page you can find the example usage for com.google.common.collect MapConstraints notNull.

Prototype

public static MapConstraint<Object, Object> notNull() 

Source Link

Document

Returns a constraint that verifies that neither the key nor the value is null.

Usage

From source file:com.google.gxp.compiler.schema.FileBackedSchemaFactory.java

private static <K, V> Map<K, V> createMap() {
    Map<K, V> map = Maps.newHashMap();
    return MapConstraints.constrainedMap(map, MapConstraints.notNull());
}

From source file:net.shibboleth.idp.attribute.filter.context.AttributeFilterWorkContext.java

/** Constructor. */
public AttributeFilterWorkContext() {
    permittedValues = MapConstraints.constrainedMap(new HashMap<String, Set<IdPAttributeValue>>(),
            MapConstraints.notNull());
    deniedValues = MapConstraints.constrainedMap(new HashMap<String, Set<IdPAttributeValue>>(),
            MapConstraints.notNull());//  ww  w.j  a  v a2s.co  m
}

From source file:net.shibboleth.idp.attribute.resolver.context.AttributeResolverWorkContext.java

/** Constructor. */
public AttributeResolverWorkContext() {
    resolvedAttributeDefinitions = MapConstraints
            .constrainedMap(new HashMap<String, ResolvedAttributeDefinition>(), MapConstraints.notNull());

    resolvedDataConnectors = MapConstraints.constrainedMap(new HashMap<String, ResolvedDataConnector>(),
            MapConstraints.notNull());/*  ww w  . ja v a2  s.  c om*/
}

From source file:net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext.java

/** Constructor. */
public AttributeResolutionContext() {
    requestedAttributeNames = Collections.emptySet();
    resolvedAttributes = MapConstraints.constrainedMap(new HashMap<String, IdPAttribute>(),
            MapConstraints.notNull());
}

From source file:net.shibboleth.idp.attribute.filter.context.AttributeFilterContext.java

/** Constructor. */
public AttributeFilterContext() {
    prefilteredAttributes = MapConstraints.constrainedMap(new HashMap<String, IdPAttribute>(),
            MapConstraints.notNull());
    filteredAttributes = MapConstraints.constrainedMap(new HashMap<String, IdPAttribute>(),
            MapConstraints.notNull());//from w w  w. jav a2s . co  m
}

From source file:net.shibboleth.idp.attribute.filter.context.AttributeFilterContext.java

/**
 * Sets the attributes which are to be filtered.
 * /*from www.j a v  a  2s .co m*/
 * @param attributes attributes which are to be filtered
 */
public void setPrefilteredIdPAttributes(@Nullable @NullableElements final Collection<IdPAttribute> attributes) {
    Collection<IdPAttribute> checkedAttributes = new ArrayList<>();
    CollectionSupport.addIf(checkedAttributes, attributes, Predicates.notNull());

    prefilteredAttributes = MapConstraints.constrainedMap(
            new HashMap<String, IdPAttribute>(checkedAttributes.size()), MapConstraints.notNull());

    for (final IdPAttribute attribute : checkedAttributes) {
        prefilteredAttributes.put(attribute.getId(), attribute);
    }
}

From source file:net.shibboleth.idp.attribute.filter.context.AttributeFilterContext.java

/**
 * Sets the attributes that have been filtered.
 * //from ww  w .  j a v a2s. com
 * @param attributes attributes that have been filtered
 */
public void setFilteredIdPAttributes(@Nullable @NullableElements final Collection<IdPAttribute> attributes) {
    Collection<IdPAttribute> checkedAttributes = new ArrayList<>();
    CollectionSupport.addIf(checkedAttributes, attributes, Predicates.notNull());

    filteredAttributes = MapConstraints.constrainedMap(
            new HashMap<String, IdPAttribute>(checkedAttributes.size()), MapConstraints.notNull());

    for (final IdPAttribute attribute : checkedAttributes) {
        filteredAttributes.put(attribute.getId(), attribute);
    }
}

From source file:org.sonatype.plugin.nexus.testenvironment.AbstractEnvironmentMojo.java

@SuppressWarnings("unchecked")
private void validateStaticPorts() throws MojoExecutionException, MojoFailureException {
    if (this.staticPorts != null) {
        try {//from   w w w.  j  a  v  a 2s. co m
            @SuppressWarnings("rawtypes")
            BiMap staticPortMap = HashBiMap.create(this.staticPorts.size());
            staticPortMap = MapConstraints.constrainedBiMap(staticPortMap, MapConstraints.notNull());
            staticPortMap.putAll(this.staticPorts);
            this.staticPorts = staticPortMap;
        } catch (NullPointerException npe) {
            throw new MojoExecutionException("Port names and values must not be null.", npe);
        } catch (IllegalArgumentException iae) {
            throw new MojoExecutionException("Port names and values must not be duplicated.", iae);
        }
    }
}