org.jibx.custom.classes
Class ValueCustom

java.lang.Object
  extended by org.jibx.custom.classes.CustomBase
      extended by org.jibx.custom.classes.ValueCustom

public class ValueCustom
extends CustomBase

Member field or property customization information.

Author:
Dennis M. Sosnoski

Field Summary
private  java.lang.String m_actualType
           
private  java.lang.String m_baseName
           
private  boolean m_collection
           
private  java.lang.String m_createType
           
private  boolean m_elementForced
           
private  java.lang.String m_factoryMethod
           
private  java.lang.String m_fieldName
           
private  java.lang.String m_getName
           
private  java.lang.String m_itemName
           
private  java.lang.String m_itemType
           
private  boolean m_primitive
           
private  boolean m_private
           
private  java.lang.String m_propertyName
           
private  java.lang.Boolean m_required
           
private  java.lang.String m_setName
           
private  java.lang.String m_statedType
           
private  java.lang.Integer m_style
           
private  java.lang.String m_workingType
           
private  java.lang.String m_xmlName
           
static StringArray s_allowedAttributes
          Enumeration of allowed attribute names
 
Fields inherited from class org.jibx.custom.classes.CustomBase
CAMEL_CASE_NAMES, DERIVE_BY_PACKAGE, DERIVE_FIXED, DERIVE_NONE, DOTTED_NAMES, HYPHENATED_NAMES, REQUIRE_ALL, REQUIRE_NONE, REQUIRE_OBJECTS, REQUIRE_PRIMITIVES, s_namespaceStyleEnum, s_nameStyleEnum, s_requireEnum, UNDERSCORED_NAMES, UPPER_CAMEL_CASE_NAMES
 
Constructor Summary
protected ValueCustom(SharedNestingBase parent)
          Constructor.
protected ValueCustom(SharedNestingBase parent, java.lang.String name)
          Constructor with name known.
 
Method Summary
static java.lang.String convertMemberNameCase(java.lang.String name)
          Convert case of member name derived from method or field name.
private static ValueCustom factory(IUnmarshallingContext ictx)
          Factory method for creating instances during unmarshalling.
(package private)  void fillDetails(IClassItem field, IClassItem gmeth, IClassItem smeth, IClassLocator icl, java.lang.Boolean req, java.lang.Integer style)
          Complete customization information based on either field or access method information.
(package private)  void fillType(IClass info, java.lang.Boolean req, java.lang.Integer style)
          Complete customization information based on supplied type.
 java.lang.String getActualType()
          Get member actual type.
 java.lang.String getBaseName()
          Get member (field or property) name.
 ClassCustom getClassCustom()
          Convenience method to access the containing class customization element.
 java.lang.String getCreateType()
          Get member create type.
 java.lang.String getFactoryMethod()
          Get factory method.
 java.lang.String getFieldName()
          Get 'field' attribute value.
 java.lang.String getGetName()
          Get 'get-method' attribute name.
 java.lang.String getItemName()
          Get item element name.
 java.lang.String getItemType()
          Get item type.
 java.lang.String getPropertyName()
          Get 'property-name' attribute value.
 java.lang.String getSetName()
          Get 'set-method' attribute name.
 java.lang.String getStatedType()
          Get stated type of member.
 int getStyle()
          Get style code.
private  java.lang.String getStyleText()
          Style get text method.
 java.lang.String getWorkingType()
          Get working type of member.
 java.lang.String getXmlName()
          Get XML element or attribute name.
 boolean isCollection()
          Check if collection member.
 boolean isElementForced()
          Check if element representation forced.
 boolean isPrivate()
          Check if a private member.
 boolean isProperty()
          Check if member represents a property.
 boolean isRequired()
          Check if value is required.
static java.lang.String memberNameFromField(java.lang.String name, java.lang.String[] prefs, java.lang.String[] suffs)
          Get the member name for a field from the field name.
static java.lang.String memberNameFromGetMethod(java.lang.String name)
          Get the member name for a property from the read method name.
