/** * Retrieves the set of values for the specified attribute as byte arrays, if * available. * * @param attributeName The name of the attribute for which to retrieve the * values. It must not be {@code null}. * * @return The set of values for the specified attribute as byte arrays, or * {@code null} if that attribute is not available. */ public byte[][] getAttributeValueByteArrays(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { return a.getByteValues(); } } return null; }
/** * Retrieves the set of values for the specified attribute, if available. * * @param attributeName The name of the attribute for which to retrieve the * values. It must not be {@code null}. * * @return The set of values for the specified attribute, or {@code null} if * that attribute is not available. */ public String[] getAttributeValues(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { return a.getStringValues(); } } return null; }
/** * Retrieves the attribute with the specified name. * * @param attributeName The name of the attribute to retrieve. It must not * be {@code null}. * * @return The requested attribute from this entry, or {@code null} if the * specified attribute is not present in this entry. */ public Attribute getAttribute(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { return a.toAttribute(); } } return null; }
/** * Retrieves the set of attributes contained in this entry. * * @return The set of attributes contained in this entry. */ public Collection<Attribute> getAttributes() { final ArrayList<Attribute> attrList = new ArrayList<Attribute>(attributes.length); for (final CompactAttribute a : attributes) { attrList.add(a.toAttribute()); } return Collections.unmodifiableCollection(attrList); }
/** * Creates a compact attribute from the provided attribute. * * @param attribute The attribute to use to create this compact attribute. */ CompactAttribute(final Attribute attribute) { name = internName(attribute.getName()); values = attribute.getValueByteArrays(); }
/** * Creates a new compact entry from the provided entry. * * @param entry The entry to use to create this compact entry. It must not * be {@code null}. */ public CompactEntry(final Entry entry) { ensureNotNull(entry); dn = entry.getDN(); hashCode = -1; final Collection<Attribute> attrs = entry.getAttributes(); attributes = new CompactAttribute[attrs.size()]; final Iterator<Attribute> iterator = attrs.iterator(); for (int i=0; i < attributes.length; i++) { attributes[i] = new CompactAttribute(iterator.next()); } }
/** * Indicates whether this entry contains the specified attribute. * * @param attributeName The name of the attribute for which to make the * determination. It must not be {@code null}. * * @return {@code true} if this entry contains the specified attribute, or * {@code false} if not. */ public boolean hasAttribute(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { return true; } } return false; }
/** * Retrieves the set of attributes contained in this entry. * * @return The set of attributes contained in this entry. */ public Collection<Attribute> getAttributes() { final ArrayList<Attribute> attrList = new ArrayList<Attribute>(attributes.length); for (final CompactAttribute a : attributes) { attrList.add(a.toAttribute()); } return Collections.unmodifiableCollection(attrList); }
/** * Creates a compact attribute from the provided attribute. * * @param attribute The attribute to use to create this compact attribute. */ CompactAttribute(final Attribute attribute) { name = internName(attribute.getName()); values = attribute.getValueByteArrays(); }
/** * Creates a new compact entry from the provided entry. * * @param entry The entry to use to create this compact entry. It must not * be {@code null}. */ public CompactEntry(final Entry entry) { ensureNotNull(entry); dn = entry.getDN(); hashCode = -1; final Collection<Attribute> attrs = entry.getAttributes(); attributes = new CompactAttribute[attrs.size()]; final Iterator<Attribute> iterator = attrs.iterator(); for (int i=0; i < attributes.length; i++) { attributes[i] = new CompactAttribute(iterator.next()); } }
/** * Indicates whether this entry contains the specified attribute. * * @param attributeName The name of the attribute for which to make the * determination. It must not be {@code null}. * * @return {@code true} if this entry contains the specified attribute, or * {@code false} if not. */ public boolean hasAttribute(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { return true; } } return false; }
/** * Retrieves the attribute with the specified name. * * @param attributeName The name of the attribute to retrieve. It must not * be {@code null}. * * @return The requested attribute from this entry, or {@code null} if the * specified attribute is not present in this entry. */ public Attribute getAttribute(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { return a.toAttribute(); } } return null; }
/** * Retrieves the set of values for the specified attribute, if available. * * @param attributeName The name of the attribute for which to retrieve the * values. It must not be {@code null}. * * @return The set of values for the specified attribute, or {@code null} if * that attribute is not available. */ public String[] getAttributeValues(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { return a.getStringValues(); } } return null; }
/** * Retrieves the set of values for the specified attribute as byte arrays, if * available. * * @param attributeName The name of the attribute for which to retrieve the * values. It must not be {@code null}. * * @return The set of values for the specified attribute as byte arrays, or * {@code null} if that attribute is not available. */ public byte[][] getAttributeValueByteArrays(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { return a.getByteValues(); } } return null; }
/** * Converts this compact entry to a full entry. * * @return The entry created from this compact entry. */ public Entry toEntry() { final Attribute[] attrs = new Attribute[attributes.length]; for (int i=0; i < attributes.length; i++) { attrs[i] = attributes[i].toAttribute(); } return new Entry(dn, attrs); }
/** * Indicates whether this entry contains an attribute with the given name and * value. * * @param attributeName The name of the attribute for which to make the * determination. It must not be {@code null}. * @param attributeValue The value for which to make the determination. It * must not be {@code null}. * * @return {@code true} if this entry contains an attribute with the * specified name and value, or {@code false} if not. */ public boolean hasAttributeValue(final String attributeName, final byte[] attributeValue) { ensureNotNull(attributeName, attributeValue); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName) && a.toAttribute().hasValue(attributeValue)) { return true; } } return false; }
/** * Retrieves the value for the specified attribute, if available. If the * attribute has more than one value, then the first value will be returned. * * @param attributeName The name of the attribute for which to retrieve the * value. It must not be {@code null}. * * @return The value for the specified attribute, or {@code null} if that * attribute is not available. */ public String getAttributeValue(final String attributeName) { ensureNotNull(attributeName); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName)) { final String[] values = a.getStringValues(); if (values.length > 0) { return values[0]; } else { return null; } } } return null; }
if (a.getName().equalsIgnoreCase(attributeName)) final byte[][] values = a.getByteValues(); if (values.length > 0)
/** * Converts this compact entry to a full entry. * * @return The entry created from this compact entry. */ public Entry toEntry() { final Attribute[] attrs = new Attribute[attributes.length]; for (int i=0; i < attributes.length; i++) { attrs[i] = attributes[i].toAttribute(); } return new Entry(dn, attrs); }
/** * Indicates whether this entry contains an attribute with the given name and * value. * * @param attributeName The name of the attribute for which to make the * determination. It must not be {@code null}. * @param attributeValue The value for which to make the determination. It * must not be {@code null}. * * @return {@code true} if this entry contains an attribute with the * specified name and value, or {@code false} if not. */ public boolean hasAttributeValue(final String attributeName, final byte[] attributeValue) { ensureNotNull(attributeName, attributeValue); for (final CompactAttribute a : attributes) { if (a.getName().equalsIgnoreCase(attributeName) && a.toAttribute().hasValue(attributeValue)) { return true; } } return false; }