1 22 package org.jboss.beans.metadata.plugins; 23 24 import java.util.Collection ; 25 import java.util.HashSet ; 26 import java.util.Set ; 27 28 import org.jboss.beans.metadata.spi.MetaDataVisitorNode; 29 import org.jboss.util.JBossStringBuilder; 30 31 37 public class AbstractSetMetaData extends AbstractCollectionMetaData implements Set <MetaDataVisitorNode> 38 { 39 42 public AbstractSetMetaData() 43 { 44 } 45 46 public boolean add(MetaDataVisitorNode o) 47 { 48 if (collection.contains(o)) 49 return false; 50 return super.add(o); 51 } 52 53 public boolean addAll(Collection <? extends MetaDataVisitorNode> c) 54 { 55 boolean changed = false; 56 if (c != null && c.size() > 0) 57 { 58 for (MetaDataVisitorNode o : c) 59 { 60 if (collection.contains(o) == false) 61 { 62 if (super.add(o)) 63 changed = true; 64 } 65 } 66 } 67 return changed; 68 } 69 70 public void toString(JBossStringBuilder buffer) 71 { 72 super.toString(buffer); 73 } 74 75 protected Collection <Object > getDefaultCollectionInstance() throws Throwable 76 { 77 return new HashSet <Object >(); 78 } 79 } | Popular Tags |