org.sandev.TaskHeap.util
Class AppInstanceClassEnumerator

java.lang.Object
  extended by org.sandev.TaskHeap.util.AppInstanceClassEnumerator
All Implemented Interfaces:
org.sandev.basics.util.InstanceClassEnumerator

public class AppInstanceClassEnumerator
extends java.lang.Object
implements org.sandev.basics.util.InstanceClassEnumerator

A utility to translate from a base class or interface into possible class instances. AUTOGENERATED FILE, DO NOT EDIT DIRECTLY.
source: declared in build
generator: org.sandev.generator.InstClassEnumGenerator
time: Jul 31, 2008 4:34:15 PM

At build time, we have all the classes for the deployment we are currently building. So it is possible to build a lookup structure for every declared class and/or interface, which provides all subinterfaces, implementing classes, and/or subclasses. This lookup structure is captured statically in this class, and the methods traverse the lookup structure to return their results.

This class is primarily intended to support user interfaces, where it is not necessarily clear from the context which class is being referred to. A typical case would be a adding an element to an array that is declared as a superclass or interface. In this case we would need to ask the user what actual instance they want to create.

Because the primary focus of this class is UI disambiguation, only the short names of the classes/interfaces are used. This means that there is a potential for conflict if two interfaces or classes with the same name are being used within the deployment being built. If this happens, the two class/interfaces would be treated as the same, which may or may not be the desired result. It is recommended that deployments avoid using two classes/interfaces with the same basic name in their struct declarations.


Field Summary
static java.lang.String[] lnClassNames
           
static java.lang.String[] nodeDecls
           
static java.lang.String[] persistMessages
           
static java.lang.String[] sandCollectionMessages
          The types of SandCollectionMessages defined.
static java.lang.String[] sandMessageTypes
          The types of messages a SandMessage can resolve into.
static java.lang.String[] sandQueryMessages
          The types of SandUpdateMessages defined.
static java.lang.String[] sandUpdateMessages
          The types of SandUpdateMessages defined.
static java.lang.String[] shClassNames
           
static java.lang.String[] structMessages
           
static java.lang.String[] structPrintnames
           
static java.lang.String[] structTooltips
           
static java.lang.String[][] subClasses
           
 
Constructor Summary
AppInstanceClassEnumerator()
           
 
Method Summary
protected  org.sandev.basics.sandmessages.AggregateUpdate aggregateInstance2Update(org.sandev.ui.sandmessages.AggregateUpdateInstance aui)
          Translate the given AggregateUpateInstance into an AggregateUpdate
 java.lang.String classname2Printname(java.lang.String classname)
          Given the classname of a SandStructMessage, return the printname.
protected  org.sandev.basics.structs.SandCollectionMessage collInstance2Coll(org.sandev.ui.sandmessages.CollectionInstance ci)
          Translate the given CollectionInstance into the corresponding verb message.
 java.lang.String getClassLongName(java.lang.String shortClassName)
          Return the long name of the class, given the short name.
 java.lang.String[] getShortNames(java.lang.String classname)
          Given the short name of a class or interface, return the possible matching classes which could be instantiated.
 java.lang.String getTooltipText(java.lang.String classname)
          Given a classname of a SandStructMessage, return the first sentence of the help, or the empty string if not defined.
 java.lang.String printname2Classname(java.lang.String printname)
          Given the printname of a SandStructMessage, return the classname.
protected  org.sandev.basics.structs.SandQueryMessage queryInstance2Query(org.sandev.ui.sandmessages.QueryInstance qi)
          Translate the given QueryInstance into the corresponding verb message.
 org.sandev.basics.structs.SandMessage translateVerbInstance(org.sandev.basics.structs.SandMessage sm)
          Given a VerbInstance, return the corresponding SandVerbMessage.
protected  org.sandev.basics.structs.SandUpdateMessage updateInstance2Update(org.sandev.ui.sandmessages.UpdateInstance ui)
          Translate the given UpdateInstance into the corresponding verb message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shClassNames

public static final java.lang.String[] shClassNames

lnClassNames

public static final java.lang.String[] lnClassNames

structMessages

public static final java.lang.String[] structMessages

structPrintnames

public static final java.lang.String[] structPrintnames

structTooltips

public static final java.lang.String[] structTooltips

subClasses

public static final java.lang.String[][] subClasses

persistMessages

