gov.nasa.arc.brahms.common.data
Class JavaProperty

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.BrahmsObject
      extended by gov.nasa.arc.brahms.common.data.ModelElement
          extended by gov.nasa.arc.brahms.common.data.NamedModelElement
              extended by gov.nasa.arc.brahms.common.data.Attribute
                  extended by gov.nasa.arc.brahms.common.data.JavaProperty
All Implemented Interfaces:
gov.nasa.arc.brahms.common.IConstants, java.io.Serializable

public class JavaProperty
extends Attribute

The class JavaProperty is a subclass of Attribute used to represent a property of a Java object that complies with the Java Bean Specification. The JavaProperty class maintains an index of instances indexed by property name and property type that is used at runtime.

Version:
$Revision: 1.1 $ $Date: 2009/11/23 18:28:40 $ $Author: rnado $
Author:
Bob Nado
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
NAME_PROPERTY
 
Fields inherited from interface gov.nasa.arc.brahms.common.IConstants
ABORT, ACTIVECLASS, ACTIVECONCEPT, ACTIVEINSTANCE, AGENT, ANONYMOUS, ANYAGENT, AREA, AREADEF, ASSIGNED, ATTRIBUTE, BASEAREADEF, BASECLASS, BASECONCEPTUALCLASS, BASEGROUP, BASELIBRARY, BOOLEAN, BROADCAST, BUILDING, BYTE, CCLOCK, CDATE, CHAR, CITY, CLASS, CLOCK, COLLECTALL, COMMUNICATE, COMPLETE, COMPOSITE, COMPUTER, CONCEPT, CONCEPTUALCLASS, CONCEPTUALCONCEPT, CONCEPTUALOBJECT, CONTINUE, COPY, CREATEAGENT, CREATEAREA, CREATEOBJECT, current, CURRENT, DATAFRAME, DATE, DB, DETECTABLE, DIV, DOUBLE, EMAIL, EMPTY_STRING, END, ENDACTIVITY, ENTAGENT, EQ, EXCEPTION, EXPR, FACE2FACE, FACTFRAME, FALSE, FAX, FLOAT, FOREACH, FORONE, G2, GE, GEOGRAPHYCONCEPT, GESTURE, GET, GROUP, GT, IMPASSE, INT, INVALID, JAVA, JAVA_TYPE, KNOWN_MODIFIER, KNOWNVAL_MODIFIER, LE, LOCAL, LONG, LT, MAP, MINUS, MOD, MOVE, MULT, NE, NEW, NONE, NOT_MODIFIER, NOWORK, O, OA, OBJECT, ONTOLOGY, PAGER, PARAMETER, PATH, PHONE, PLUS, PRIMITIVE, PRIVATE, PROAGENT, PROTECTED, PRSAGENT, PUBLIC, PUT, RECEIVE, RELATION, sACTIVECLASS, sACTIVECONCEPT, sACTIVEINSTANCE, sAGENT, sARCHIVE, sAREA, sAREADEF, sBOOLEAN, sBYTE, sBYTECODEEXT, sCHAR, sCLASS, sCOMPUTER, sCONCEPT, sCONCEPTUALCLASS, sCONCEPTUALCONCEPT, sCONCEPTUALOBJECT, sCOPY, sCURRENT, sDETECTABLE, sDOUBLE, sEMAIL, sEND, SEND, sFACE2FACE, sFAX, sFILEEXT, sFLOAT, sGEOGRAPHYCONCEPT, sGROUP, SHORT, SIMAGENT, sINT, sJAVA_TYPE, sLONG, sMAP, sNEW, sNONE, sNOWORK, sOBJECT, SOURCECODE, sPAGER, sPARAMETER, sPATH, sPHONE, sPRIVATE, sPROJECTEXT, sPROTECTED, sPUBLIC, sSHORT, sSTART, sSTRING, sSYMBOL, START, STRING, sUNKNOWN, sVOID, SYMBOL, TRUE, UDT, UML, UNASSIGNED, UNDEFINED, unknown, UNKNOWN, UNKNOWN_MODIFIER, V, VARIABLE, VOID, WHENEVER, WORKFRAME, WORLD, XML
 
Constructor Summary
JavaProperty()
          Constructs a new empty JavaProperty instance
JavaProperty(java.lang.String name, java.lang.Class<?> valueClass)
          Constructs a new JavaProperty instance with a given name and Class of allowable values
JavaProperty(java.lang.String file, int line)
          Constructs a new empty JavaProperty instance for an occurrence of the property in a source file at a particular line
