org.exolab.castor.xml

Class MarshalFramework

abstract class MarshalFramework extends Object

A core class for common code shared throughout the Marshalling Framework

Version: $Revision: 1.4 $ $Date: 2003/04/24 02:10:27 $

Author: Keith Visco

Nested Class Summary
static classMarshalFramework.InheritanceMatch
Used to store the information when we find a possible inheritance.
classMarshalFramework.InternalXMLClassDescriptor
An internal implementation of XMLClassDescriptor used by the Unmarshaller and Marshaller...
Field Summary
static StringJAVA_PREFIX
The default prefix used for specifying the xsi:type as a classname instead of a schema name.
static StringQNAME_NAME
The name of the QName type
static StringXSI_NAMESPACE
The XSI Namespace URI
static StringXSI_NO_NAMESPACE_SCHEMA_LOCATION
The name of the no namespace schema location attribute
static StringXSI_SCHEMA_LOCATION
The name of the Schema location attribute
Method Summary
CollectionHandlergetCollectionHandler(Class clazz)
Returns the CollectionHandler associated with the given collection, or null if no such handler exists.
static booleanhasFieldsAtLocation(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 booleanisCollection(Class clazz)
Returns true if the given Class is a considered a collection by the marshalling framework.
static booleanisPrimitive(Class type)
Returns true if the given class should be treated as a primitive type.
static booleannamespaceEquals(String ns1, String ns2)
Compares the given namespaces (as strings) for equality. null and empty values are considered equal.
static booleanprimitiveOrWrapperEquals(Class a, Class b)
Returns true if the given classes are both the same primitive or primitive wrapper class.
static MarshalFramework.InheritanceMatch[]searchInheritance(String name, 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.

Field Detail

JAVA_PREFIX

static final 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.

QNAME_NAME

static final String QNAME_NAME
The name of the QName type

XSI_NAMESPACE

public static final String XSI_NAMESPACE
The XSI Namespace URI

XSI_NO_NAMESPACE_SCHEMA_LOCATION

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

XSI_SCHEMA_LOCATION

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

Method Detail

getCollectionHandler

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

Returns: the CollectionHandler for the associated type.

hasFieldsAtLocation

static final boolean hasFieldsAtLocation(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

isCollection

public static boolean isCollection(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.

isPrimitive

static boolean isPrimitive(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

namespaceEquals

public static boolean namespaceEquals(String ns1, 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(Class a, 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(String name, 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.

UNKNOWN: an array of InheritanceMatch.

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