JBoss Managed Parent POM 2.1.1.SP2

org.jboss.metatype.plugins.types
Class AbstractCompositeMetaType

java.lang.Object
  extended by org.jboss.metatype.api.types.AbstractMetaType
      extended by org.jboss.metatype.plugins.types.AbstractCompositeMetaType
All Implemented Interfaces:
Serializable, CompositeMetaType, MetaType
Direct Known Subclasses:
ImmutableCompositeMetaType, MapCompositeMetaType, MutableCompositeMetaType

public abstract class AbstractCompositeMetaType
extends AbstractMetaType
implements CompositeMetaType

ImmutableCompositeMetaType.

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jboss.metatype.api.types.MetaType
ALLOWED_CLASSNAMES
 
Constructor Summary
protected AbstractCompositeMetaType(String typeName, String description)
          Construct a composite meta type with no items.
protected AbstractCompositeMetaType(String typeName, String description, String[] itemNames, String[] itemDescriptions, MetaType[] itemTypes, boolean ignoreItems)
          Construct a composite meta type.
 
Method Summary
protected  void addItem(String itemName, String itemDescription, MetaType itemType)
          Add an item
 boolean containsItem(String itemName)
          Determine whether this CompositeMetaType contains the itemName
protected  boolean equalsImpl(Object obj)
          Implementation of equals
 String getDescription(String itemName)
          Retrieve the description for an item name
 MetaType getType(String itemName)
          Retrieve the meta type for an item name
protected  int hashCodeImpl()
          Hashcode implementation
 boolean isComposite()
          Retrieve whether the class name of the type is composite
 boolean isValue(Object obj)
          Whether the passed value is one of those described by this meta type.
 Set<String> itemSet()
          Retrieve an unmodifiable Set view of all the item names in ascending order.
 Set<String> keySet()
          Retrieve an unmodifiable Set view of all the key names in ascending order.
protected  void setKeys(Set<String> keySet)
          Set the keys
 String toString()
           
 
Methods inherited from class org.jboss.metatype.api.types.AbstractMetaType
getClassName, getDescription, getTypeName, isArray, isCollection, isEnum, isGeneric, isPrimitive, isProperties, isSimple, isTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.metatype.api.types.MetaType
getClassName, getDescription, getTypeName, isArray, isCollection, isEnum, isGeneric, isPrimitive, isProperties, isSimple, isTable
 

Constructor Detail

AbstractCompositeMetaType

protected AbstractCompositeMetaType(String typeName,
                                    String description,
                                    String[] itemNames,
                                    String[] itemDescriptions,
                                    MetaType[] itemTypes,
                                    boolean ignoreItems)
Construct a composite meta type. The parameters are checked for validity.

The three arrays are internally copied. Future changes to these arrays do not alter the composite type.

getClassName() returns CompositeValue

Parameters:
typeName - the name of the composite type, cannot be null or empty
description - the human readable description of the composite type, cannot be null or empty
itemNames - the names of the items described by this type. Cannot be null, must contain at least one element, the elements cannot be null or empty. The order of the items is unimportant when determining equality.
itemDescriptions - the human readable descriptions of the items in the same order as the itemNames, cannot be null must have the same number of elements as the itemNames. The elements cannot be null or empty.
itemTypes - the MetaTypes of the items in the same order as the item names, cannot be null must have the same number of elements as the itemNames. The elements cannot be null.
ignoreItems - whether to ignore items
Throws:
IllegalArgumentException - when a parameter does not match what is described above or when itemNames contains a duplicate name. The names are case sensitive, leading and trailing whitespace is ignored.

AbstractCompositeMetaType

protected AbstractCompositeMetaType(String typeName,
                                    String description)
Construct a composite meta type with no items.

Parameters:
typeName - the name of the composite type, cannot be null or empty
description - the human readable description of the composite type, cannot be null or empty
Throws:
IllegalArgumentException - when a parameter does not match what is described above.
Method Detail

setKeys

protected void setKeys(Set<String> keySet)
Set the keys

Parameters:
keySet - the key set

addItem

protected void addItem(String itemName,
                       String itemDescription,
                       MetaType itemType)
Add an item

Parameters:
itemName - the item name
itemDescription - the item description
itemType - the item type
Throws:
IllegalArgumentException - for a null or empty item name, description or type or duplicate item

containsItem

public boolean containsItem(String itemName)
Description copied from interface: CompositeMetaType
Determine whether this CompositeMetaType contains the itemName

Specified by:
containsItem in interface CompositeMetaType
Parameters:
itemName - the item name
Returns:
true when it does, false otherwise

getDescription

public String getDescription(String itemName)
Description copied from interface: CompositeMetaType
Retrieve the description for an item name

Specified by:
getDescription in interface CompositeMetaType
Parameters:
itemName - the item name
Returns:
the description or null when there is no such item name

isComposite

public boolean isComposite()
Description copied from interface: MetaType
Retrieve whether the class name of the type is composite

Specified by:
isComposite in interface MetaType
Overrides:
isComposite in class AbstractMetaType
Returns:
true when it is composite or false otherwise

getType

public MetaType getType(String itemName)
Description copied from interface: CompositeMetaType
Retrieve the meta type for an item name

Specified by:
getType in interface CompositeMetaType
Parameters:
itemName - the item name
Returns:
the open type or null when there is no such item name

itemSet

public Set<String> itemSet()
Description copied from interface: CompositeMetaType
Retrieve an unmodifiable Set view of all the item names in ascending order.

Specified by:
itemSet in interface CompositeMetaType
Returns:
the Set

keySet

public Set<String> keySet()
Description copied from interface: CompositeMetaType
Retrieve an unmodifiable Set view of all the key names in ascending order.

Specified by:
keySet in interface CompositeMetaType
Returns:
the Set

isValue

public boolean isValue(Object obj)
Description copied from interface: MetaType
Whether the passed value is one of those described by this meta type.

Specified by:
isValue in interface MetaType
Specified by:
isValue in class AbstractMetaType
Parameters:
obj - the object to test
Returns:
true when it is value for this meta type, false otherwise

equalsImpl

protected boolean equalsImpl(Object obj)
Implementation of equals

Parameters:
obj - the object to check
Returns:
true when equals false otherwise

hashCodeImpl

protected int hashCodeImpl()
Hashcode implementation

Returns:
the hash code

toString

public String toString()
Overrides:
toString in class Object

JBoss Managed Parent POM 2.1.1.SP2

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.