|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.xml.FudgeXMLSettings
public class FudgeXMLSettings
Base class to hold common data for the Fudge XML reader and writer as defined by the specification that can be customized for a specific XML source or destination. The default settings are based on XML Fudge Message specification.
Nested Class Summary | |
---|---|
protected static class |
FudgeXMLSettings.XMLEnvelopeAttribute
Attributes available for the envelope element. |
protected static class |
FudgeXMLSettings.XMLFieldAttribute
Attributes available for a field element. |
Field Summary | |
---|---|
static String |
ALIAS_BOOLEAN_FALSE_0
Alternative value (not written but recognized by default) for a false boolean field. |
static String |
ALIAS_BOOLEAN_FALSE_F
Alternative value (not written but recognized by default) for a false boolean field. |
static String |
ALIAS_BOOLEAN_FALSE_OFF
Alternative value (not written but recognized by default) for a false boolean field. |
static String |
ALIAS_BOOLEAN_TRUE_1
Alternative value (not written but recognized by default) for a true boolean field. |
static String |
ALIAS_BOOLEAN_TRUE_ON
Alternative value (not written but recognized by default) for a true boolean field. |
static String |
ALIAS_BOOLEAN_TRUE_T
Alternative value (not written but recognized by default) for a true boolean field. |
static String |
ALIAS_FIELD_ATTRIBUTE_ORDINAL_INDEX
Alternative attribute name (not written but recognized by default) for the ordinal index of a field. |
static String |
ALIAS_FIELD_ATTRIBUTE_ORDINAL_KEY
Alternative attribute name (not written but recognized by default) for the ordinal index of a field. |
static String |
DEFAULT_BOOLEAN_FALSE
Default value for a false boolean field. |
static String |
DEFAULT_BOOLEAN_TRUE
Default value for a true boolean field. |
static String |
DEFAULT_ENCODING_BASE64
Default value for base-64 encoded data. |
static String |
DEFAULT_ENVELOPE_ATTRIBUTE_PROCESSINGDIRECTIVES
Default attribute name for the processing directives on the envelope. |
static String |
DEFAULT_ENVELOPE_ATTRIBUTE_SCHEMAVERSION
Default attribute name for the schema version on the envelope. |
static String |
DEFAULT_ENVELOPE_ATTRIBUTE_TAXONOMY
Default attribute name for the taxonomy on the envelope. |
static String |
DEFAULT_ENVELOPE_ELEMENT
Default element name for the outer envelope tag. |
static String |
DEFAULT_FIELD_ATTRIBUTE_ENCODING
Default attribute name for the encoding of a field. |
static String |
DEFAULT_FIELD_ATTRIBUTE_NAME
Default attribute name for the name of a field. |
static String |
DEFAULT_FIELD_ATTRIBUTE_ORDINAL
Default attribute name for the ordinal index of a field. |
static String |
DEFAULT_FIELD_ATTRIBUTE_TYPE
Default attribute name for the type of a field. |
static String |
DEFAULT_FIELD_ELEMENT
Default element name for an anonymous or unnamed field. |
Constructor Summary | |
---|---|
FudgeXMLSettings()
Creates a new settings object with all of the defaults. |
|
FudgeXMLSettings(FudgeXMLSettings other)
Creates a new settings object as a copy of another. |
Method Summary | |
---|---|
void |
addBase64EncodingAlias(String value)
Adds an additional alias to recognize as a Base-64 encoding when reading XML input. |
protected void |
addBooleanAlias(boolean value,
String alias)
|
void |
addBooleanFalseAlias(String falseValue)
Adds an additional alias to recognize as a boolean false value when decoding XML input. |
void |
addBooleanTrueAlias(String trueValue)
Adds an additional alias to recognize as a boolean true when decoding XML input. |
protected void |
addEnvelopeAttributeAlias(FudgeXMLSettings.XMLEnvelopeAttribute attribute,
String attributeName)
|
void |
addEnvelopeAttributeProcessingDirectivesAlias(String processingDirectivesAttributeName)
Adds an additional alias to recognize as a processing directives attribute in an envelope element. |
void |
addEnvelopeAttributeSchemaVersionAlias(String schemaVersionAttributeName)
Adds an additional alias to recognize as a schema version attribute in an envelope element. |
void |
addEnvelopeAttributeTaxonomyAlias(String taxonomyAttributeName)
Adds an additional alias to recognize as a taxonomy attribute in an envelope element. |
void |
addEnvelopeElementAlias(String envelopeElementName)
Adds an additional alias to recognize as an envelope element when parsing XML input. |
protected void |
addFieldAttributeAlias(FudgeXMLSettings.XMLFieldAttribute attribute,
String attributeName)
|
void |
addFieldAttributeEncodingAlias(String encodingAttributeName)
Adds an additional alias to recognize as an encoding attribute when parsing XML input. |
void |
addFieldAttributeNameAlias(String nameAttributeName)
Adds an additional alias to recognize as a field name attribute of a field element when parsing XML input. |
void |
addFieldAttributeOrdinalAlias(String ordinalAttributeName)
Adds an additional alias to recognize as a field ordinal attribute when parsing XML input. |
void |
addFieldAttributeTypeAlias(String typeAttributeName)
Adds an additional alias to recognize as a field type attribute when parsing XML input. |
void |
addFieldElementAlias(String fieldElementName)
Adds an additional alias to recognize as an unnamed field element when parsing XML input. |
protected void |
clearBooleanAliases(Boolean value)
|
void |
clearBooleanFalseAliases()
Removes any aliases registered with addBooleanFalseAlias(java.lang.String) . |
void |
clearBooleanTrueAliases()
Removes any aliases registered with addBooleanTrueAlias(java.lang.String) . |
protected void |
clearEnvelopeAttributeAliases(FudgeXMLSettings.XMLEnvelopeAttribute attribute)
|
void |
clearEnvelopeAttributeProcessingDirectivesAliases()
Clears the set of aliases recognized for the processing directives attribute in an envelope element. |
void |
clearEnvelopeAttributeSchemaVersionAliases()
Clears the set of aliases recognized for the schema version attribute in an envelope element. |
void |
clearEnvelopeAttributeTaxonomyAliases()
Clears the set of aliases recognized for the taxonomy attribute in an envelope element. |
void |
clearEnvelopeElementAliases()
Removes any aliases added by addEnvelopeElementAlias(java.lang.String) . |
protected void |
clearFieldAttributeAliases(FudgeXMLSettings.XMLFieldAttribute attribute)
|
void |
clearFieldAttributeEncodingAliases()
Clears the aliases for field encoding attributes set by addFieldAttributeEncodingAlias(java.lang.String) . |
void |
clearFieldAttributeNameAliases()
Clears the aliases for field name attributes set by addFieldAttributeNameAlias(java.lang.String) . |
void |
clearFieldAttributeOrdinalAliases()
Clears the aliases for field ordinal attributes set by addFieldAttributeOrdinalAlias(java.lang.String) . |
void |
clearFieldAttributeTypeAliases()
Clears the aliases for field type attributes set by addFieldAttributeTypeAlias(java.lang.String) . |
void |
clearFieldElementAliases()
Removes any aliases added by addFieldElementAlias(java.lang.String) . |
String |
fudgeTypeIdToString(int type)
Returns a type string for a Fudge type identifier. |
boolean |
getAppendFieldOrdinal()
Returns true if the field ordinal should be appended to the field name when generating field elements. |
protected Set<String> |
getBase64EncodingAliases()
|
String |
getBase64EncodingName()
Returns the value to use, or expect, on an encoding attribute if the field data is written in Base-64. |
boolean |
getBase64UnknownTypes()
Returns true if the data for unknown types should be encoded in Base-64. |
String |
getBooleanFalse()
Returns the value to use for encoding a boolean false value, or to expect when decoding XML input. |
String |
getBooleanTrue()
Returns the value to use for encoding a boolean true value, or to expect when decoding XML input. |
protected String |
getEnvelopeAttribute(FudgeXMLSettings.XMLEnvelopeAttribute attribute)
|
String |
getEnvelopeAttributeProcessingDirectives()
Returns the name to use for the processing directives attribute in an envelope element. |
String |
getEnvelopeAttributeSchemaVersion()
Returns the name to use for the schema version attribute in an envelope element. |
protected Map<FudgeXMLSettings.XMLEnvelopeAttribute,String> |
getEnvelopeAttributesToName()
|
String |
getEnvelopeAttributeTaxonomy()
Returns the name to use for the taxonomy attribute in an envelope element. |
protected Set<String> |
getEnvelopeElementAliases()
|
String |
getEnvelopeElementName()
Returns the main name for the envelope element. |
protected String |
getFieldAttribute(FudgeXMLSettings.XMLFieldAttribute attribute)
|
String |
getFieldAttributeEncoding()
Returns the name of the encoding attribute of a field element. |
String |
getFieldAttributeName()
Returns the name of the field name attribute in a field element. |
String |
getFieldAttributeOrdinal()
Returns the name of the field ordinal attribute in a field element. |
protected Map<FudgeXMLSettings.XMLFieldAttribute,String> |
getFieldAttributesToName()
|
String |
getFieldAttributeType()
Returns the name of the type attribute in a field element. |
protected Set<String> |
getFieldElementAliases()
|
String |
getFieldElementName()
Returns the element name to use for unnamed fields. |
protected Map<Integer,String> |
getFudgeTypesToIdentifier()
|
protected Map<String,Integer> |
getIdentifiersToFudgeType()
|
protected Map<String,FudgeXMLSettings.XMLEnvelopeAttribute> |
getNamesToEnvelopeAttribute()
|
protected Map<String,FudgeXMLSettings.XMLFieldAttribute> |
getNamesToFieldAttribute()
|
boolean |
getPreserveFieldNames()
Returns whether to map the field name to/from the element name. |
protected Map<String,Boolean> |
getStringsToBoolean()
|
protected void |
registerFudgeType(int type,
String... identifiers)
|
void |
setAppendFieldOrdinal(boolean appendFieldOrdinal)
Sets whether to append the field ordinal to the default field name when generating field elements. |
void |
setBase64EncodingName(String value)
Sets the value to use, or expect, on an encoding attribute if the field data is written in Base-64. |
void |
setBase64UnknownTypes(boolean base64UnknownTypes)
Sets whether to encode unknown types in Base-64. |
void |
setBooleanFalse(String falseValue)
Sets the value to use for encoding a boolean false value, or to expect when decoding XML input. |
void |
setBooleanTrue(String trueValue)
Sets the value to use for encoding a boolean true value, or to expect when decoding XML input. |
protected void |
setEnvelopeAttribute(FudgeXMLSettings.XMLEnvelopeAttribute attribute,
String attributeName)
|
void |
setEnvelopeAttributeProcessingDirectives(String processingDirectivesAttributeName)
Sets the attribute name to use for processing directives in the envelope element. |
void |
setEnvelopeAttributeSchemaVersion(String schemaVersionAttributeName)
Sets the attribute name to use for the schema version in the envelope element. |
void |
setEnvelopeAttributeTaxonomy(String taxonomyAttributeName)
Sets the attribute name to use for the taxonomy in the envelope element. |
void |
setEnvelopeElementName(String envelopeElementName)
Sets the name of the envelope element. |
protected void |
setFieldAttribute(FudgeXMLSettings.XMLFieldAttribute attribute,
String attributeName)
|
void |
setFieldAttributeEncoding(String encodingAttributeName)
Sets the name of the encoding attribute on a field element. |
void |
setFieldAttributeName(String nameAttributeName)
Sets the name of the field name attribute on a field element. |
void |
setFieldAttributeOrdinal(String ordinalAttributeName)
Sets the name of the field ordinal index attribute on a field element. |
void |
setFieldAttributeType(String typeAttributeName)
Sets the name of the type attribute on a field element. |
void |
setFieldElementName(String fieldElementName)
Sets the name of the field element for unnamed fields. |
void |
setPreserveFieldNames(boolean preserveFieldNames)
Set to use the field name as the element name when writing fields, or derive the field name from the element name when reading. |
Integer |
stringToFudgeTypeId(String str)
Returns a Fudge type identifier for a given string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_ENVELOPE_ELEMENT
public static final String DEFAULT_ENVELOPE_ATTRIBUTE_PROCESSINGDIRECTIVES
public static final String DEFAULT_ENVELOPE_ATTRIBUTE_SCHEMAVERSION
public static final String DEFAULT_ENVELOPE_ATTRIBUTE_TAXONOMY
public static final String DEFAULT_FIELD_ELEMENT
public static final String DEFAULT_FIELD_ATTRIBUTE_NAME
public static final String DEFAULT_FIELD_ATTRIBUTE_ORDINAL
public static final String ALIAS_FIELD_ATTRIBUTE_ORDINAL_INDEX
public static final String ALIAS_FIELD_ATTRIBUTE_ORDINAL_KEY
public static final String DEFAULT_FIELD_ATTRIBUTE_TYPE
public static final String DEFAULT_FIELD_ATTRIBUTE_ENCODING
public static final String DEFAULT_BOOLEAN_TRUE
true
boolean field.
public static final String ALIAS_BOOLEAN_TRUE_ON
true
boolean field.
public static final String ALIAS_BOOLEAN_TRUE_T
true
boolean field.
public static final String ALIAS_BOOLEAN_TRUE_1
true
boolean field.
public static final String DEFAULT_BOOLEAN_FALSE
false
boolean field.
public static final String ALIAS_BOOLEAN_FALSE_OFF
false
boolean field.
public static final String ALIAS_BOOLEAN_FALSE_F
false
boolean field.
public static final String ALIAS_BOOLEAN_FALSE_0
false
boolean field.
public static final String DEFAULT_ENCODING_BASE64
Constructor Detail |
---|
public FudgeXMLSettings()
public FudgeXMLSettings(FudgeXMLSettings other)
other
- an existing settings object to copyMethod Detail |
---|
protected Set<String> getEnvelopeElementAliases()
protected Set<String> getFieldElementAliases()
protected Map<String,FudgeXMLSettings.XMLEnvelopeAttribute> getNamesToEnvelopeAttribute()
protected Map<FudgeXMLSettings.XMLEnvelopeAttribute,String> getEnvelopeAttributesToName()
protected Map<String,FudgeXMLSettings.XMLFieldAttribute> getNamesToFieldAttribute()
protected Map<FudgeXMLSettings.XMLFieldAttribute,String> getFieldAttributesToName()
public void setEnvelopeElementName(String envelopeElementName)
null
to disable reading/writing of an envelope element.
envelopeElementName
- the name of the elementpublic String getEnvelopeElementName()
null
if an envelope element should not be written or expected in the source XML.
public void addEnvelopeElementAlias(String envelopeElementName)
envelopeElementName
- the name of the elementpublic void clearEnvelopeElementAliases()
addEnvelopeElementAlias(java.lang.String)
. Only the main element name as returned by getEnvelopeElementName()
will be recognized
when parsing XML input.
public void setFieldElementName(String fieldElementName)
null
to omit unnamed fields from the XML output, or to treat all field names literally when parsing XML input.
fieldElementName
- the name of the elementpublic String getFieldElementName()
null
if unnamed fields shouldn't be written, or not processed when parsing XML input.
public void addFieldElementAlias(String fieldElementName)
fieldElementName
- the name of the elementpublic void clearFieldElementAliases()
addFieldElementAlias(java.lang.String)
. Only the main element name as returned by getFieldElementName()
will be recognized when parsing XML input.
public void setEnvelopeAttributeProcessingDirectives(String processingDirectivesAttributeName)
null
to omit processing directives when writing XML, or ignore in XML input.
processingDirectivesAttributeName
- name of the attributepublic void setEnvelopeAttributeSchemaVersion(String schemaVersionAttributeName)
null
to omit schema version when writing XML, or ignore in XML input.
schemaVersionAttributeName
- name of the attributepublic void setEnvelopeAttributeTaxonomy(String taxonomyAttributeName)
null
to omit taxonomy information when writing XML, or ignore in XML input.
taxonomyAttributeName
- name of the attributeprotected void setEnvelopeAttribute(FudgeXMLSettings.XMLEnvelopeAttribute attribute, String attributeName)
attribute
- attributeName
- public String getEnvelopeAttributeProcessingDirectives()
null
if processing directives should be omitted from output, or ignored in XML input.
public String getEnvelopeAttributeSchemaVersion()
null
if schema version should be omitted from output, or ignored in XML input.
public String getEnvelopeAttributeTaxonomy()
null
if taxonomy should be omitted from output, or ignored in XML input.
protected String getEnvelopeAttribute(FudgeXMLSettings.XMLEnvelopeAttribute attribute)
attribute
-
public void addEnvelopeAttributeProcessingDirectivesAlias(String processingDirectivesAttributeName)
processingDirectivesAttributeName
- the name of the attributepublic void addEnvelopeAttributeSchemaVersionAlias(String schemaVersionAttributeName)
schemaVersionAttributeName
- the name of the attributepublic void addEnvelopeAttributeTaxonomyAlias(String taxonomyAttributeName)
taxonomyAttributeName
- the name of the attributeprotected void addEnvelopeAttributeAlias(FudgeXMLSettings.XMLEnvelopeAttribute attribute, String attributeName)
attribute
- attributeName
- public void clearEnvelopeAttributeProcessingDirectivesAliases()
public void clearEnvelopeAttributeSchemaVersionAliases()
public void clearEnvelopeAttributeTaxonomyAliases()
protected void clearEnvelopeAttributeAliases(FudgeXMLSettings.XMLEnvelopeAttribute attribute)
attribute
- public void setFieldAttributeName(String nameAttributeName)
null
to omit the attribute from output or ignore in XML input.
nameAttributeName
- name of the attributepublic void setFieldAttributeOrdinal(String ordinalAttributeName)
null
to omit the attribute from output, or ignore in XML input.
ordinalAttributeName
- name of the attributepublic void setFieldAttributeType(String typeAttributeName)
null
to omit the attribute from output, or ignore in XML input.
typeAttributeName
- name of the attributepublic void setFieldAttributeEncoding(String encodingAttributeName)
null
to omit the attribute from output, or ignore in XML input.
encodingAttributeName
- name of the attributeprotected void setFieldAttribute(FudgeXMLSettings.XMLFieldAttribute attribute, String attributeName)
attribute
- attributeName
- public String getFieldAttributeName()
null
if the name should be omitted from output or ignored in XML input.
public String getFieldAttributeOrdinal()
null
if the ordinal should be omitted from output, or ignored in XML input.
public String getFieldAttributeType()
null
if the type should be omitted from output, or ignored in XML input.
public String getFieldAttributeEncoding()
null
if the encoding should be omitted from output, or ignored in XML input.
protected String getFieldAttribute(FudgeXMLSettings.XMLFieldAttribute attribute)
attribute
-
public void addFieldAttributeNameAlias(String nameAttributeName)
nameAttributeName
- name of the attributepublic void addFieldAttributeOrdinalAlias(String ordinalAttributeName)
ordinalAttributeName
- name of the attributepublic void addFieldAttributeTypeAlias(String typeAttributeName)
typeAttributeName
- name of the attributepublic void addFieldAttributeEncodingAlias(String encodingAttributeName)
encodingAttributeName
- name of the attributeprotected void addFieldAttributeAlias(FudgeXMLSettings.XMLFieldAttribute attribute, String attributeName)
attribute
- attributeName
- public void clearFieldAttributeNameAliases()
addFieldAttributeNameAlias(java.lang.String)
.
public void clearFieldAttributeOrdinalAliases()
addFieldAttributeOrdinalAlias(java.lang.String)
.
public void clearFieldAttributeTypeAliases()
addFieldAttributeTypeAlias(java.lang.String)
.
public void clearFieldAttributeEncodingAliases()
addFieldAttributeEncodingAlias(java.lang.String)
.
protected void clearFieldAttributeAliases(FudgeXMLSettings.XMLFieldAttribute attribute)
attribute
- public void setPreserveFieldNames(boolean preserveFieldNames)
preserveFieldNames
- true
to map the field name to/from the element namepublic boolean getPreserveFieldNames()
public void setBooleanTrue(String trueValue)
true
value, or to expect when decoding XML input.
trueValue
- the XML contentpublic String getBooleanTrue()
true
value, or to expect when decoding XML input.
public void addBooleanTrueAlias(String trueValue)
true
when decoding XML input.
public void clearBooleanTrueAliases()
addBooleanTrueAlias(java.lang.String)
.
public void setBooleanFalse(String falseValue)
false
value, or to expect when decoding XML input.
falseValue
- the XML contentpublic String getBooleanFalse()
false
value, or to expect when decoding XML input.
public void addBooleanFalseAlias(String falseValue)
false
value when decoding XML input.
public void clearBooleanFalseAliases()
addBooleanFalseAlias(java.lang.String)
.
protected void addBooleanAlias(boolean value, String alias)
value
- alias
- protected void clearBooleanAliases(Boolean value)
value
- protected Map<String,Boolean> getStringsToBoolean()
public void setBase64EncodingName(String value)
public String getBase64EncodingName()
public void addBase64EncodingAlias(String value)
protected Set<String> getBase64EncodingAliases()
public boolean getBase64UnknownTypes()
public void setBase64UnknownTypes(boolean base64UnknownTypes)
protected Map<String,Integer> getIdentifiersToFudgeType()
protected Map<Integer,String> getFudgeTypesToIdentifier()
protected void registerFudgeType(int type, String... identifiers)
type
- identifiers
- public String fudgeTypeIdToString(int type)
public Integer stringToFudgeTypeId(String str)
public boolean getAppendFieldOrdinal()
true
if the field ordinal should be appended to the field name when generating field elements.
public void setAppendFieldOrdinal(boolean appendFieldOrdinal)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |