Exemplo n.º 1
0
  static {
    // Populate synonyms.
    synonyms.put("CAPTION", MEMBER_CAPTION);
    synonyms.put("FORMAT", FORMAT_STRING);

    // Populate map of upper-case property names.
    for (String propertyName : enumeration.getNames()) {
      final Property property = enumeration.getValue(propertyName, true);
      mapUpperNameToProperties.put(propertyName.toUpperCase(), property);
      assert property.getOrdinal() < MAX_ORDINAL;
    }

    // Add synonyms.
    for (Map.Entry<String, Property> entry : synonyms.entrySet()) {
      mapUpperNameToProperties.put(entry.getKey().toUpperCase(), entry.getValue());
    }
  }
Exemplo n.º 2
0
 /**
  * Looks up a Property with a given name.
  *
  * @param name Name of property
  * @param matchCase Whether to perform case-sensitive match
  * @return Property with given name, or null if not found.
  */
 public static Property lookup(String name, boolean matchCase) {
   if (matchCase) {
     Property property = enumeration.getValue(name, false);
     if (property != null) {
       return property;
     }
     return synonyms.get(name);
   } else {
     // No need to check synonyms separately - the map contains them.
     return mapUpperNameToProperties.get(name.toUpperCase());
   }
 }
Exemplo n.º 3
0
 /** Looks up a Property with a given ordinal. Returns null if not found. */
 public static Property lookup(int ordinal) {
   return enumeration.getValue(ordinal);
 }