org.jboss.beans.metadata.plugins
Class AbstractCollectionMetaData

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.beans.metadata.plugins.AbstractValueMetaData
          extended by org.jboss.beans.metadata.plugins.AbstractTypeMetaData
              extended by org.jboss.beans.metadata.plugins.AbstractCollectionMetaData
All Implemented Interfaces:
Cloneable, Iterable, Collection, MetaDataVisitorNode, ValueMetaData, org.jboss.util.JBossInterface
Direct Known Subclasses:
AbstractListMetaData, AbstractSetMetaData

public class AbstractCollectionMetaData
extends AbstractTypeMetaData
implements Collection

Collection metadata.

Version:
$Revision: 1.11 $
Author:
Adrian Brock

Field Summary
protected  ArrayList collection
          The collection
protected  String elementType
          The element type
 
Fields inherited from class org.jboss.beans.metadata.plugins.AbstractTypeMetaData
configurator, type
 
Fields inherited from class org.jboss.beans.metadata.plugins.AbstractValueMetaData
value
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Constructor Summary
AbstractCollectionMetaData()
          Create a new collection value
 
Method Summary
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 Iterator getChildren()
          Return the child nodes
protected  Object getCollectionInstance(TypeInfo info, ClassLoader cl, Class expected)
          Create the collection instance
protected  Object getDefaultCollectionInstance()
          Create the default collection instance
protected  ClassInfo getElementClassInfo(ClassLoader cl)
          Get the class info for the element type
 String getElementType()
          Get the element type
 Object getValue(TypeInfo info, ClassLoader cl)
          Get the value.
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 boolean retainAll(Collection c)
           
 void setElementType(String elementType)
          Set the element type
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 void toString(org.jboss.util.JBossStringBuilder buffer)
           
 
Methods inherited from class org.jboss.beans.metadata.plugins.AbstractTypeMetaData
getClassInfo, getType, setConfigurator, setType, visit
 
Methods inherited from class org.jboss.beans.metadata.plugins.AbstractValueMetaData
getUnderlyingValue, getValue, setValue, toShortString
 
Methods inherited from class org.jboss.util.JBossObject
cacheGetHashCode, cacheToString, clone, equals, flushJBossObjectCache, getClassShortName, getHashCode, hashCode, list, notEqual, toShortString, toString, toStringImplementation
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 
Methods inherited from interface org.jboss.util.JBossInterface
clone, toShortString
 

Field Detail

collection

protected ArrayList collection
The collection


elementType

protected String elementType
The element type

Constructor Detail

AbstractCollectionMetaData

public AbstractCollectionMetaData()
Create a new collection value

Method Detail

getElementType

public String getElementType()
Get the element type

Returns:
the element type

setElementType

public void setElementType(String elementType)
Set the element type

Parameters:
elementType - the element type

getValue

public Object getValue(TypeInfo info,
                       ClassLoader cl)
                throws Throwable
Description copied from interface: ValueMetaData
Get the value.

Specified by:
getValue in interface ValueMetaData
Overrides:
getValue in class AbstractValueMetaData
Parameters:
info - the type info
cl - the classloader
Returns:
the value.
Throws:
Throwable - for any error

add

public boolean add(Object o)
Specified by:
add in interface Collection

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface Collection

clear

public void clear()
Specified by:
clear in interface Collection

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection

containsAll

public boolean containsAll(Collection c)
Specified by:
containsAll in interface Collection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection

removeAll

public boolean removeAll(Collection c)
Specified by:
removeAll in interface Collection

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface Collection

size

public int size()
Specified by:
size in interface Collection

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection

getChildren

public Iterator getChildren()
Description copied from interface: MetaDataVisitorNode
Return the child nodes

Specified by:
getChildren in interface MetaDataVisitorNode
Overrides:
getChildren in class AbstractValueMetaData
Returns:
Iterator or null if there aren't any

toString

public void toString(org.jboss.util.JBossStringBuilder buffer)
Overrides:
toString in class AbstractTypeMetaData

getDefaultCollectionInstance

protected Object getDefaultCollectionInstance()
                                       throws Throwable
Create the default collection instance

Returns:
the class instance
Throws:
Throwable - for any error

getCollectionInstance

protected Object getCollectionInstance(TypeInfo info,
                                       ClassLoader cl,
                                       Class expected)
                                throws Throwable
Create the collection instance

Parameters:
info - the request type
cl - the classloader
expected - the expected class
Returns:
the class instance
Throws:
Throwable - for any error

getElementClassInfo

protected ClassInfo getElementClassInfo(ClassLoader cl)
                                 throws Throwable
Get the class info for the element type

Parameters:
cl - the classloader
Returns:
the class info
Throws:
Throwable - for any error


Copyright © 2004 JBoss Inc. All Rights Reserved.