|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.codestreet.messageforge.RFld
Abstract base class for fields in a RMsg.
Field Summary | |
protected java.lang.String |
desc_
Field description. |
protected int |
fieldId_
Field id. |
protected boolean |
locked_
Lock flag -true indicated that the field is locked, false indicated that the field is not locked. |
protected java.lang.String |
name_
Field name. |
protected boolean |
optional_
Optional flag -true if this field is optional. |
protected java.lang.String |
propertyName_
Property name. |
protected java.lang.String[] |
tags_
Field tags. |
protected boolean |
transient_
Transient flag -true if this field is transient. |
protected boolean |
valSet_
Flag to check if value is set. |
Constructor Summary | |
protected |
RFld()
Default constructor. |
protected |
RFld(java.lang.String name,
int fieldId)
Constructor. |
protected |
RFld(java.lang.String name,
int fieldId,
java.lang.String desc)
Constructor. |
protected |
RFld(java.lang.String name,
int fieldId,
java.lang.String desc,
boolean isOptional,
boolean isTransient)
Constructor. |
protected |
RFld(java.lang.String name,
int fieldId,
java.lang.String desc,
boolean isOptional,
boolean isTransient,
java.lang.String propertyName)
Constructor. |
Method Summary | |
void |
addConstraint(RFldConstraint cons)
Add a constraint. |
static java.lang.String |
buildMinMaxConstraintKey(java.lang.Object min,
java.lang.Object max)
|
abstract boolean |
equals(java.lang.Object anObject)
Check if another field is equal to this field. |
protected RFldConstraint |
getConstraint(int index)
Get a specified constraint. |
protected int |
getConstraintCount()
Get the number of constraints. |
java.lang.String |
getDesc()
Get field description. |
int |
getId()
Get field id. |
java.lang.String |
getName()
Get field name. |
boolean |
getOptional()
Check if this field is optional. |
java.lang.String |
getPropertyName()
Get property name. |
abstract java.lang.String |
getTag()
Get the XML tag for this field type. |
java.lang.String[] |
getTags()
Get the tags for this field. |
boolean |
getTransient()
Check if this field is transient. |
abstract RFldType |
getType()
Get field type. |
abstract java.lang.String |
getValueAsString()
Get the field value as a string. |
abstract int |
hashCode()
Supply an implementation that is compatable with equals. |
boolean |
isConstrained()
Check if the field value is constrained. |
boolean |
isLocked()
Get Lock/Unlock property of the field object. |
boolean |
isProperty()
Check if this field is a property. |
boolean |
isValSet()
Check if the field value is set. |
void |
marshal(java.io.Writer writer,
int indentLevel,
java.lang.String indent,
boolean newLines,
boolean expandEmptyElements)
Write the field as XML to target writer. |
protected static void |
marshal(java.io.Writer writer,
java.lang.String tag,
java.lang.String name,
java.lang.String val,
java.lang.String type,
int indentLevel,
java.lang.String indent,
boolean newLines,
boolean expandEmptyElements)
Write the field as XML to target writer. |
abstract void |
reset()
Reset the field value. |
abstract RFld |
set(org.jdom.Element elem)
Set the value of the field from a JDOM element. |
abstract RFld |
set(java.lang.Object newData)
Set the value of the field from an Object. |
void |
setId(int fieldId)
Set field id. |
void |
setLocked(boolean locked)
Lock/Unlock the field object. |
void |
setName(java.lang.String name)
Set field name. |
void |
setOptional(boolean optional)
Set optional property. |
void |
setPropertyName(java.lang.String name)
Set property name. |
void |
setTags(java.lang.String[] tags)
Set the tags for this field. |
void |
setTransient(boolean isTransient)
Set transient property. |
static void |
setXmlAttrNames(java.lang.String name,
java.lang.String val,
java.lang.String id)
Register custom XML attribute names. |
static void |
setXmlTags(java.util.Map xmlTags)
Register custom XML field tags. |
abstract void |
validate()
Validate against constraints. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.codestreet.messageforge.RFldInterface |
getValueAsHashtable, getValueAsObject |
Field Detail |
protected java.lang.String name_
protected int fieldId_
protected java.lang.String desc_
protected boolean optional_
protected boolean transient_
protected boolean locked_
protected boolean valSet_
protected java.lang.String propertyName_
protected java.lang.String[] tags_
Constructor Detail |
protected RFld()
protected RFld(java.lang.String name, int fieldId)
name
- Field name.fieldId
- Field id. Field ids must be either 0 to indicate
that there is no id on the field, or greater. In addition,
field ids must be unique within a messages - no two fields are
allowed to have the same field id.protected RFld(java.lang.String name, int fieldId, java.lang.String desc)
name
- Field name.fieldId
- Field id. Field ids must be either 0 to indicate
that there is no id on the field, or greater. In addition,
field ids must be unique within a messages - no two fields are
allowed to have the same field id.desc
- Field description.RFldType
protected RFld(java.lang.String name, int fieldId, java.lang.String desc, boolean isOptional, boolean isTransient)
name
- Field name.fieldId
- Field id. Field ids must be either 0 to indicate
that there is no id on the field, or greater. In addition,
field ids must be unique within a messages - no two fields are
allowed to have the same field id.desc
- Field description.isOptional
- true to indicate if the field is optional.
Otherwise false.isTransient
- true to indicate if the field is transient.
Otherwise false.protected RFld(java.lang.String name, int fieldId, java.lang.String desc, boolean isOptional, boolean isTransient, java.lang.String propertyName)
name
- Field name.fieldId
- Field id. Field ids must be either 0 to indicate
that there is no id on the field, or greater. In addition,
field ids must be unique within a messages - no two fields are
allowed to have the same field id.desc
- Field description.isOptional
- true to indicate if the field is optional.
Otherwise false.isTransient
- true to indicate if the field is transient.
Otherwise false.propertyName
- Property name for field. Set to null
if field
is nto a property. When property fields are marshaled to some
protocols - e.g. JMS - their values are added as properties to
the message in addition to the payload.Method Detail |
public final java.lang.String getName()
getName
in interface RFldInterface
public final void setName(java.lang.String name)
name
- Field name.public final int getId()
getId
in interface RFldInterface
public final void setId(int fieldId)
fieldId
- Field id.public final java.lang.String getDesc()
getDesc
in interface RFldInterface
public final boolean getOptional()
setOptional(boolean)
public final void setOptional(boolean optional)
optional
- Optional flag -true if this field is optional,
otherwise false. Default is false.public final boolean getTransient()
setTransient(boolean)
public final void setTransient(boolean isTransient)
isTransient
- Transient flag -true if this field is transient,
otherwise false. Default is false.public final boolean isLocked()
isLocked
in interface RFldInterface
public final void setLocked(boolean locked)
locked
- true to lock the field. Otherwise, false
to unlock the field.public final java.lang.String[] getTags()
public final void setTags(java.lang.String[] tags)
tags
- Tags for this field.public final void addConstraint(RFldConstraint cons) throws FieldValidationException
cons
- Constraint.
java.lang.IllegalArgumentException
- if constraint is null.
FieldValidationException
protected final int getConstraintCount()
getConstraint(int)
protected final RFldConstraint getConstraint(int index)
index
- Index of constraint.
java.lang.NullPointerException
- if no constraints have been set on this field.getConstraintCount()
public final boolean isValSet()
isValSet
in interface RFldInterface
public final boolean isConstrained()
isConstrained
in interface RFldInterface
public boolean isProperty()
isProperty
in interface RFldInterface
true
if this field is a property.getPropertyName()
public java.lang.String getPropertyName()
getPropertyName
in interface RFldInterface
null
if this field is not a property.isProperty()
public void setPropertyName(java.lang.String name)
name
- Property name.getPropertyName()
,
isProperty()
public abstract RFldType getType()
getType
in interface RFldInterface
RFldType
public abstract void validate() throws FieldValidationException
FieldValidationException
public abstract boolean equals(java.lang.Object anObject)
anObject
- Another object.
public abstract int hashCode()
public abstract RFld set(org.jdom.Element elem) throws FieldValidationException
set
in interface RFldInterface
elem
- New field value.
FieldValidationException
public abstract RFld set(java.lang.Object newData) throws FieldValidationException
set
in interface RFldInterface
newData
- New field value.
FieldValidationException
public abstract void reset() throws FieldValidationException
FieldValidationException
isValSet()
public abstract java.lang.String getValueAsString()
public abstract java.lang.String getTag()
public void marshal(java.io.Writer writer, int indentLevel, java.lang.String indent, boolean newLines, boolean expandEmptyElements) throws ConverterException
marshal
in interface RFldInterface
writer
- Output target.indent
- Indentation.newLines
- Newlines are inserted after each element if true.expandEmptyElements
- Empty elements - elements with no content - are expanded if
true.
ConverterException
public static final void setXmlTags(java.util.Map xmlTags) throws FieldValidationException
xmlTags
- A mapping of old tags to new custom tags.
FieldValidationException
public static final void setXmlAttrNames(java.lang.String name, java.lang.String val, java.lang.String id)
name
- New name of the field name attribute.val
- New name of the field value attribute.id
- New name of the id field attribute.public static final java.lang.String buildMinMaxConstraintKey(java.lang.Object min, java.lang.Object max)
protected static final void marshal(java.io.Writer writer, java.lang.String tag, java.lang.String name, java.lang.String val, java.lang.String type, int indentLevel, java.lang.String indent, boolean newLines, boolean expandEmptyElements) throws ConverterException
writer
- Output target.indent
- Indentation.newLines
- Newlines are inserted after each element if true.expandEmptyElements
- Empty elements - elements with no content - are expanded if
true.
ConverterException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |