/** * <p> * Places a new attribute with the supplied AttributeType and binary values * into the attribute collection. * </p> * <p> * If there is already an attribute with the same AttributeType, the old * one is removed from the collection and is returned by this method. * </p> * <p> * This method provides a mechanism to put an attribute with a * <code>null</code> value: the value may be <code>null</code>. * * @param attributeType the type of the new attribute to be put * @param values the binary values of the new attribute to be put * @return the old attribute with the same identifier, if exists; otherwise * <code>null</code> * @throws LdapException if there are failures */ public EntryAttribute put( AttributeType attributeType, byte[]... values ) throws LdapException { return put( null, attributeType, values ); }
/** * <p> * Places a new attribute with the supplied AttributeType and String values * into the attribute collection. * </p> * <p> * If there is already an attribute with the same AttributeType, the old * one is removed from the collection and is returned by this method. * </p> * <p> * This method provides a mechanism to put an attribute with a * <code>null</code> value: the value may be <code>null</code>. * * @param attributeType the type of the new attribute to be put * @param values the String values of the new attribute to be put * @return the old attribute with the same identifier, if exists; otherwise * <code>null</code> * @throws LdapException if there are failures */ public EntryAttribute put( AttributeType attributeType, String... values ) throws LdapException { return put( null, attributeType, values ); }
/** * <p> * Places a new attribute with the supplied AttributeType and some values * into the attribute collection. * </p> * <p> * If there is already an attribute with the same AttributeType, the old * one is removed from the collection and is returned by this method. * </p> * <p> * This method provides a mechanism to put an attribute with a * <code>null</code> value: the value may be <code>null</code>. * * @param attributeType the type of the new attribute to be put * @param values the values of the new attribute to be put * @return the old attribute with the same identifier, if exists; otherwise * <code>null</code> * @throws LdapException if there are failures */ public EntryAttribute put( AttributeType attributeType, Value<?>... values ) throws LdapException { return put( null, attributeType, values ); }
put( attribute );
/** * <p> * Put an attribute (represented by its ID and some binary values) into an entry. * </p> * <p> * If the attribute already exists, the previous attribute will be * replaced and returned. * </p> * <p> * If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown. * </p> * * @param upId The attribute ID * @param values The list of binary values to put. It can be empty. * @return The replaced attribute */ public EntryAttribute put( String upId, byte[]... values ) { try { return put( upId, getAttributeType( upId ), values ); } catch ( LdapException ne ) { String message = I18n.err( I18n.ERR_04464, upId, ne.getLocalizedMessage() ); LOG.error( message ); throw new IllegalArgumentException( message ); } }
/** * <p> * Put an attribute (represented by its ID and some String values) into an entry. * </p> * <p> * If the attribute already exists, the previous attribute will be * replaced and returned. * </p> * <p> * If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown. * </p> * * @param upId The attribute ID * @param values The list of String values to put. It can be empty. * @return The replaced attribute */ public EntryAttribute put( String upId, String... values ) { try { return put( upId, getAttributeType( upId ), values ); } catch ( LdapException ne ) { String message = I18n.err( I18n.ERR_04464, upId, ne.getLocalizedMessage() ); LOG.error( message ); throw new IllegalArgumentException( message ); } }
/** * <p> * Put an attribute (represented by its ID and some values) into an entry. * </p> * <p> * If the attribute already exists, the previous attribute will be * replaced and returned. * </p> * <p> * If the upId is not the ID of an existing AttributeType, an IllegalArgumentException is thrown. * </p> * * @param upId The attribute ID * @param values The list of values to put. It can be empty. * @return The replaced attribute */ public EntryAttribute put( String upId, Value<?>... values ) { try { return put( upId, getAttributeType( upId ), values ); } catch ( LdapException ne ) { String message = I18n.err( I18n.ERR_04464, upId, ne.getLocalizedMessage() ); LOG.error( message ); throw new IllegalArgumentException( message ); } }
put( upId, attributeType, (String)null );