static java.lang.String memberNameFromSetMethod(java.lang.String name)
          Get the member name for a property from the write method name.
protected  void postSet()
          Post-set method that handles checking attribute combinations and sets the actual member name.
protected  void preSet(IUnmarshallingContext uctx)
          Make sure all attributes are defined.
private  void setAttribute(java.lang.String text, IUnmarshallingContext ictx)
          Set attribute name method.
protected  void setBaseName(java.lang.String name)
          Set member (field or property) name.
private  void setElement(java.lang.String text, IUnmarshallingContext ictx)
          Set element name method.
 
Methods inherited from class org.jibx.custom.classes.CustomBase
convertName, deriveItemName, deriveNamespace, getContainingObject, getGlobal, getParent, packageOfType, packageToNamespace, validateAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_allowedAttributes

public static final StringArray s_allowedAttributes
Enumeration of allowed attribute names


m_baseName

private java.lang.String m_baseName

m_statedType

private java.lang.String m_statedType

m_workingType

private java.lang.String m_workingType

m_primitive

private boolean m_primitive

m_collection

private boolean m_collection

m_elementForced

private boolean m_elementForced

m_style

private java.lang.Integer m_style

m_private

private boolean m_private

m_xmlName

private java.lang.String m_xmlName

m_actualType

private java.lang.String m_actualType

m_createType

private java.lang.String m_createType

m_factoryMethod

private java.lang.String m_factoryMethod

m_required

private java.lang.Boolean m_required

m_fieldName

private java.lang.String m_fieldName

m_itemType

private java.lang.String m_itemType

m_itemName

private java.lang.String m_itemName

m_getName

private java.lang.String m_getName

m_setName

private java.lang.String m_setName

m_propertyName

private java.lang.String m_propertyName
Constructor Detail

ValueCustom

protected ValueCustom(SharedNestingBase parent)
Constructor.

Parameters:
parent -

ValueCustom

protected ValueCustom(SharedNestingBase parent,
                      java.lang.String name)
Constructor with name known.

Parameters:
parent -
name -
Method Detail

getClassCustom

public ClassCustom getClassCustom()
Convenience method to access the containing class customization element.

Returns:
class customization

getBaseName

public java.lang.String getBaseName()
Get member (field or property) name. In the case of a field, this is the name with any prefix or suffix stripped; in the case of a property, it's the property name. For both field and property names, the initial letter is converted to lowercase unless the second letter is lowercase.

Returns:
name

setBaseName

protected void setBaseName(java.lang.String name)
Set member (field or property) name. This is only for use by subclasses.

Parameters:
name -

getStatedType

public java.lang.String getStatedType()
Get stated type of member.

Returns:
stated type

getWorkingType

public java.lang.String getWorkingType()
Get working type of member.

Returns:
working type

convertMemberNameCase

public static java.lang.String convertMemberNameCase(java.lang.String name)
Convert case of member name derived from method or field name. If the supplied name starts with an uppercase letter followed by a lowercase letter, the initial letter is converted to lowercase in order to obtain a standard form of the name.

Parameters:
name -
Returns:
converted name

memberNameFromGetMethod

public static java.lang.String memberNameFromGetMethod(java.lang.String name)
Get the member name for a property from the read method name. This means stripping off the leading "get" or "is" prefix, then case-converting the result.

Parameters:
name -
Returns:
member name
See Also:
convertMemberNameCase(String), memberNameFromSetMethod(String), memberNameFromField(String, String[], String[])

memberNameFromSetMethod

public static java.lang.String memberNameFromSetMethod(java.lang.String name)
Get the member name for a property from the write method name. This means stripping off the leading "set" prefix, then case-converting the result.

Parameters:
name -
Returns:
member name
See Also:
convertMemberNameCase(String), memberNameFromGetMethod(String), memberNameFromField(String, String[], String[])

memberNameFromField

public static java.lang.String memberNameFromField(java.lang.String name,
                                                   java.lang.String[] prefs,
                                                   java.lang.String[] suffs)
Get the member name for a field from the field name. This means stripping off and leading field name prefix and/or trailing suffix, then case-converting the result.

