Ejemplo n.º 1
0
 public void setValue(Attribute attribute, Object value) {
   checkWritable();
   if (value != null && !(value instanceof Collection<?>)) {
     value = Collections.singleton(value);
   }
   setValues(attribute, (Collection<?>) value);
 }
Ejemplo n.º 2
0
 public <T> void addValue(Attribute attribute, T value) {
   checkWritable();
   String attributeKey = attribute.getKey();
   String stringValue = toStringValue(attribute, value);
   if (stringValue == null) {
     return;
   }
   addValue(attributeKey, stringValue);
 }
Ejemplo n.º 3
0
 public <T> void addValue(Attribute attribute, T value) {
   checkWritable();
   String attributeKey = attribute.getKey();
   String stringValue = ((AttributeImpl) attribute).toStringValue(value);
   if (stringValue == null) {
     return;
   }
   List<String> l = data.get(attributeKey);
   if (l == null) {
     l = new ArrayList<String>();
     data.put(attributeKey, l);
   }
   l.add(stringValue);
 }
Ejemplo n.º 4
0
 public <T> void setValues(Attribute attribute, Collection<T> values) {
   checkWritable();
   String attributeKey = attribute.getKey();
   if (values == null || values.isEmpty()) {
     data.remove(attributeKey);
     name = null;
     return;
   }
   ArrayList<String> newValues = new ArrayList<String>();
   for (Object value : values) {
     String stringValue = ((AttributeImpl) attribute).toStringValue(value);
     if (stringValue != null) {
       newValues.add(stringValue);
     }
   }
   data.put(attributeKey, newValues);
   // isNameUpToDate = false;
   name = null;
 }