JavaProperty(java.lang.String name, JavaType owner, java.lang.String file, int line)
          Constructs a new JavaProperty instance representing a named property of a Java class
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests whether two Java properties are the same.
 java.lang.String getFullyQualifiedName()
          Returns the fully qualified name of the Java property.
static JavaProperty getInstance(java.lang.String name, java.lang.Class<?> valueClass)
          Returns a JavaProperty instance with a given name and Class of values.
 JavaType getOwnerType()
          Returns a JavaType representing the Java class that has the property
 java.lang.Object getValue(java.lang.Object object)
          Retrieves the value of the Java property from a given Java object
 java.lang.Class<?> getValueClass()
          Returns the Java Class object for the type of values of the property
 int hashCode()
          Returns a hash code value for the object.
protected  void setID()
          Sets the unique identifier for the property.
 void setOwnerType(JavaType type)
          Sets the JavaType representing the Java class that has the property
 void setValue(java.lang.Object object, java.lang.Object value)
          Sets the value of the Java property for a given Java object
 
Methods inherited from class gov.nasa.arc.brahms.common.data.Attribute
getScope, getType, setOwner, setScope, setType
 
Methods inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
getDisplayText, getName, getOwner, setDisplayText, setFullyQualifiedName, setName, setOwner, toString
 
Methods inherited from class gov.nasa.arc.brahms.common.data.BrahmsObject
delete, export, getFile, getID, getLine, getSerialNumber, isBCC, isDynamic, isLoaded, isResolved, setBCC, setDynamic, setFile, setID, setLine, setLoaded, setResolved, setSerialNumber
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaProperty

public JavaProperty()
Constructs a new empty JavaProperty instance


JavaProperty

public JavaProperty(java.lang.String name,
                    java.lang.Class<?> valueClass)
Constructs a new JavaProperty instance with a given name and Class of allowable values

Parameters:
name - the String name of the property
valueClass - the Class object representing the type of allowed values

JavaProperty

public JavaProperty(java.lang.String file,
                    int line)
Constructs a new empty JavaProperty instance for an occurrence of the property in a source file at a particular line

Parameters:
file - the source file containing the occurrence
line - the line containing the occurrence

JavaProperty

public JavaProperty(java.lang.String name,
                    JavaType owner,
                    java.lang.String file,
                    int line)
Constructs a new JavaProperty instance representing a named property of a Java class

Parameters:
name - the name of the property
owner - a JavaType representing the owning class
file - the source file containing the occurrence
line - the line containing the occurrence
Method Detail

getInstance

public static JavaProperty getInstance(java.lang.String name,
                                       java.lang.Class<?> valueClass)
Returns a JavaProperty instance with a given name and Class of values. If there is an existing instance with the name and Class it will be returned; otherwise a new JavaProperty instance will be crwated and indexed.

Parameters:
name - the name of the java property
valueClass - the Java Class object representing the class of allowed values for the property
Returns:
JavaProperty a Java property attribute with the same name and Class of values

setID

protected void setID()
Sets the unique identifier for the property.

Overrides:
setID in class Attribute

getOwnerType

public JavaType getOwnerType()
Returns a JavaType representing the Java class that has the property

Returns:
JavaType the Java class with this property

setOwnerType

public void setOwnerType(JavaType type)
Sets the JavaType representing the Java class that has the property

Parameters:
type - the JavaType for the owner class

getValueClass

public java.lang.Class<?> getValueClass()
Returns the Java Class object for the type of values of the property

Returns:
Class<?> the Class of values for the property

getValue

public java.lang.Object getValue(java.lang.Object object)
                          throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Retrieves the value of the Java property from a given Java object

Parameters:
object - the Java object whose property is to be retrieved
Returns:
Object the value of the property for the object
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there is an error getting the value of the property

setValue

public void setValue(java.lang.Object object,
                     java.lang.Object value)
              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the value of the Java property for a given Java object

Parameters:
object - the Java object whose property is to be set
value - the new value to be given to the property
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there is an error setting the value of the property

getFullyQualifiedName

public java.lang.String getFullyQualifiedName()
Returns the fully qualified name of the Java property. The fully qualified name of a Java property is the signature of its owning Java type followed by the property name.

Overrides:
getFullyQualifiedName in class Attribute
Returns:
String the fully qualified name

equals

public boolean equals(java.lang.Object obj)
Tests whether two Java properties are the same. Two properties are regarded as the same if they have the same name and either have the same owning Java class (if it is specified) or the same class of values.

Overrides:
equals in class Attribute
Parameters:
obj - the Object to be compared for equality
Returns:
true if the Java properties are equal, false otherwise

hashCode

public int hashCode()
Returns a hash code value for the object. See Object.hashCode() for a complete description.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.


Copyright © 1997-2012 All Rights Reserved.