Java Collections.unmodifiableMap Examples

Java Collections.unmodifiableMap - 30 examples found. These are the top rated real world Java examples of java.util.Collections.unmodifiableMap extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 public ObfuscateData getObfuscateData() {
   ObfuscateData data = new ObfuscateData();
   data.resName = getResKey();
   data.typeMaping = Collections.unmodifiableMap(mTypeMaping);
   data.keyMaping = Collections.unmodifiableMap(mKeyMaping);
   return data;
 }
  // Initialize highlight mapping table
  static {
    Map<TextAttribute, Object> styles[] = new Map[4];
    HashMap<TextAttribute, Object> map;

    // UNSELECTED_RAW_TEXT_HIGHLIGHT
    map = new HashMap(1);
    map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
    styles[0] = Collections.unmodifiableMap(map);

    // SELECTED_RAW_TEXT_HIGHLIGHT
    map = new HashMap(1);
    map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_GRAY);
    styles[1] = Collections.unmodifiableMap(map);

    // UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
    map = new HashMap(1);
    map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_DOTTED);
    styles[2] = Collections.unmodifiableMap(map);

    // SELECTED_CONVERTED_TEXT_HIGHLIGHT
    map = new HashMap(4);
    Color navyBlue = new Color(0, 0, 128);
    map.put(TextAttribute.FOREGROUND, navyBlue);
    map.put(TextAttribute.BACKGROUND, Color.white);
    map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
    map.put(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
    styles[3] = Collections.unmodifiableMap(map);

    highlightStyles = styles;
  }
  static {
    Map<Class, CoreMapAttributeAggregator> defaultAggr =
        new ArrayMap<Class, CoreMapAttributeAggregator>();
    defaultAggr.put(CoreAnnotations.TextAnnotation.class, CoreMapAttributeAggregator.CONCAT);
    defaultAggr.put(
        CoreAnnotations.CharacterOffsetBeginAnnotation.class, CoreMapAttributeAggregator.FIRST);
    defaultAggr.put(
        CoreAnnotations.CharacterOffsetEndAnnotation.class, CoreMapAttributeAggregator.LAST);
    defaultAggr.put(CoreAnnotations.TokenBeginAnnotation.class, CoreMapAttributeAggregator.FIRST);
    defaultAggr.put(CoreAnnotations.TokenEndAnnotation.class, CoreMapAttributeAggregator.LAST);
    defaultAggr.put(
        CoreAnnotations.TokensAnnotation.class, CoreMapAttributeAggregator.CONCAT_TOKENS);
    DEFAULT_AGGREGATORS = Collections.unmodifiableMap(defaultAggr);

    Map<Class, CoreMapAttributeAggregator> defaultNumericAggr =
        new ArrayMap<Class, CoreMapAttributeAggregator>(DEFAULT_AGGREGATORS);
    defaultNumericAggr.put(
        CoreAnnotations.NumericCompositeTypeAnnotation.class,
        CoreMapAttributeAggregator.FIRST_NON_NIL);
    defaultNumericAggr.put(
        CoreAnnotations.NumericCompositeValueAnnotation.class,
        CoreMapAttributeAggregator.FIRST_NON_NIL);
    defaultNumericAggr.put(
        CoreAnnotations.NamedEntityTagAnnotation.class, CoreMapAttributeAggregator.FIRST_NON_NIL);
    defaultNumericAggr.put(
        CoreAnnotations.NormalizedNamedEntityTagAnnotation.class,
        CoreMapAttributeAggregator.FIRST_NON_NIL);
    DEFAULT_NUMERIC_AGGREGATORS = Collections.unmodifiableMap(defaultNumericAggr);

    Map<Class, CoreMapAttributeAggregator> defaultNumericTokensAggr =
        new ArrayMap<Class, CoreMapAttributeAggregator>(DEFAULT_NUMERIC_AGGREGATORS);
    defaultNumericTokensAggr.put(
        CoreAnnotations.NumerizedTokensAnnotation.class, CoreMapAttributeAggregator.CONCAT_COREMAP);
    DEFAULT_NUMERIC_TOKENS_AGGREGATORS = Collections.unmodifiableMap(defaultNumericTokensAggr);
  }
    public synchronized Map<String, Object[]> getParameterMap() {
      if (parameterMap == null) {
        // Two conditions: file upload ("multipart/form-data") or not
        if (getContentType() != null && getContentType().startsWith("multipart/form-data")) {
          // Special handling for multipart/form-data

          // Decode the multipart data
          parameterMap =
              Multipart.getParameterMapMultipart(
                  pipelineContext, request, ServletExternalContext.DEFAULT_FORM_CHARSET_DEFAULT);
        } else if (portletRequest instanceof ResourceRequest) {
          // We encoded query parameters directly into the resource id in this case
          final String queryString =
              NetUtils.getQueryString(((ResourceRequest) portletRequest).getResourceID());
          if (queryString != null)
            parameterMap =
                Collections.unmodifiableMap(
                    StringConversions.stringArrayMapToObjectArrayMap(
                        NetUtils.decodeQueryString(queryString, false)));
          else parameterMap = Collections.emptyMap();
        } else {
          // Not a resource request, so just use native request parameters
          parameterMap = new HashMap<String, Object[]>(portletRequest.getParameterMap());
          parameterMap.remove(WSRPURLRewriter.PathParameterName());
          parameterMap = Collections.unmodifiableMap(parameterMap);
        }
      }
      return parameterMap;
    }
Example #5
0
  public HttpEventImpl(
      HttpServer source,
      RequestMode mode,
      URI requestURI,
      InetSocketAddress remoteAddress,
      String plainUri,
      HttpSession session,
      Map<String, String> cookies,
      Map<String, String> get,
      Map<String, String> post,
      String requestBody) {

    this.source = source;
    this.mode = mode;
    this.requestUri = requestURI;
    this.plainUri = plainUri;
    this.clientIp = remoteAddress;
    this.session = session;
    this.requestBody = requestBody;

    this.cookies = Collections.unmodifiableMap(cookies);
    this.get = Collections.unmodifiableMap(get);
    this.post = Collections.unmodifiableMap(post);
    this.closeListener = new ArrayList<>();

    this.creationTime = new Date();
  }
  static {
    String path =
        "/2013-04-01/hostedzone/{Id}/rrset?type={Type}&name={Name}&identifier={Identifier}&maxitems={MaxItems}";
    Map<String, String> staticMap = new HashMap<String, String>();
    Map<String, String> dynamicMap = new HashMap<String, String>();

    int index = path.indexOf("?");
    if (index != -1) {
      String queryString = path.substring(index + 1);
      path = path.substring(0, index);

      for (String s : queryString.split("[;&]")) {
        index = s.indexOf("=");
        if (index != -1) {
          String name = s.substring(0, index);
          String value = s.substring(index + 1);

          if (value.startsWith("{") && value.endsWith("}")) {
            dynamicMap.put(value.substring(1, value.length() - 1), name);
          } else {
            staticMap.put(name, value);
          }
        }
      }
    }

    RESOURCE_PATH_TEMPLATE = path;
    STATIC_QUERY_PARAMS = Collections.unmodifiableMap(staticMap);
    DYNAMIC_QUERY_PARAMS = Collections.unmodifiableMap(dynamicMap);
  }