Example usage for java.util Collections unmodifiableMap

List of usage examples for java.util Collections unmodifiableMap

Introduction

In this page you can find the example usage for java.util Collections unmodifiableMap.

Prototype

public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m) 

Source Link

Document

Returns an unmodifiable view of the specified map.

Usage

From source file:fr.mby.portal.coreimpl.action.BasicUserAction.java

@Override
public Map<String, String[]> getParameterMap() {
    return Collections.unmodifiableMap(this.parameters);
}

From source file:org.apache.syncope.core.init.ImplementationClassNamesLoader.java

public void load() {
    classNames = new EnumMap<Type, Set<String>>(Type.class);
    for (Type type : Type.values()) {
        classNames.put(type, new HashSet<String>());
    }/*www. ja  va  2  s .com*/

    Set<String> classes = new HashSet<String>();
    classes.add(UserReportlet.class.getName());
    classes.add(RoleReportlet.class.getName());
    classes.add(StaticReportlet.class.getName());
    classNames.put(Type.REPORTLET, classes);

    classes = new HashSet<String>();
    classes.add(SampleJob.class.getName());
    classNames.put(Type.TASKJOB, classes);

    classes = new HashSet<String>();
    classes.add(LDAPMembershipSyncActions.class.getName());
    classes.add(LDAPPasswordSyncActions.class.getName());
    classes.add(DBPasswordSyncActions.class.getName());
    classNames.put(Type.SYNC_ACTIONS, classes);

    classes = new HashSet<String>();
    classes.add(LDAPMembershipPropagationActions.class.getName());
    classes.add(LDAPPasswordPropagationActions.class.getName());
    classes.add(DBPasswordPropagationActions.class.getName());
    classNames.put(Type.PROPAGATION_ACTIONS, classes);

    classes = new HashSet<String>();
    classes.add(BasicValidator.class.getName());
    classes.add(AlwaysTrueValidator.class.getName());
    classes.add(EmailAddressValidator.class.getName());
    classNames.put(Type.VALIDATOR, classes);

    classNames = Collections.unmodifiableMap(classNames);

    LOG.debug("Implementation classes found: {}", classNames);
}

From source file:com.smartitengineering.cms.api.impl.type.FieldDefImpl.java

@Override
public Map<String, VariationDef> getVariations() {
    Map<String, VariationDef> defs = new LinkedHashMap<String, VariationDef>(variationDefs.size());
    for (VariationDef def : variationDefs) {
        defs.put(def.getName(), def);//from ww  w. j  a v a2  s  .  c om
    }
    return Collections.unmodifiableMap(defs);
}

From source file:com.cloudseal.spring.client.userdetails.CloudsealUserAttributes.java

public CloudsealUserAttributes(SAMLCredential credential) {
    userName = getUserName(credential);/*from www.  j  a  v a 2  s  . co  m*/

    Map<String, Collection<XMLObject>> attributes = getAttributes(credential);
    firstName = removeStringAttribute(attributes, FIRST_NAME);
    lastName = removeStringAttribute(attributes, LAST_NAME);
    email = removeStringAttribute(attributes, EMAIL);
    address = removeStringAttribute(attributes, ADDRESS);
    birthday = removeStringAttribute(attributes, BIRTHDAY);
    company = removeStringAttribute(attributes, COMPANY);
    country = removeStringAttribute(attributes, COUNTRY);
    department = removeStringAttribute(attributes, DEPARTMENT);
    gender = removeStringAttribute(attributes, GENDER);
    jobTitle = removeStringAttribute(attributes, JOB_TITLE);
    language = removeStringAttribute(attributes, LANGUAGE);
    middleInitial = removeStringAttribute(attributes, MIDDLE_INITIAL);
    phone = removeStringAttribute(attributes, PHONE);
    postCode = removeStringAttribute(attributes, POST_CODE);
    timezone = removeStringAttribute(attributes, TIMEZONE);
    roles = removeRoleListAttribute(attributes);

    this.attributes = Collections.unmodifiableMap(attributes);
}

From source file:it.inserpio.neo4art.spatial.SpatialQueriesTest.java

