org.exolab.castor.xml
Class MarshalFramework

java.lang.Object
  extended by org.exolab.castor.xml.MarshalFramework
Direct Known Subclasses:
Marshaller, UnmarshalHandler

abstract class MarshalFramework
extends java.lang.Object

A core class for common code shared throughout the Marshalling Framework

Version:
$Revision: 1.12 $ $Date: 2005/03/01 00:47:50 $
Author:
Keith Visco

Nested Class Summary
static class MarshalFramework.InheritanceMatch
          Used to store the information when we find a possible inheritance.
(package private)  class MarshalFramework.InternalXMLClassDescriptor
          An internal implementation of XMLClassDescriptor used by the Unmarshaller and Marshaller...
 
Field Summary
(package private) static java.lang.String INTERNAL_XML_NAME
           
(package private) static java.lang.String JAVA_PREFIX
          The default prefix used for specifying the xsi:type as a classname instead of a schema name.
static java.lang.String LANG_ATTR
          The xml:lang attribute, without the "xml:" prefix.
static java.lang.String NIL_ATTR
          The xsi:nil attribute, without the "xsi:" prefix.
(package private) static XMLFieldDescriptor[] NO_FIELD_DESCRIPTORS
          An empty array of field descriptors
(package private) static java.lang.String QNAME_NAME
          The name of the QName type
static java.lang.String SPACE_ATTR
          The xml:space attribute name, without the "xml:" prefix
static java.lang.String TRUE_VALUE
          The value of 'true'
static java.lang.String TYPE_ATTR
          The xsi:type attribute name, without the "xsi:" prefix
static java.lang.String XML_LANG_ATTR
          The xml:lang attribute name
static java.lang.String XML_SPACE_ATTR
          The xml:space attribute name
static java.lang.String XSI_NAMESPACE
          The XSI Namespace URI
static java.lang.String XSI_NIL_ATTR
           
static java.lang.String XSI_NO_NAMESPACE_SCHEMA_LOCATION
          The name of the no namespace schema location attribute
static java.lang.String XSI_SCHEMA_LOCATION
          The name of the Schema location attribute
 
Constructor Summary
MarshalFramework()
           
 
Method Summary
 CollectionHandler getCollectionHandler(java.lang.Class clazz)
          Returns the CollectionHandler associated with the given collection, or null if no such handler exists.
(package private) static boolean hasFieldsAtLocation(java.lang.String location, XMLClassDescriptor classDesc)
          Returns true if any of the fields associated with the given XMLClassDescriptor are located at, or beneath, the given location.
static boolean isCollection(java.lang.Class clazz)
          Returns true if the given Class is a considered a collection by the marshalling framework.
(package private) static boolean isPrimitive(java.lang.Class type)
          Returns true if the given class should be treated as a primitive type.
static boolean namespaceEquals(java.lang.String ns1, java.lang.String ns2)
          Compares the given namespaces (as strings) for equality.
(package private) static boolean primitiveOrWrapperEquals(java.lang.Class a, java.lang.Class b)
          Returns true if the given classes are both the same primitive or primitive wrapper class.
static MarshalFramework.InheritanceMatch[] searchInheritance(java.lang.String name, java.lang.String namespace, XMLClassDescriptor classDesc, ClassDescriptorResolver cdResolver)
          Search there is a field descriptor which can accept one of the class descriptor which match the given name and namespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XSI_NAMESPACE

public static final java.lang.String XSI_NAMESPACE
The XSI Namespace URI

See Also:
Constant Field Values

XSI_SCHEMA_LOCATION

public static final java.lang.String XSI_SCHEMA_LOCATION
The name of the Schema location attribute

See Also:
Constant Field Values

XSI_NO_NAMESPACE_SCHEMA_LOCATION

public static final java.lang.String XSI_NO_NAMESPACE_SCHEMA_LOCATION
The name of the no namespace schema location attribute

See Also:
Constant Field Values

XML_LANG_ATTR

