コード例 #1
0
 public AttributeValues merge(Map<? extends Attribute, ?> map, int mask) {
   if (map instanceof AttributeMap && ((AttributeMap) map).getValues() != null) {
     merge(((AttributeMap) map).getValues(), mask);
   } else if (map != null && !map.isEmpty()) {
     for (Map.Entry<? extends Attribute, ?> e : map.entrySet()) {
       EAttribute ea = EAttribute.forAttribute(e.getKey());
       if (ea != null && (mask & ea.mask) != 0) {
         set(ea, e.getValue());
       }
     }
   }
   return this;
 }
コード例 #2
0
 public static AttributeValues fromSerializableHashtable(Hashtable<Object, Object> ht) {
   AttributeValues result = new AttributeValues();
   if (ht != null && !ht.isEmpty()) {
     for (Map.Entry<Object, Object> e : ht.entrySet()) {
       Object key = e.getKey();
       Object val = e.getValue();
       if (key.equals(DEFINED_KEY)) {
         result.defineAll(((Integer) val).intValue());
       } else {
         try {
           EAttribute ea = EAttribute.forAttribute((Attribute) key);
           if (ea != null) {
             result.set(ea, val);
           }
         } catch (ClassCastException ex) {
         }
       }
     }
   }
   return result;
 }