|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.basics.structs.SandAttrVal
A structure for representing a general attribute/value pair in
string form. How the attrval is used depends on the context, so
this is a dependent object and not persistent on its own. Conceptually
an attribute/value representation can be thought of as raw input which
requires processing to yield an object instance or instances.
| Field Summary | |
protected java.lang.String |
attr
The attribute being referenced. |
static java.lang.String |
FIELD_ATTR
Name of the attr field. |
static java.lang.String |
FIELD_VAL
Name of the val field. |
protected java.lang.String |
val
The value of the attribute. |
| Fields inherited from interface org.sandev.basics.structs.SandInstanceMessage |
FIELDCHECK_INVALIDVAL, FIELDCHECK_NOTAREF, FIELDCHECK_NOTINRANGE, FIELDCHECK_NULLARRAY, FIELDCHECK_STRINGOVER, FIELDCHECK_UNKNOWNVAL, FIELDFLAG_BINARY, FIELDFLAG_ENCRYPT, FIELDFLAG_INTERNAL, FIELDFLAG_NOECHO, FIELDFLAG_OBFUSCATE, FIELDFLAG_STRINGPERSIST, FIELDFLAG_UNIQUE, GENMOD_ACTION_APPEND, GENMOD_ACTION_INSERT, GENMOD_ACTION_REMOVE, GENMOD_ACTION_SET |
| Constructor Summary | |
SandAttrVal()
Default constructor. |
|
SandAttrVal(java.lang.String attr,
java.lang.String val)
Full field initialization ctor. |
|
| Method Summary | |
SandInstanceMessage |
cloneMessage()
Return a deep copy of this message. |
SandAttrVal |
cloneSandAttrVal()
Make a deep copy of this SandAttrVal |
SandInstanceMessage |
convertToSuperstructClass()
If this class was generated from a struct which extends another struct, then this method converts an instance of this class to an instance of the message class of the superstruct. |
void |
copyFieldValue(java.lang.String fieldName,
SandInstanceMessage other)
Downcast the other message and copy the value of the specified field into this instance. |
java.lang.String |
debugDump(java.lang.String prefix)
Returns a dump of this object. |
void |
defaultField(java.lang.String fieldName)
Set the specified field to its default value. |
boolean |
fieldHasFlag(java.lang.String fieldname,
int fieldflag)
Return true if the named field declares the indicated flag, false otherwise. |
boolean |
fieldsValid()
If all fields have valid values, return true. |
SandAttrVal[] |
fieldValidate(SandAttrVal[] checkFields)
Return a collection of fieldname-status pairs. |
java.lang.Object |
generalAccessor(java.lang.String fieldspec)
Given a field specification, return the value. |
SandAttrVal |
generalDereference(java.lang.String fieldspec)
Given a field specification, return the reference field name and reference field value. |
void |
generalModifier(int action,
java.lang.String field,
int index,
java.lang.Object val)
Perform the general modification action specified. |
java.lang.String[] |
getAllFields()
Return all the fields declared for this class. |
java.lang.String |
getAttr()
Accessor for attr |
static boolean |
getAttrFlag(int fieldflag)
|
int |
getAttrLengthMax()
|
int |
getAttrLengthNorm()
|
java.lang.String |
getAttrMetatype()
|
boolean |
getAttrNoEcho()
|
SandCollectionMessage |
getCollectionMessage()
If this message has a SandCollectionMessage verb form associated with it, then return a new instance. |
java.lang.String[] |
getDisplayFields()
Get default description values. |
java.lang.String[] |
getDisplayValues()
Returns the values corresponding to the declared display fields. |
SandQueryMessage |
getQueryMessage()
If this message has a SandQueryMessage verb form associated with it, then return a new instance. |
java.lang.String |
getShortName()
Returns the unqualified name of this message. |
SandStructMessage |
getStructMessage()
If this message has a SandStructMessage base form, then return a new instance. |
SandUpdateMessage |
getUpdateMessage()
If this message has a SandUpdateMessage verb form associated with it, then return a new instance. |
java.lang.String |
getVal()
Accessor for val |
static boolean |
getValFlag(int fieldflag)
|
int |
getValLengthMax()
|
int |
getValLengthNorm()
|
java.lang.String |
getValMetatype()
|
boolean |
getValNoEcho()
|
boolean |
isEquivalent(SandMessage sm)
Declared field equivalence check. |
void |
setAttr(java.lang.String attr)
Mutator for attr |
void |
setVal(java.lang.String val)
Mutator for val |
java.util.ArrayList |
validateFields()
Validates field values. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String attr
protected java.lang.String val
>= 18 AND <= 25 .
public static final java.lang.String FIELD_ATTR
public static final java.lang.String FIELD_VAL
| Constructor Detail |
public SandAttrVal()
public SandAttrVal(java.lang.String attr,
java.lang.String val)
| Method Detail |
public java.lang.String getAttr()
public void setAttr(java.lang.String attr)
public java.lang.String getVal()
public void setVal(java.lang.String val)
public java.util.ArrayList validateFields()
public int getAttrLengthMax()
public int getAttrLengthNorm()
public boolean getAttrNoEcho()
public int getValLengthMax()
public int getValLengthNorm()
public boolean getValNoEcho()
public boolean isEquivalent(SandMessage sm)
isEquivalent in interface SandMessagepublic java.lang.String getShortName()
getShortName in interface SandMessagepublic SandQueryMessage getQueryMessage()
SandMessage
getQueryMessage in interface SandMessagepublic SandCollectionMessage getCollectionMessage()
SandMessage
getCollectionMessage in interface SandMessagepublic SandUpdateMessage getUpdateMessage()
SandMessage
getUpdateMessage in interface SandMessagepublic SandStructMessage getStructMessage()
SandMessage
getStructMessage in interface SandMessage
public void generalModifier(int action,
java.lang.String field,
int index,
java.lang.Object val)
throws SandException
SandInstanceMessageaction: one of the GENMOD_ACTION* constants.
field: the name of the field to be operated on.
index: if the field is an array, then this specifies
the array index to be operated on. Otherwise this parameter is
ignored (by convention -1 is passed).
val: the value for the operation. If the field is
a basic type, then this is the "boxed" object (eg Integer, Long,
Double), or the value as a String. If the field is a reference
field, this may also be the object to be referenced.
Notes on use:
val is inserted
in front of the index specified. On GENMOD_ACTION_APPEND
index is ignored.
val is ignored.
An exception is thrown if anything goes wrong.
generalModifier in interface SandInstanceMessageSandExceptionpublic SandAttrVal generalDereference(java.lang.String fieldspec)
SandInstanceMessageTo support access to array fields, this method also accepts
field specifications with the array index specified. So for example
if you want to retrieve the third element from an array field
called myrefs, you would specify myrefs[2]
as the fieldspec.
This method is intended for use with UI programming and other
general object access situations where normal access is difficult
due to generalized interfaces.
generalDereference in interface SandInstanceMessagepublic java.lang.Object generalAccessor(java.lang.String fieldspec)
SandInstanceMessageTo support access to array fields, this method also accepts
field specifications with the array index specified. So for
example if you want to retrieve the third element from an
array called myobjects, you would specify
myobjects[2] as the fieldspec.
This method is intended for use with UI programming and other general object access situations where normal access is difficult due to generalized interfaces.
generalAccessor in interface SandInstanceMessagepublic java.lang.String[] getDisplayFields()
SandInstanceMessage@display and @displayadd declarations, then
return an array of the fields used for those declarations.
getDisplayFields in interface SandInstanceMessagepublic java.lang.String[] getDisplayValues()
SandInstanceMessage
getDisplayValues in interface SandInstanceMessagepublic SandInstanceMessage cloneMessage()
SandInstanceMessage
cloneMessage in interface SandInstanceMessage
public void copyFieldValue(java.lang.String fieldName,
SandInstanceMessage other)
SandInstanceMessage
copyFieldValue in interface SandInstanceMessagepublic java.lang.String[] getAllFields()
SandInstanceMessage
getAllFields in interface SandInstanceMessagepublic void defaultField(java.lang.String fieldName)
SandInstanceMessage
defaultField in interface SandInstanceMessagepublic SandInstanceMessage convertToSuperstructClass()
SandInstanceMessageThe return value is a new object instance with fields initialized appropriately, or null if this is a root level struct.
convertToSuperstructClass in interface SandInstanceMessagepublic java.lang.String debugDump(java.lang.String prefix)
SandInstanceMessage
debugDump in interface SandInstanceMessage
public boolean fieldHasFlag(java.lang.String fieldname,
int fieldflag)
SandInstanceMessage
fieldHasFlag in interface SandInstanceMessagepublic SandAttrVal[] fieldValidate(SandAttrVal[] checkFields)
SandInstanceMessageWhile the FIELDCHECK keys are meant to be human readable, they are also constant strings and can be used to look up localized or other custom text within a UI. This method is in support of level 2 message validation, where the levels are:
Other validation methods may leverage the same SandAttrVal[]
structure, adding their own status constants. This method supports
at least the checking provided by the SAND field tags. The
FIELDCHECK_* constants are not intended to be full error
descriptions. Level 1 validation will already need to provide
information about what kinds of input is valid, so it would be
redundent to put it here as well. This method principally
enforces the contract between validation levels 1 and 3.
fieldValidate in interface SandInstanceMessagepublic boolean fieldsValid()
SandInstanceMessage
fieldsValid in interface SandInstanceMessagepublic static boolean getAttrFlag(int fieldflag)
public static boolean getValFlag(int fieldflag)
public java.lang.String getAttrMetatype()
public java.lang.String getValMetatype()
public SandAttrVal cloneSandAttrVal()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||