org.primordion.xholon.base
Interface IReflection

All Known Implementing Classes:
ReflectionJavaMicro, ReflectionJavaStandard

public interface IReflection

Reflection supports a metadata capability.

Since:
0.5 (Created on December 7, 2006)
Author:
Ken Webb

Method Summary
 int getAttributeIntVal(java.lang.Class aClass, java.lang.String attrName)
          Get the current value of an int attribute.
 int getAttributeIntVal(IXholon xhNode, java.lang.String attrName)
          Get the current value of an int attribute.
 java.lang.Object[][] getAttributes(IXholon node)
          Get all attributes that are accessible using a method that starts with "get".
 java.lang.String getAttributeStringVal(IXholon xhNode, java.lang.String attrName)
          XPath uses this to get the current value of a String attribute.
 int setAttributeArrayVal(IXholon tNode, java.lang.String attrName, java.lang.String val, int valIx, int arraySubscript)
          Set the value of one slot in a named array attribute.
 boolean setAttributeBooleanVal(IXholon tNode, java.lang.String attrName, boolean val)
          Set the value of a boolean attribute.
 int setAttributeVal(IXholon tNode, java.lang.String attrName, java.lang.String val, int valIx)
          Set the value of a named attribute.
 boolean setParam(java.lang.String pName, java.lang.String pValue, Application app)
          Application uses this to set parameters.
 

Method Detail

setParam

public boolean setParam(java.lang.String pName,
                        java.lang.String pValue,
                        Application app)
Application uses this to set parameters. Parameters are typically specified in the _xhn.xml file.

Parameters:
pName - Parameter name.
pValue - Parameter value.
app - The Application.
Returns:
Whether or not the parameter could be set.

getAttributes

public java.lang.Object[][] getAttributes(IXholon node)
Get all attributes that are accessible using a method that starts with "get". Only those get methods that have no input parameters are handled. ex: getVal() getRoleName() getUseDataPlotter()

Parameters:
node - An instance of IXholon.
Returns:
A two-dimensional array with a variable number of rows, each containing a Name/Value pair.

getAttributeStringVal

public java.lang.String getAttributeStringVal(IXholon xhNode,
                                              java.lang.String attrName)
XPath uses this to get the current value of a String attribute.

Parameters:
attrName - The name of a String attribute.
Returns:
The current value of the String attribute.

getAttributeIntVal

public int getAttributeIntVal(IXholon xhNode,
                              java.lang.String attrName)
Get the current value of an int attribute. This is currently used at configuration time to get the value of a constant, specifically, the values of port, FSM connection point, and signal id constants. These are all class variables defined as static, and possibly as final.

Parameters:
attrName - The name of an int attribute.
Returns:
The current value of the int attribute.

getAttributeIntVal

public int getAttributeIntVal(java.lang.Class aClass,
                              java.lang.String attrName)
Get the current value of an int attribute. This is currently used at configuration time to get the value of a constant, specifically, by StateMachineEntity, and by ReflectionJavaStandard.getAttributeIntVal(IXholon xhNode, String attrName)

Parameters:
aClass - A Java class, typically a Xh concrete class.
attrName - The name of an int attribute.
Returns:
The current value of the int attribute.

setAttributeVal

public int setAttributeVal(IXholon tNode,
                           java.lang.String attrName,
                           java.lang.String val,
                           int valIx)
Set the value of a named attribute. The type could be any valid Java type. This is currently used at configuration time in Xholon.setVariableValue(String, int) to initialize the value of a variable owned by a specific xholon instance, and by XholonClass.configure().

Parameters:
attrName - The name of an attribute.
val - A String that contains the value that the attribute should be set to.
valIx - An index into the String. The location within the String where the value begins.
Returns:
The Java class type of the input val.

setAttributeBooleanVal

public boolean setAttributeBooleanVal(IXholon tNode,
                                      java.lang.String attrName,
                                      boolean val)
Set the value of a boolean attribute. This is currently used at configuration time in Xholon.setVariableValue(String, int) to initialize the value of a variable owned by a specific xholon instance, and by XholonClass.configure().

Parameters:
tNode - An IXholon instance.
attrName - The name of a boolean attribute.
val - The value that this boolean attribute should be set to.
Returns:
Whether or not the attribute could be set.

setAttributeArrayVal

public int setAttributeArrayVal(IXholon tNode,
                                java.lang.String attrName,
                                java.lang.String val,
                                int valIx,
                                int arraySubscript)
Set the value of one slot in a named array attribute. This is currently used at configuration time in Xholon.setVariableValue(String, int) to initialize the value of a variable owned by a specific xholon instance, and by XholonClass.configure().

Parameters:
tNode - An IXholon instance.
attrName - The name of an array attribute.
val - A String that contains the value that the attribute should be set to.
valIx - An index into the String. The location within the String where the value begins.
arraySubscript - The Zero-indexed subscript of the slot within the array.
Returns:
The Java class type of the input val.