@Test
public void shouldExtractNationalGallery() {
    GraphDatabaseService graphDatabaseService = this.neo4jTemplate.getGraphDatabaseService();

    IndexManager indexManager = graphDatabaseService.index();

    Map<String, Object> params = new HashMap<String, Object>();
    params.put(LayerNodeIndex.POINT_PARAMETER, new Double[] { 51.5086, -0.1283 });
    params.put(LayerNodeIndex.DISTANCE_IN_KM_PARAMETER, 0.1);

    Map<String, String> config = Collections.unmodifiableMap(MapUtil.stringMap(
            SpatialIndexProvider.GEOMETRY_TYPE, LayerNodeIndex.POINT_GEOMETRY_TYPE, IndexManager.PROVIDER,
            SpatialIndexProvider.SERVICE_NAME, LayerNodeIndex.WKT_PROPERTY_KEY, "wkt"));

    String geoQuery = LayerNodeIndex.WITHIN_DISTANCE_QUERY;

    Index<Node> index = indexManager.forNodes(MuseumRepository.MUSEUM_GEOSPATIAL_INDEX, config);
    Assert.assertNotNull(index);//from  ww w . ja v  a 2  s. c o m
    IndexHits<Node> hits = index.query(geoQuery, params);
    Assert.assertTrue(hits.hasNext());

    CypherQueryEngine engine = this.neo4jTemplate.queryEngineFor();
    Result<Map<String, Object>> result = engine.query("start ng=node:"
            + MuseumRepository.MUSEUM_GEOSPATIAL_INDEX + "('withinDistance:[51.5086,-0.1283,0.1]') return ng",
            null);
    Assert.assertTrue(result.iterator().hasNext());
}

From source file:org.agatom.springatom.data.oid.impl.SOidServiceImpl.java

@PostConstruct
@SuppressWarnings("ConstantConditions")
private void readOidCreators() {
    Assert.notEmpty(oidCreators);/*from w  w  w .  ja v  a  2s  .  c o  m*/
    final Map<OidCreatorKey, SOidCreator<?>> localMap = Maps
            .newHashMapWithExpectedSize(this.oidCreators.size());
    for (final SOidCreator<?> oidCreator : oidCreators) {

        final Class<?> supportedType = resolveTypeArgument(oidCreator.getClass(), SOidCreator.class);
        final String prefix = findAnnotation(oidCreator.getClass(), OidProvider.class).prefix();

        localMap.put(new OidCreatorKey().setPrefix(prefix).setSupportedClass(supportedType), oidCreator);
    }
    this.oidCreatorsMap = Collections.unmodifiableMap(localMap);
}

From source file:com.handu.open.dubbo.monitor.RegistryContainer.java

public Map<String, List<URL>> getServiceProviders() {
    return Collections.unmodifiableMap(serviceProviders);
}

From source file:edu.rosehulman.sws.protocol.AbstractHttpRequest.java

/**
 * The key to value mapping in the request header fields.
 * /*from w  w  w . jav  a2 s .c  o  m*/
 * @return the header
 */
public Map<String, String> getHeader() {
    // Lets return the unmodifable view of the header map
    return Collections.unmodifiableMap(header);
}

From source file:com.facebook.stetho.inspector.MethodDispatcher.java

private static Map<String, MethodDispatchHelper> buildDispatchTable(ObjectMapper objectMapper,
        Iterable<ChromeDevtoolsDomain> domainHandlers) {
    Util.throwIfNull(objectMapper);
    HashMap<String, MethodDispatchHelper> methods = new HashMap<String, MethodDispatchHelper>();
    for (ChromeDevtoolsDomain domainHandler : Util.throwIfNull(domainHandlers)) {
        Class<?> handlerClass = domainHandler.getClass();
        String domainName = handlerClass.getSimpleName();

        for (Method method : handlerClass.getDeclaredMethods()) {
            if (isDevtoolsMethod(method)) {
                MethodDispatchHelper dispatchHelper = new MethodDispatchHelper(objectMapper, domainHandler,
                        method);//from   ww w . j a v a2 s .  c  o  m
                methods.put(domainName + "." + method.getName(), dispatchHelper);
            }
        }
    }
    return Collections.unmodifiableMap(methods);
}

From source file:com.wormsim.data.SimulationConditions.java

public SimulationConditions(RealDistribution p_food_dist, RealDistribution[] p_pheromone_dists,
        HashMap<String, IntegerDistribution> p_group_dists) {
    this.food_dist = p_food_dist;
    this.pheromone_dists = Collections.unmodifiableList(Arrays.asList(p_pheromone_dists));
    // TODO: Replicate the group to protect the map using clone
    @SuppressWarnings("unchecked")
    Map<String, IntegerDistribution> clone = (Map<String, IntegerDistribution>) p_group_dists.clone();
    this.group_dists = Collections.unmodifiableMap(clone);
}