org.exolab.castor.xml
Class MarshalFramework
java.lang.Object
org.exolab.castor.xml.MarshalFramework
(package private) abstract class MarshalFramework
extends java.lang.Object
A core class for common code shared throughout the
Marshalling Framework
$Revision: 7297 $ $Date: 2005-12-13 14:58:48 -0700 (Tue, 13 Dec 2005) $
(package private) static String | INTERNAL_XML_NAME - A constant to indicate a wrong name without setting null.
|
(package private) static String | JAVA_PREFIX - The default prefix used for specifying the
xsi:type as a classname instead of a schema name.
|
static String | LANG_ATTR - The xml:lang attribute, without the "xml:" prefix.
|
static 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 String | QNAME_NAME - The name of the QName type.
|
static String | SPACE_ATTR - The xml:space attribute name, without the "xml:" prefix.
|
static String | TRUE_VALUE - The value of 'true'.
|
static String | TYPE_ATTR - The xsi:type attribute name, without the "xsi:" prefix.
|
static String | XML_LANG_ATTR - The xml:lang attribute name.
|
static String | XML_SPACE_ATTR - The xml:space attribute name.
|
static String | XSI_NAMESPACE - The XSI Namespace URI.
|
static String | XSI_NIL_ATTR - The xsi:nil attribute.
|
static String | XSI_NO_NAMESPACE_SCHEMA_LOCATION - The name of the no namespace schema location attribute.
|
static String | XSI_SCHEMA_LOCATION - The name of the Schema location attribute.
|
INTERNAL_XML_NAME
(package private) static final String INTERNAL_XML_NAME
A constant to indicate a wrong name without setting null.
JAVA_PREFIX
(package private) 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.
LANG_ATTR
public static final String LANG_ATTR
The xml:lang attribute, without the "xml:" prefix.
NIL_ATTR
public static final String NIL_ATTR
The xsi:nil attribute, without the "xsi:" prefix.
NO_FIELD_DESCRIPTORS
(package private) static final XMLFieldDescriptor[] NO_FIELD_DESCRIPTORS
An empty array of field descriptors.
QNAME_NAME
(package private) static final String QNAME_NAME
The name of the QName type.
SPACE_ATTR
public static final String SPACE_ATTR
The xml:space attribute name, without the "xml:" prefix.
TRUE_VALUE
public static final String TRUE_VALUE
The value of 'true'.
TYPE_ATTR
public static final String TYPE_ATTR
The xsi:type attribute name, without the "xsi:" prefix.
XML_LANG_ATTR
public static final String XML_LANG_ATTR
The xml:lang attribute name.
XML_SPACE_ATTR
public static final String XML_SPACE_ATTR
The xml:space attribute name.
XSI_NAMESPACE
public static final String XSI_NAMESPACE
The XSI Namespace URI.
XSI_NIL_ATTR
public static final String XSI_NIL_ATTR
The xsi:nil attribute.
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.
MarshalFramework
public MarshalFramework()
We need some stuff initialized here.
getCollectionHandler
public CollectionHandler getCollectionHandler(Class clazz)
Returns the CollectionHandler associated with the
given collection, or null if no such handler exists.
clazz
- the Class to check
- the CollectionHandler for the associated type.
getJavaNaming
public JavaNaming getJavaNaming()
- the JavaNaming to be used
hasFieldsAtLocation
(package private) 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.
location
- the location to compare againstclassDesc
- the XMLClassDescriptor in which to check the field
locations
- true if any of the fields has a location associated
isCollection
public static boolean isCollection(Class clazz)
Returns true if the given Class is a considered a
collection by the marshalling framework.
clazz
- the Class to check
- true if the given Class is considered a collection.
TODO: joachim: this code exists somewhere else too!!
isEnum
(package private) static boolean isEnum(Class type)
Returns true if the given class should be treated as an enum type. This method
will return true for all Java 5 (or later) enums, and for enum-style
classes.
type
- the Class to check
- true if the given class should be treated as an enum
isPrimitive
(package private) 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.
type
- the Class to check
- true if the given class should be treated as a primitive type
TODO: joachim: this code exists somewhere else too!!
namespaceEquals
public static boolean namespaceEquals(String ns1,
String ns2)
Compares the given namespaces (as strings) for equality.
null and empty values are considered equal.
ns1
- the namespace to compare to argument ns2ns2
- the namespace to compare to argument ns1
- true if the namespaces are considert equal
TODO: joachim put it into XMLNaming!
primitiveOrWrapperEquals
(package private) 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.
a
- compare a with bb
- compare a with b
- true if both a and b are considered equal
searchInheritance
protected MarshalFramework.InheritanceMatch[] searchInheritance(String name,
String namespace,
XMLClassDescriptor classDesc)
throws MarshalException
Search there is a field descriptor which can accept one of the class
descriptor which match the given name and namespace.
name
- XML name of the fieldnamespace
- namespace of the fieldclassDesc
- the class descriptor to match against
- An array of InheritanceMatch.
setInternalContext
public void setInternalContext(InternalContext internalContext)
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com