org.favabeans.base
Interface TypeMetadataRegistry

All Superinterfaces:
InheritanceProperties
All Known Implementing Classes:
DefaultTypeMetadataRegistry

public interface TypeMetadataRegistry
extends InheritanceProperties

A TypeMetadataRegistry is an object that maps Types to associated metadata using a String key. It is a specialization of InheritanceProperties with the following differences:

1. Classes of arguments. A TypeMetadataRegistry only accepts contexts of class Type and keys of class String, and will throw a java.lang.ClassCastException if these requirements are not met.

2. TypeAttribute evaluation. When a TypeAttribute object is added as a value mapped to a key, the results of its TypeAttribute.evaluate(TypeMetadataRegistry,Type,String,Object) method is returned as the result of the getForObject(Object,String) method.

See Also:
TypeAttribute

Method Summary
 void addTypeInfoListener(TypeInfoListener til)
           
 Object getForObject(Object o, String key)
          Obtain the value mapped via a given key to the best matching Type (or one of its super-Types) for a given object.
 Set getKeysForObject(Object o)
          Obtain all the keys for which values are mapped to all the Types (or their super-Types) which match a given object.
 Set getKeysForObject(Object o, String prefix)
          Obtain all the keys, starting with a given prefix string, for which values are mapped to all the Types (or their super-Types) which match a given object.
 void removeTypeInfoListener(TypeInfoListener til)
           
 
Methods inherited from interface org.favabeans.util.InheritanceProperties
clear, comparator, containsKey, containsKey, contextPoset, get, get, getKeys, getKeys, put, remove
 

Method Detail

getForObject

public Object getForObject(Object o,
                           String key)
Obtain the value mapped via a given key to the best matching Type (or one of its super-Types) for a given object. If the mapped value is a TypeAttribute, its TypeAttribute.evaluate(TypeMetadataRegistry,Type,String,Object) method is called, and the result returned.
Parameters:
o - the object for which to obtain the value.
key - the key for which to obtain the value.
Returns:
the relevant value, or null if none was found or TypeAttribute.evaluate(TypeMetadataRegistry,Type,String,Object) returned null.

getKeysForObject

public Set getKeysForObject(Object o)
Obtain all the keys for which values are mapped to all the Types (or their super-Types) which match a given object.
Parameters:
o - the object for which to obtain the keys.
Returns:
a Set containing the keys, or an empty Set if none were found.

getKeysForObject

public Set getKeysForObject(Object o,
                            String prefix)
Obtain all the keys, starting with a given prefix string, for which values are mapped to all the Types (or their super-Types) which match a given object.
Parameters:
o - the object for which to obtain the keys.
prefix - a string with which all returned keys must start.
Returns:
a Set containing the keys, or an empty Set if none were found.
See Also:
String.startsWith(java.lang.String)

addTypeInfoListener

public void addTypeInfoListener(TypeInfoListener til)

removeTypeInfoListener

public void removeTypeInfoListener(TypeInfoListener til)


Copyright © 2000-2001, Regents of the University of Minnesota. All Rights Reserved.