dsto.dfc.databeans
Class TypeRegistry

java.lang.Object
  extended by dsto.dfc.databeans.TypeRegistry

public final class TypeRegistry
extends Object

The global registry of known data object types. Every type has a unique logical name, which does NOT necessarily correspond to its Java class name (eg "person", "key"). This class maintains a mapping from logical type names to TypeInfo objects that describe them.

This class also provides a mapping from Java class names to type names, allowing type info to be easily attached to POJO-based data objects (eg those derived from SimpleDataObject or JavaDataBean).

Author:
Matthew Phillips
See Also:
TypeInfo

Method Summary
static TypeInfo getPropertyInfo(String type, String property)
           
static TypeInfo getTypeInfo(String type)
          Peek at the type info (if any) for a given type.
static TypeInfo peekTypeInfo(Class classType)
          Shortcut to peek for type info associated with a class.
static TypeInfo peekTypeInfo(String typeName)
          Peek at the type info (if any) for a given type.
static TypeInfo register(String type, Class valueClass)
          Shortcut to register type info against a Java class.
static void register(String name, TypeInfo info)
          Register type info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

register

public static TypeInfo register(String type,
                                Class valueClass)
Shortcut to register type info against a Java class.

Parameters:
type - The type name.
valueClass - The value class.
Returns:
The type info object created.
See Also:
register(String,TypeInfo), peekTypeInfo(Class)

register

public static void register(String name,
                            TypeInfo info)
                     throws IllegalArgumentException
Register type info.

Parameters:
info - The new info.
Throws:
IllegalArgumentException - if an attempt is made to register a different set of info for an existing type.
See Also:
peekTypeInfo(String)

peekTypeInfo

public static TypeInfo peekTypeInfo(String typeName)
Peek at the type info (if any) for a given type.

Parameters:
typeName - The name of the type.
Returns:
The type info or null if not defined.
See Also:
getTypeInfo(String)

getTypeInfo

public static TypeInfo getTypeInfo(String type)
                            throws IllegalArgumentException
Peek at the type info (if any) for a given type.

Parameters:
type - The name of the type.
Returns:
The type info.
Throws:
IllegalArgumentException - if type is not defined.
See Also:
peekTypeInfo(String)

peekTypeInfo

public static TypeInfo peekTypeInfo(Class classType)
Shortcut to peek for type info associated with a class.


getPropertyInfo

public static TypeInfo getPropertyInfo(String type,
                                       String property)


Copyright © 2008 Commonwealth of Australia