Save This Page
Home » Castor-1.3-src » org.exolab.castor » xml » [javadoc | source]
org.exolab.castor.xml
public final class: Introspector [javadoc | source]
java.lang.Object
   org.exolab.castor.xml.Introspector
A Helper class for the Marshaller and Unmarshaller, basically the common code base between the two. This class handles the introspection to dynamically create descriptors.
Nested Class Summary:
class  Introspector.IdentityConvertor  A special TypeConvertor that simply returns the object given. This is used for preventing the FieldHandlerImpl from using a CollectionHandler when getValue is called. 
class  Introspector.MethodSet  A simple struct for holding a set of accessor methods * 
Constructor:
 public Introspector() 
 public Introspector(ClassLoader classLoader) 
    Creates a new instance of the Introspector.
    Parameters:
    classLoader -
Method from org.exolab.castor.xml.Introspector Summary:
addFieldHandlerFactory,   generateClassDescriptor,   generateClassDescriptor,   getPrimitiveNodeType,   introspected,   isCollection,   isMapCollection,   marshallable,   removeFieldHandlerFactory,   setInternalContext,   setNaming,   setPrimitiveNodeType,   setSaveMapKeys,   setWrapCollections,   toJavaName
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.exolab.castor.xml.Introspector Detail:
 public synchronized  void addFieldHandlerFactory(FieldHandlerFactory factory) 
    Registers the given "generalized" FieldHandlerFactory with this Introspector.
 public XMLClassDescriptor generateClassDescriptor(Class c) throws MarshalException 
    Creates an XMLClassDescriptor for the given class by using Reflection.
 public XMLClassDescriptor generateClassDescriptor(Class c,
    PrintWriter errorWriter) throws MarshalException 
    Creates an XMLClassDescriptor for the given class by using Reflection.
 public NodeType getPrimitiveNodeType() 
    Returns the NodeType for java primitives
 public static boolean introspected(XMLClassDescriptor descriptor) 
    Returns true if the given XMLClassDescriptor was created via introspection *
 public static boolean isCollection(Class clazz) 
    Returns true if the given Class is an instance of a collection class.
 public static boolean isMapCollection(Class clazz) 
    Returns true if the given Class is an instance of a collection class.
 public static boolean marshallable(Class type) 
    Returns true if the given Class can be marshalled.
 public synchronized boolean removeFieldHandlerFactory(FieldHandlerFactory factory) 
    Removes the given FieldHandlerFactory from this Introspector
 public  void setInternalContext(InternalContext internalContext) 
 public  void setNaming(XMLNaming naming) 
    Sets the Naming conventions to be used by the Introspector
 public  void setPrimitiveNodeType(NodeType nodeType) 
    Sets the NodeType for primitives. If the NodeType is NodeType.Element, all primitives will be treated as Elements, otherwise all primitives will be treated as Attributes.
 public  void setSaveMapKeys(boolean saveMapKeys) 
    Sets whether or not keys from Hastable / Map instances should be saved in the XML.

    Note: This is true by default since Castor 0.9.5.3

 public  void setWrapCollections(boolean wrapCollections) 
    Sets whether or not collections (arrays, vectors, etc) should be wrapped in a container element. For example:
    
       <foos>
          <foo>foo1</foo>
          <foo>foo2</foo>
       </foos>
    
      instead of the default:
    
       <foos>foo1<foos>
       <foos>foo2</foos>
    
    
 public static String toJavaName(String name,
    boolean upperFirst) 
    Converts the given xml name to a Java name.