示例#1
0
 @Override
 public java.lang.String toString() {
   StringBuilder sb = new StringBuilder("{");
   for (Attribute<?> a : list) {
     if (null == a) {
       sb.append(a).append(",");
     } else {
       if (a instanceof AttributeValueAssertion) {
         Class<?> cls = AttributeFactory.valueType(a.getOid());
         if (!ByteArray.class.equals(cls)) {
           Attribute<?> _a = AttributeFactory.getAttribute(a.getOid());
           if (null != _a) {
             if (get(_a)) {
               a = _a;
             }
           }
         }
       }
       sb.append(AttributeId.valueOf(a.getOid().getType()));
       sb.append("=").append(a);
       sb.append(",");
     }
   }
   if (sb.length() > 1) {
     sb.delete(sb.length() - 1, sb.length());
   }
   sb.append("}");
   return sb.toString();
 }
示例#2
0
 @SuppressWarnings("unchecked")
 public <T extends Value> Attribute<T> getAttribute(
     OIDType oid, Class<T> valueClass, Attribute<T> attr) {
   Attribute<?> a = get(oid);
   if (a != null && valueClass.isInstance(a.getValue())) {
     return (Attribute<T>) a;
   } else {
     attr = null == attr ? AttributeFactory.getAttribute(oid, valueClass) : attr;
     return get(oid, attr) ? attr : null;
   }
 }