Пример #1
0
 /**
  * Adds the supplied values for this attribute by encoding them with the supplied transcoder.
  *
  * @param  <T> type attribute to encode
  * @param transcoder to encode value with
  * @param value to encode and add
  * @throws NullPointerException if value is null
  */
 public <T> void addValue(final ValueTranscoder<T> transcoder, final T... value) {
   for (T t : value) {
     if (isBinary()) {
       attributeValues.add(transcoder.encodeBinaryValue(t));
     } else {
       attributeValues.add(transcoder.encodeStringValue(t));
     }
   }
 }
Пример #2
0
 /** Removes all the values in this ldap attribute. */
 public void clear() {
   attributeValues.clear();
 }
Пример #3
0
 /**
  * Returns the number of values in this ldap attribute.
  *
  * @return number of values in this ldap attribute
  */
 public int size() {
   return attributeValues.size();
 }
Пример #4
0
 /**
  * Removes the supplied value from the attribute values if it exists.
  *
  * @param value to remove
  */
 public void removeBinaryValue(final byte[]... value) {
   for (byte[] b : value) {
     attributeValues.remove(b);
   }
 }
Пример #5
0
 /**
  * Removes the supplied value from the attribute values if it exists.
  *
  * @param value to remove
  */
 public void removeStringValue(final String... value) {
   for (String s : value) {
     attributeValues.remove(s);
   }
 }
Пример #6
0
 /**
  * Adds the supplied byte array as a value for this attribute.
  *
  * @param value to add
  * @throws NullPointerException if value is null
  */
 public void addBinaryValue(final byte[]... value) {
   for (byte[] b : value) {
     attributeValues.add(b);
   }
 }
Пример #7
0
 /**
  * Adds the supplied string as a value for this attribute.
  *
  * @param value to add
  * @throws NullPointerException if value is null
  */
 public void addStringValue(final String... value) {
   for (String s : value) {
     attributeValues.add(s);
   }
 }
Пример #8
0
 /**
  * Returns whether this ldap attribute contains a value of type byte[].
  *
  * @return whether this ldap attribute contains a value of type byte[]
  */
 public boolean isBinary() {
   return attributeValues.isType(byte[].class);
 }
Пример #9
0
 /**
  * Returns the values of this attribute as byte arrays. String data is UTF-8 encoded. The return
  * collection cannot be modified.
  *
  * @return collection of byte array attribute values
  */
 public Collection<byte[]> getBinaryValues() {
   return attributeValues.getBinaryValues();
 }
Пример #10
0
 /**
  * Returns the values of this attribute as strings. Binary data is base64 encoded. The return
  * collection cannot be modified.
  *
  * @return collection of string attribute values
  */
 public Collection<String> getStringValues() {
   return attributeValues.getStringValues();
 }