Very nice. I like the clean syntax and I believe the method is using varargs.
Thanks for letting us know. :) Regards, Pierre-Arnaud On Wed, Sep 30, 2009 at 2:03 AM, Emmanuel Lecharny <[email protected]>wrote: > Hi guys, > > while being in Portland, I saw a slide from Neil Willson where he shown > something like a helper method to create entries using a LDIF format, but > using multi-attributes instead of using a single string. > > I have create such a static method in AttributeUtils. Instead of doing that > in your code : > > Attributes attrs = new BasicAttributes( true ); > Attribute oc = new BasicAttribute( "objectClass", "top" ); > oc.add( "metaTop" ); > oc.add( "metaAttributeType" ); > attrs.put( oc ); > attrs.put( "m-oid", OID ); > attrs.put( "m-syntax", SchemaConstants.INTEGER_SYNTAX ); > attrs.put( "m-description", DESCRIPTION0 ); > attrs.put( "m-equality", "caseIgnoreMatch" ); > attrs.put( "m-singleValue", "FALSE" ); > attrs.put( "m-usage", "directoryOperation" ); > > do now : > > Attributes attrs = AttributeUtils.createAttributes( > "objectClass: top", > "objectClass: metaTop", > "objectClass: metaAttributeType", > "m-oid:" + OID, > "m-syntax:" + SchemaConstants.INTEGER_SYNTAX, > "m-description:" + DESCRIPTION0, > "m-equality: caseIgnoreMatch", > "m-singleValue: FALSE", > "m-usage: directoryOperation" ); > > Way better ! And thanks Neil for the idea ! > > -- > -- > cordialement, regards, > Emmanuel Lécharny > www.iktek.com > directory.apache.org > > >
