private Object readValue(LDAPAttribute att) { if (att == null) return null; if (att.size() == 1) { // single value // for now everything is string return att.getStringValue(); } else { return att.getStringValueArray(); } } }
/** * Returns the number of values in the attribute. * * @see <a href="../../../../api/com/novell/ldap/LDAPAttribute.html#size()"> com.novell.ldap.LDAPAttribute.size()</a> */ public int size() { return attr.size(); }
/** * Build the attribuite list from an LDAPEntry. * * @param entry The LDAPEntry associated with this add request. */ private static final RfcAttributeList makeRfcAttrList( LDAPEntry entry) { // convert Java-API LDAPEntry to RFC2251 AttributeList LDAPAttributeSet attrSet = entry.getAttributeSet(); RfcAttributeList attrList = new RfcAttributeList(attrSet.size()); Iterator itr = attrSet.iterator(); while (itr.hasNext()) { LDAPAttribute attr = (LDAPAttribute)itr.next(); ASN1SetOf vals = new ASN1SetOf(attr.size()); Enumeration attrEnum = attr.getByteValues(); while(attrEnum.hasMoreElements()) { vals.add(new RfcAttributeValue((byte[])attrEnum.nextElement())); } attrList.add(new RfcAttributeTypeAndValues( new RfcAttributeDescription(attr.getName()), vals)); } return attrList; }
if( attr.size() != 1) { throw new IllegalArgumentException("compare: Exactly one value " + "must be present in the LDAPAttribute");