Parameters:
name -
prefs - field prefixes to be stripped
suffs - field suffixes to be stripped
Returns:
member name
See Also:
convertMemberNameCase(String), memberNameFromGetMethod(String), memberNameFromSetMethod(String)

getStyle

public int getStyle()
Get style code.

Returns:
value from NestingBase.s_valueStyleEnum enumeration

getXmlName

public java.lang.String getXmlName()
Get XML element or attribute name.

Returns:
name (null if none)

getActualType

public java.lang.String getActualType()
Get member actual type.

Returns:
member actual type (null if none)

getCreateType

public java.lang.String getCreateType()
Get member create type.

Returns:
type used for creating new instance (null if none)

getFactoryMethod

public java.lang.String getFactoryMethod()
Get factory method.

Returns:
method used for creating new instance (null if none)

isRequired

public boolean isRequired()
Check if value is required.

Returns:
true if required, false if not

isElementForced

public boolean isElementForced()
Check if element representation forced. This is used specifically for collection members, so that the binding generation can tell if an element name was forced for use as a collection wrapper.

Returns:
true if element representation forced, false if not

setElement

private void setElement(java.lang.String text,
                        IUnmarshallingContext ictx)
Set element name method. This is intended for use during unmarshalling, so it needs to allow for being called with a null value. TODO: add validation

Parameters:
text - (null if attribute not present)
ictx -

setAttribute

private void setAttribute(java.lang.String text,
                          IUnmarshallingContext ictx)
Set attribute name method. This is intended for use during unmarshalling, so it needs to allow for being called with a null value. TODO: add validation

Parameters:
text - (null if attribute not present)
ictx -

getStyleText

private java.lang.String getStyleText()
Style get text method. This is intended for use during marshalling. TODO: add validation

Returns:
text

isProperty

public boolean isProperty()
Check if member represents a property.

Returns:
true

isCollection

public boolean isCollection()
Check if collection member.

Returns:
true if collection, false if not

isPrivate

public boolean isPrivate()
Check if a private member.

Returns:
true if private, false if not

getFieldName

public java.lang.String getFieldName()
Get 'field' attribute value.

Returns:
'field' value (null if none)

getGetName

public java.lang.String getGetName()
Get 'get-method' attribute name.

Returns:
'get' attribute name (null if none)

getSetName

public java.lang.String getSetName()
Get 'set-method' attribute name.

Returns:
'set-method' attribute name (null if none)

getPropertyName

public java.lang.String getPropertyName()
Get 'property-name' attribute value.

Returns:
property name (null if none)

getItemType

public java.lang.String getItemType()
Get item type.

Returns:
item type (null if none)

getItemName

public java.lang.String getItemName()
Get item element name.

Returns:
item name (null if none)

preSet

protected void preSet(IUnmarshallingContext uctx)
Make sure all attributes are defined.

Parameters:
uctx - unmarshalling context

postSet

protected void postSet()
                throws JiBXException
Post-set method that handles checking attribute combinations and sets the actual member name.

Throws:
JiBXException

fillType

void fillType(IClass info,
              java.lang.Boolean req,
              java.lang.Integer style)
Complete customization information based on supplied type. If the type information has not previously been set, this will set it. It will also derive the appropriate XML name, if not previously set.

Parameters:
info - value type information
req - required member flag (null if unspecified)
style - representation style (null if unspecified)

fillDetails

void fillDetails(IClassItem field,
                 IClassItem gmeth,
                 IClassItem smeth,
                 IClassLocator icl,
                 java.lang.Boolean req,
                 java.lang.Integer style)
Complete customization information based on either field or access method information.

Parameters:
field - (null if none)
gmeth - read access method (null if none)
smeth - write access method (null if none)
icl - class locator
req - required member flag (null if unknown)
style - representation style (null if unspecified)

factory

private static ValueCustom factory(IUnmarshallingContext ictx)
Factory method for creating instances during unmarshalling.

Parameters:
ictx -
Returns:
instance


Project Web Site