コード例 #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();
 }