Package org.jibx.custom.classes
Class CustomBase
- java.lang.Object
-
- org.jibx.custom.classes.CustomBase
-
- Direct Known Subclasses:
FaultCustom,SharedNestingBase,SharedValueBase,ThrowsCustom
public class CustomBase extends java.lang.ObjectBase class for all customizations. This defines a way to navigate up the tree of nested components without making assumptions about the specific type of the containing components. This allows for other types of customizations, beyond the binding customizations included directly in this package. This also includes enumeration definitions which are used with both base and extension customizations.- Author:
- Dennis M. Sosnoski
-
-
Field Summary
Fields Modifier and Type Field Description static intCAMEL_CASE_NAMESstatic intDERIVE_BY_PACKAGEstatic intDERIVE_FIXEDstatic intDERIVE_NONEstatic intDOTTED_NAMESstatic intHYPHENATED_NAMESprivate SharedNestingBasem_parentstatic intREQUIRE_ALLstatic intREQUIRE_NONEstatic intREQUIRE_OBJECTSstatic intREQUIRE_PRIMITIVESstatic EnumSets_namespaceStyleEnumstatic EnumSets_nameStyleEnumstatic EnumSets_requireEnumstatic intUNDERSCORED_NAMESstatic intUPPER_CAMEL_CASE_NAMES
-
Constructor Summary
Constructors Constructor Description CustomBase(SharedNestingBase parent)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringconvertName(java.lang.String base, int code)Convert class, method, or parameter name to XML name.static java.lang.StringderiveItemName(java.lang.String cname, java.lang.String type, int code)Derive name for item in a collection.static java.lang.StringderiveNamespace(java.lang.String uri, java.lang.String pkgpth, int style)Derive namespace using specified technique.protected static java.lang.ObjectgetContainingObject(IUnmarshallingContext ictx)Gets the parent element link from the unmarshalling stack.GlobalCustomgetGlobal()Get global customizations root.SharedNestingBasegetParent()Get container.static java.lang.StringpackageOfType(java.lang.String type)Get the package from a fully-qualified type name.static java.lang.StringpackageToNamespace(java.lang.String pkgpth)Create a namespace URL from a package path.protected voidvalidateAttributes(IUnmarshallingContext ictx, StringArray attrs)Validate attributes of element.
-
-
-
Field Detail
-
CAMEL_CASE_NAMES
public static final int CAMEL_CASE_NAMES
- See Also:
- Constant Field Values
-
UPPER_CAMEL_CASE_NAMES
public static final int UPPER_CAMEL_CASE_NAMES
- See Also:
- Constant Field Values
-
HYPHENATED_NAMES
public static final int HYPHENATED_NAMES
- See Also:
- Constant Field Values
-
DOTTED_NAMES
public static final int DOTTED_NAMES
- See Also:
- Constant Field Values
-
UNDERSCORED_NAMES
public static final int UNDERSCORED_NAMES
- See Also:
- Constant Field Values
-
s_nameStyleEnum
public static final EnumSet s_nameStyleEnum
-
REQUIRE_NONE
public static final int REQUIRE_NONE
- See Also:
- Constant Field Values
-
REQUIRE_PRIMITIVES
public static final int REQUIRE_PRIMITIVES
- See Also:
- Constant Field Values
-
REQUIRE_OBJECTS
public static final int REQUIRE_OBJECTS
- See Also:
- Constant Field Values
-
REQUIRE_ALL
public static final int REQUIRE_ALL
- See Also:
- Constant Field Values
-
s_requireEnum
public static final EnumSet s_requireEnum
-
DERIVE_NONE
public static final int DERIVE_NONE
- See Also:
- Constant Field Values
-
DERIVE_BY_PACKAGE
public static final int DERIVE_BY_PACKAGE
- See Also:
- Constant Field Values
-
DERIVE_FIXED
public static final int DERIVE_FIXED
- See Also:
- Constant Field Values
-
s_namespaceStyleEnum
public static final EnumSet s_namespaceStyleEnum
-
m_parent
private SharedNestingBase m_parent
-
-
Constructor Detail
-
CustomBase
public CustomBase(SharedNestingBase parent)
Constructor.- Parameters:
parent-
-
-
Method Detail
-
getParent
public SharedNestingBase getParent()
Get container.- Returns:
- container
-
getGlobal
public GlobalCustom getGlobal()
Get global customizations root.- Returns:
- global customization
-
convertName
public static java.lang.String convertName(java.lang.String base, int code)Convert class, method, or parameter name to XML name.- Parameters:
base- class or simple field name to be convertedcode- conversion format style code- Returns:
- XML name
-
deriveItemName
public static java.lang.String deriveItemName(java.lang.String cname, java.lang.String type, int code)Derive name for item in a collection. If the supplied collection name ends in a recognized plural form the derived item name is the singular version of the collection name. Otherwise, it is the converted name of the collection item class, or just "item" if the class is unknown. TODO: internationalization?- Parameters:
cname- collection name (nullif none)type- item type (nullif unknown)code- conversion format style code- Returns:
- item name
-
packageOfType
public static java.lang.String packageOfType(java.lang.String type)
Get the package from a fully-qualified type name.- Parameters:
type- fully-qualified type name- Returns:
- package of the type (empty string if in default package)
-
packageToNamespace
public static java.lang.String packageToNamespace(java.lang.String pkgpth)
Create a namespace URL from a package path.- Parameters:
pkgpth- fully-qualified package name- Returns:
- namespace based on package (
nullif none)
-
deriveNamespace
public static java.lang.String deriveNamespace(java.lang.String uri, java.lang.String pkgpth, int style)Derive namespace using specified technique.- Parameters:
uri- base namespace URI (nullif none)pkgpth- fully qualified package namestyle- namespace style code- Returns:
- derived namespace
-
validateAttributes
protected void validateAttributes(IUnmarshallingContext ictx, StringArray attrs)
Validate attributes of element. This is designed to be called during unmarshalling as part of the pre-set method processing when a subclass instance is being created.- Parameters:
ictx- unmarshalling contextattrs- attributes array
-
getContainingObject
protected static java.lang.Object getContainingObject(IUnmarshallingContext ictx)
Gets the parent element link from the unmarshalling stack. This method is for use by factories during unmarshalling.- Parameters:
ictx- unmarshalling context- Returns:
- containing class
-
-