Removes the attribute with the specified AttributeTypes.
The removed attribute are returned by this method.
If there is no attribute with the specified AttributeTypes, the return value is null.
null
33433344334533463347334833493350335133523353
assertTrue( entry.containsAttribute( "objectclass", "userpassword" ) ); List<Attribute> removed = entry.removeAttributes( ( AttributeType ) null ); assertNull( removed ); removed = entry.removeAttributes( atC ); assertNull( removed ); } /**
33633364336533663367336833693370337133723373
Attribute attrSN = new DefaultAttribute( atSN, "Test1", "Test2" ); Attribute attrPWD = new DefaultAttribute( atPwd, BYTES1, BYTES2 ); entry.put( attrOC, attrCN, attrSN, attrPWD ); entry.removeAttributes( "CN", "SN" ); assertFalse( entry.containsAttribute( "cn", "sn" ) ); assertTrue( entry.containsAttribute( "objectclass", "userpassword" ) ); List<Attribute> removed = entry.removeAttributes( "badId" );
33683369337033713372337333743375337633773378
entry.removeAttributes( "CN", "SN" ); assertFalse( entry.containsAttribute( "cn", "sn" ) ); assertTrue( entry.containsAttribute( "objectclass", "userpassword" ) ); List<Attribute> removed = entry.removeAttributes( "badId" ); assertNull( removed ); removed = entry.removeAttributes( "l" ); assertNull( removed );
33713372337333743375337633773378337933803381
assertTrue( entry.containsAttribute( "objectclass", "userpassword" ) ); List<Attribute> removed = entry.removeAttributes( "badId" ); assertNull( removed ); removed = entry.removeAttributes( "l" ); assertNull( removed ); removed = entry.removeAttributes( ( String ) null ); assertNull( removed ); }
33743375337633773378337933803381338233833384
assertNull( removed ); removed = entry.removeAttributes( "l" ); assertNull( removed ); removed = entry.removeAttributes( ( String ) null ); assertNull( removed ); } /**
35033504350535063507350835093510351135123513
Value<byte[]> testB1 = new BinaryValue( atPassword, b1 ); Value<byte[]> testB2 = new BinaryValue( atPassword, b2 ); // test a removal of an non existing attribute List<Attribute> removed = entry.removeAttributes( atCN ); assertNull( removed ); // Test a simple removal entry.add( "cN", atCN, test1 ); assertEquals( 1, entry.size() );
35103511351235133514351535163517351835193520
// Test a simple removal entry.add( "cN", atCN, test1 ); assertEquals( 1, entry.size() ); assertNotNull( entry.get( atCN ) ); entry.removeAttributes( "CN" ); assertEquals( 0, entry.size() ); assertNull( entry.get( atCN ) ); // Test a removal of many elements entry.put( "CN", test1, test2 );
35233524352535263527352835293530353135323533
assertNotNull( entry.get( atCN ) ); assertNotNull( entry.get( atPassword ) ); AttributeType OBJECT_CLASS_AT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT ); entry.removeAttributes( "cN", "UsErPaSsWoRd" ); assertEquals( 0, entry.size() ); assertNull( entry.get( atCN ) ); assertNull( entry.get( atPassword ) ); assertFalse( entry.contains( OBJECT_CLASS_AT, "top" ) );