org.sandev.basics.structs
Interface SandMessage

All Known Subinterfaces:
AuthUser, NodeInstance, SandCollectionMessage, SandInstanceMessage, SandPersistMessage, SandQueryMessage, SandStructMessage, SandTransmitMessage, SandUpdateMessage, SandVerbMessage
All Known Implementing Classes:
AggregateUpdate, AuthorizerNodeInstance, AuthWrapper, BaseUser, BaseUserCollection, BaseUserQuery, BaseUserUpdate, CacheAction, CacheManagerNodeInstance, CallResponse, Configuration, ConfigurationUpdate, DataImportExport, DataManagerNodeInstance, DeliveryStream, IODeclCall, IODeclReceive, IODeclSend, IODeclSubscribe, MessageDescription, MessageDriverNodeInstance, Ping, ReceiveReturn, SandAttrVal, ServerDeclaration, ServerDeclarationCollection, ServerDeclarationQuery, Stats, StatsQuery, TestScript, UIFormInitializer, UIFormQuery

public interface SandMessage

Root interface implemented by all SAND messages.

SandMessage

The methods declared in these message interfaces are implemented using code generators, which are manually kept synchronized with these declarations. There is currrently no mechanism for declaring tags in these interface declarations.


Method Summary
 SandCollectionMessage getCollectionMessage()
          If this message has a SandCollectionMessage verb form associated with it, then return a new instance.
 SandQueryMessage getQueryMessage()
          If this message has a SandQueryMessage verb form associated with it, then return a new instance.
 java.lang.String getShortName()
          Return 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.
 boolean isEquivalent(SandMessage other)
          Field equivalence check.
 

Method Detail

isEquivalent

public boolean isEquivalent(SandMessage other)
Field equivalence check. Using only the explicitely declared struct fields (generated fields are ignored), do an equivalence check of the class type, and field values. Return true if all field values are the same, false otherwise. For String and Date fields, the equals method is used.

The generated fields are ignored, because their semantics tend to get in the way and are best handled separately. For persistent objects, you can test for equivalent uniqueIDs, equivalent versions etc. already.

The contents of array elements ARE checked (recursively if necessary) without sorting. This allows for checking equivalent tree structures and suchlike.

Since the default equals method is not overridden, you can test for binary equivalence this way.

It is recommended that more advanced equivalence testing involving subgroups of fields, more relaxed constraints, fuzzy logic etc. be done outside of the object using a static equivalence checking utility. Ditto for comparisons.


getShortName

public java.lang.String getShortName()
Return the unqualified name of this message. Convenience method. The fully qualified name is available via getClass().getName(), but that can create unnecessary verbiage in trace info.


getQueryMessage

public SandQueryMessage getQueryMessage()
If this message has a SandQueryMessage verb form associated with it, then return a new instance. Otherwise return null.


getCollectionMessage

public SandCollectionMessage getCollectionMessage()
If this message has a SandCollectionMessage verb form associated with it, then return a new instance. Otherwise return null.


getUpdateMessage

public SandUpdateMessage getUpdateMessage()
If this message has a SandUpdateMessage verb form associated with it, then return a new instance. Otherwise return null.


getStructMessage

public SandStructMessage getStructMessage()
If this message has a SandStructMessage base form, then return a new instance. Otherwise return null.