public static final java.lang.String XML_LANG_ATTR
The xml:lang attribute name

See Also:
Constant Field Values

LANG_ATTR

public static final java.lang.String LANG_ATTR
The xml:lang attribute, without the "xml:" prefix.

See Also:
Constant Field Values

NIL_ATTR

public static final java.lang.String NIL_ATTR
The xsi:nil attribute, without the "xsi:" prefix.

See Also:
Constant Field Values

XSI_NIL_ATTR

public static final java.lang.String XSI_NIL_ATTR
See Also:
Constant Field Values

XML_SPACE_ATTR

public static final java.lang.String XML_SPACE_ATTR
The xml:space attribute name

See Also:
Constant Field Values

SPACE_ATTR

public static final java.lang.String SPACE_ATTR
The xml:space attribute name, without the "xml:" prefix

See Also:
Constant Field Values

TYPE_ATTR

public static final java.lang.String TYPE_ATTR
The xsi:type attribute name, without the "xsi:" prefix

See Also:
Constant Field Values

TRUE_VALUE

public static final java.lang.String TRUE_VALUE
The value of 'true'

See Also:
Constant Field Values

INTERNAL_XML_NAME

static final java.lang.String INTERNAL_XML_NAME
See Also:
Constant Field Values

JAVA_PREFIX

static final java.lang.String JAVA_PREFIX
The default prefix used for specifying the xsi:type as a classname instead of a schema name. This is a Castor specific hack.

See Also:
Constant Field Values

QNAME_NAME

static final java.lang.String QNAME_NAME
The name of the QName type

See Also:
Constant Field Values

NO_FIELD_DESCRIPTORS

static final XMLFieldDescriptor[] NO_FIELD_DESCRIPTORS
An empty array of field descriptors

Constructor Detail

MarshalFramework

MarshalFramework()
Method Detail

isCollection

public static boolean isCollection(java.lang.Class clazz)
Returns true if the given Class is a considered a collection by the marshalling framework.

Returns:
true if the given Class is considered a collection.

getCollectionHandler

public CollectionHandler getCollectionHandler(java.lang.Class clazz)
Returns the CollectionHandler associated with the given collection, or null if no such handler exists.

Returns:
the CollectionHandler for the associated type.

isPrimitive

static boolean isPrimitive(java.lang.Class type)
Returns true if the given class should be treated as a primitive type. This method will return true for all Java primitive types, the set of primitive object wrappers, as well as Strings.

Returns:
true if the given class should be treated as a primitive type

hasFieldsAtLocation

static final boolean hasFieldsAtLocation(java.lang.String location,
                                         XMLClassDescriptor classDesc)
Returns true if any of the fields associated with the given XMLClassDescriptor are located at, or beneath, the given location.

Parameters:
location - the location to compare against
classDesc - the XMLClassDescriptor in which to check the field locations

namespaceEquals

public static boolean namespaceEquals(java.lang.String ns1,
                                      java.lang.String ns2)
Compares the given namespaces (as strings) for equality. null and empty values are considered equal.

Parameters:
ns1 - the namespace to compare to argument ns2
ns2 - the namespace to compare to argument ns1

primitiveOrWrapperEquals

static boolean primitiveOrWrapperEquals(java.lang.Class a,
                                        java.lang.Class b)
Returns true if the given classes are both the same primitive or primitive wrapper class. For exmaple, if class "a" is an int (Integer.TYPE) and class "b" is either an int or Integer.class then true will be returned, otherwise false.

Returns:
true if both a and b are considered equal

searchInheritance

public static MarshalFramework.InheritanceMatch[] searchInheritance(java.lang.String name,
                                                                    java.lang.String namespace,
                                                                    XMLClassDescriptor classDesc,
                                                                    ClassDescriptorResolver cdResolver)
                                                             throws MarshalException
Search there is a field descriptor which can accept one of the class descriptor which match the given name and namespace.

Throws:
MarshalException


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com