org.jboss.aop.metadata
Class SimpleMetaData

java.lang.Object
  extended by org.jboss.aop.metadata.SimpleMetaData
All Implemented Interfaces:
Externalizable, Serializable, MetaDataResolver

public class SimpleMetaData
extends Object
implements MetaDataResolver, Externalizable

Contains all the metadata associated with an Invocation instance.

Version:
$Revision: 70500 $
Author:
Bill Burke
See Also:
Serialized Form

Nested Class Summary
 class SimpleMetaData.MetaDataValue
          Contains the value of a metadata attribute.
 
Field Summary
protected  HashMap<Object,HashMap<Object,SimpleMetaData.MetaDataValue>> metaData
          Contains all the metadata entries.
 
Fields inherited from interface org.jboss.aop.metadata.MetaDataResolver
EMPTY_TAG
 
Constructor Summary
SimpleMetaData()
           
 
Method Summary
 void addMetaData(Object tag, Object attr, Object value)
          Adds a metadata attribute/value pair to this instance.
 void addMetaData(Object tag, Object attr, Object value, PayloadKey type)
          Adds a metadata attribute/value pair to this instance.
 void clear()
          Erases all the metadata contained in this instance.
 SimpleMetaData getAllMetaData(Invocation invocation)
          Gets all metadata that belongs with the context of invocation
 Object getMetaData(Object tag, Object attr)
          Returns the value of a metadata attribute.
 boolean hasTag(String name)
          Indicates whether this instance contains metadata tagged with name.
 void mergeIn(SimpleMetaData data)
          Merges incoming data.
 void readExternal(ObjectInput in)
          
 void removeGroupData(Object group)
          Removes all attributes identified by the tag group.
 void removeMetaData(Object tag, Object attr)
          Removes the metadata attribute from this instance.
 Object resolve(Invocation invocation, Object tag, Object attr)
           
 int size()
          Returns the number of items contained in this simple metadata instance.
 void tag(Object tag)
          Tags metadata to structure.
 HashMap<Object,SimpleMetaData.MetaDataValue> tag(String name)
          Returns the metadata tagged with name.
 HashSet<Object> tags()
          Returns the tags that identify the metadata elements contained in this instance.
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

metaData

protected HashMap<Object,HashMap<Object,SimpleMetaData.MetaDataValue>> metaData
Contains all the metadata entries.

Constructor Detail

SimpleMetaData

public SimpleMetaData()
Method Detail

size

public int size()
Returns the number of items contained in this simple metadata instance.

Returns:
the number of items contained in this simple metadata instance.

tags

public HashSet<Object> tags()
Returns the tags that identify the metadata elements contained in this instance.

Returns:
a set containing all tags of the metadata elements contained in this instance.

tag

public HashMap<Object,SimpleMetaData.MetaDataValue> tag(String name)
Returns the metadata tagged with name.

Parameters:
name - tag of the queried metadata
Returns:
a map containing all the metadata tagged with name

hasTag

public boolean hasTag(String name)
Indicates whether this instance contains metadata tagged with name.

Parameters:
name - tag of the queried metadata
Returns:
true only if there is metadata tagged with name in this simple metadata instance

tag

public void tag(Object tag)
Tags metadata to structure. Use for tags with no attributes (i.e. @Singleton, etc...)

Parameters:
tag - the tag that represents the no-atribute metadata to be added

addMetaData

public void addMetaData(Object tag,
                        Object attr,
                        Object value)
Adds a metadata attribute/value pair to this instance.

Parameters:
tag - identifies the metadata attribute to be added
attr - the name of an attribute
value - the value of attr attribute

addMetaData

public void addMetaData(Object tag,
                        Object attr,
                        Object value,
                        PayloadKey type)
Adds a metadata attribute/value pair to this instance.

Parameters:
tag - identifies the metadata attribute to be added
attr - the name of an attribute
value - the value of attr attribute
type - the payload type

getMetaData

public Object getMetaData(Object tag,
                          Object attr)
Returns the value of a metadata attribute.

Parameters:
tag - identifies the metadata attribute to be retrieved
attr - the name of an attribute
Returns:
the value of attr attribute

removeMetaData

public void removeMetaData(Object tag,
                           Object attr)
Removes the metadata attribute from this instance.

Parameters:
tag - identifies the metadata attribute to be removed
attr - name of the attribute to be removed

removeGroupData

public void removeGroupData(Object group)
Removes all attributes identified by the tag group.

Parameters:
group - identifies the attributes to be removed

clear

public void clear()
Erases all the metadata contained in this instance.


mergeIn

public void mergeIn(SimpleMetaData data)
Merges incoming data. If there is a crash in tags and attributes names, incoming data will override the existing data.

Parameters:
data - incoming that that should be merged to this instance.

resolve

public Object resolve(Invocation invocation,
                      Object tag,
                      Object attr)
Specified by:
resolve in interface MetaDataResolver

getAllMetaData

public SimpleMetaData getAllMetaData(Invocation invocation)
Description copied from interface: MetaDataResolver
Gets all metadata that belongs with the context of invocation

Specified by:
getAllMetaData in interface MetaDataResolver
Returns:
the metadata contained in the context of invocation

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException

Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

toString

public String toString()
Overrides:
toString in class Object


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