Example usage for com.google.common.collect ImmutableSet of

List of usage examples for com.google.common.collect ImmutableSet of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSet of.

Prototype

@SuppressWarnings({ "unchecked" })
    public static <E> ImmutableSet<E> of() 

Source Link

Usage

From source file:org.elasticsearch.plugin.readonlyrest.ldap.LdapUser.java

public LdapUser(String uid, String dn) {
    this(uid, dn, ImmutableSet.of());
}

From source file:com.google.javascript.jscomp.BasicErrorManager.java

public BasicErrorManager() {
    super(ImmutableSet.of());
}

From source file:ratpack.server.internal.DefaultCompressionConfig.java

/**
 * Used by Jackson in ratpack-config./* www . j a  v  a2 s.  co m*/
 */
@SuppressWarnings("UnusedDeclaration")
public DefaultCompressionConfig() {
    this(false, CompressionConfig.DEFAULT_COMPRESSION_MIN_SIZE, ImmutableSet.of(), ImmutableSet.of());
}

From source file:org.onosproject.cfg.ComponentConfigAdapter.java

@Override
public Set<ConfigProperty> getProperties(String componentName) {
    return ImmutableSet.of();
}

From source file:org.apache.james.util.OptionalUtils.java

public static <T> ImmutableSet<T> toSet(Optional<T> optional) {
    return optional.map(ImmutableSet::of).orElse(ImmutableSet.of());
}

From source file:storm.benchmark.lib.reducer.SetReducer.java

@Override
public Set<T> zero() {
    return ImmutableSet.of();
}

From source file:vazkii.botania.api.internal.DummyManaNetwork.java

@Override
public Set<TileSignature> getAllPoolsInWorld(World world) {
    return ImmutableSet.of();
}

From source file:com.google.caliper.functional.DefaultCaliperOptions.java

@Override
public ImmutableSet<String> benchmarkMethodNames() {
    return ImmutableSet.of();
}

From source file:com.facebook.buck.rules.visibility.VisibilityPatternFactory.java

@SuppressWarnings("unchecked")
public ImmutableSet<VisibilityPattern> createFromStringList(CellPathResolver cellNames, String paramName,
        @Nullable Object value, BuildTarget target) {
    if (value == null) {
        return ImmutableSet.of();
    }/*from w w  w. j a v a  2 s. c  o  m*/
    if (!(value instanceof List)) {
        throw new RuntimeException(String.format("Expected an array for %s but was %s", paramName, value));
    }
    ImmutableSet.Builder<VisibilityPattern> patterns = new ImmutableSet.Builder<>();
    VisibilityPatternParser parser = new VisibilityPatternParser();
    for (String visibility : (List<String>) value) {
        try {
            patterns.add(parser.parse(cellNames, visibility));
        } catch (IllegalArgumentException e) {
            throw new HumanReadableException(e,
                    "Bad visibility expression: %s listed %s in its %s argument, but only %s "
                            + "or fully qualified target patterns are allowed (i.e. those starting with "
                            + "// or a cell).",
                    target.getFullyQualifiedName(), visibility, paramName,
                    VisibilityPatternParser.VISIBILITY_PUBLIC);
        }
    }
    return patterns.build();
}

From source file:co.cask.cdap.security.authorization.AuthorizerClassLoader.java

@VisibleForTesting
static ClassLoader createParent() {
    ClassLoader baseClassLoader = AuthorizerClassLoader.class.getClassLoader();
    // Trace dependencies for Authorizer class. This will make classes from cdap-security-spi as well as  cdap-proto
    // and other dependencies of cdap-security-spi available to the authorizer extension.
    Set<String> authorizerResources;
    try {// w w w.  ja  v  a  2 s.c  o  m
        authorizerResources = ClassPathResources.getResourcesWithDependencies(baseClassLoader,
                Authorizer.class);
    } catch (IOException e) {
        LOG.error("Failed to determine resources for authorizer class loader while tracing dependencies of "
                + "Authorizer.", e);
        authorizerResources = ImmutableSet.of();
    }

    // Trace dependencies of cdap-api and include them as well. This will make classes like slf4j Logger implementation
    // as well as classes from twill-api and other dependencies required for cdap-api available to the authorizer
    // extension.
    Set<String> apiResources;
    try {
        apiResources = ClassPathResources.getResourcesWithDependencies(baseClassLoader, Application.class);
    } catch (IOException e) {
        LOG.error("Failed to determine resources for authorizer class loader while tracing dependencies of "
                + "cdap-api.", e);
        apiResources = ImmutableSet.of();
    }
    final Set<String> finalAuthorizerResources = Sets.union(authorizerResources, apiResources);
    return new FilterClassLoader(baseClassLoader, new FilterClassLoader.Filter() {
        @Override
        public boolean acceptResource(String resource) {
            return finalAuthorizerResources.contains(resource);
        }

        @Override
        public boolean acceptPackage(String packageName) {
            return true;
        }
    });
}