public static final java.lang.String[] persistMessages

nodeDecls

public static final java.lang.String[] nodeDecls

sandMessageTypes

public static final java.lang.String[] sandMessageTypes
The types of messages a SandMessage can resolve into. Resolve to this level first, then choose the specific message.


sandQueryMessages

public static final java.lang.String[] sandQueryMessages
The types of SandUpdateMessages defined.


sandCollectionMessages

public static final java.lang.String[] sandCollectionMessages
The types of SandCollectionMessages defined.


sandUpdateMessages

public static final java.lang.String[] sandUpdateMessages
The types of SandUpdateMessages defined.

Constructor Detail

AppInstanceClassEnumerator

public AppInstanceClassEnumerator()
Method Detail

getClassLongName

public java.lang.String getClassLongName(java.lang.String shortClassName)
Return the long name of the class, given the short name. At compile time, we build an array of short class names sorted alphabetically. We also create another array with the same ordering as the first, but with the long (fully qualified) names. By looking up the index of the short name, we can return long name by referencing that same index in the long names array.

Note that this only does StructMessages for now, since that is all that is curently required. This is based on the data in the static arrays.

Specified by:
getClassLongName in interface org.sandev.basics.util.InstanceClassEnumerator

getShortNames

public java.lang.String[] getShortNames(java.lang.String classname)
Given the short name of a class or interface, return the possible matching classes which could be instantiated. At compile time, we build an array of class/interface names sorted alphabetically. We also create another array containing arrays of possible classes indexed in the same order. By searching the first array we find the index for the return value lookup in the second array.

Notes:

Specified by:
getShortNames in interface org.sandev.basics.util.InstanceClassEnumerator

classname2Printname

public java.lang.String classname2Printname(java.lang.String classname)
Given the classname of a SandStructMessage, return the printname.

Specified by:
classname2Printname in interface org.sandev.basics.util.InstanceClassEnumerator

printname2Classname

public java.lang.String printname2Classname(java.lang.String printname)
Given the printname of a SandStructMessage, return the classname.

Specified by:
printname2Classname in interface org.sandev.basics.util.InstanceClassEnumerator

getTooltipText

public java.lang.String getTooltipText(java.lang.String classname)
Given a classname of a SandStructMessage, return the first sentence of the help, or the empty string if not defined.

Specified by:
getTooltipText in interface org.sandev.basics.util.InstanceClassEnumerator

translateVerbInstance

public org.sandev.basics.structs.SandMessage translateVerbInstance(org.sandev.basics.structs.SandMessage sm)
                                                            throws org.sandev.basics.util.UIFormAdaptorException
Given a VerbInstance, return the corresponding SandVerbMessage. If the given message is not a VerbInstance then it just returned.

Specified by:
translateVerbInstance in interface org.sandev.basics.util.InstanceClassEnumerator
Throws:
org.sandev.basics.util.UIFormAdaptorException

queryInstance2Query

protected org.sandev.basics.structs.SandQueryMessage queryInstance2Query(org.sandev.ui.sandmessages.QueryInstance qi)
                                                                  throws org.sandev.basics.util.UIFormAdaptorException
Translate the given QueryInstance into the corresponding verb message.

Throws:
org.sandev.basics.util.UIFormAdaptorException

collInstance2Coll

protected org.sandev.basics.structs.SandCollectionMessage collInstance2Coll(org.sandev.ui.sandmessages.CollectionInstance ci)
                                                                     throws org.sandev.basics.util.UIFormAdaptorException
Translate the given CollectionInstance into the corresponding verb message.

Throws:
org.sandev.basics.util.UIFormAdaptorException

updateInstance2Update

protected org.sandev.basics.structs.SandUpdateMessage updateInstance2Update(org.sandev.ui.sandmessages.UpdateInstance ui)
                                                                     throws org.sandev.basics.util.UIFormAdaptorException
Translate the given UpdateInstance into the corresponding verb message.

Throws:
org.sandev.basics.util.UIFormAdaptorException

aggregateInstance2Update

protected org.sandev.basics.sandmessages.AggregateUpdate aggregateInstance2Update(org.sandev.ui.sandmessages.AggregateUpdateInstance aui)
                                                                           throws org.sandev.basics.util.UIFormAdaptorException
Translate the given AggregateUpateInstance into an AggregateUpdate

Throws:
org.sandev.basics.util.UIFormAdaptorException