public class JdapiMetaProperty
extends java.lang.Object
JdapiMetaObject
which is in turn obtained
from a given Forms object.
JdapiMetaProperty also has some static utility methods for inspecting any property
(usually by constant value). These methods allow you to
obtain, for example, the name of the property, a phrase that describes the property,
its allowed values, and its type. It also has non-static methods that allow you to obtain the
property ID, and whether the property can be set or only read.
For example, the following code sample casts
a given string property to the more generic JdapiMetaProperty. This allows the
methods allowGet
and getPropertyId
to be used:
... while (stringProps.hasNext()) { JdapiMetaProperty prop = (JdapiMetaProperty)stringProps.next(); if (prop.allowGet()) { // this line returns the equivalent value to the JdapiTypes._PTID constant int propNum = prop.getPropertyID(); System.out.println( "Property No. " + propNum + " has value " + jo.getStringProperty(propNum)); } }
Constructor and Description |
---|
JdapiMetaProperty(int propId,
boolean get,
boolean set,
int[] allowedValues)
Package constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allowGet()
Returns whether the property value can be retrieved.
|
boolean |
allowSet()
Returns whether the property value can be set.
|
int[] |
getAllowedValues()
Returns an array of valid values for numeric Forms properties that
are really enumerated properties
If this method is applied
to a non-numeric enumerated property, it returns "null".
|
static int[] |
getAllowedValues(int propertyId)
Returns an array of valid values for numeric Forms properties that
are really enumerated properties
If this method is applied
to a non-numeric enumerated property, it returns "null".
|
static java.lang.String |
getPropertyConstantName(int propertyTypeId)
Returns the property name for a given property type ID.
|
static int |
getPropertyConstantValue(java.lang.String pname)
Returns the property number (propertyTypeId) for a named property.
|
java.lang.String |
getPropertyDescription()
Returns the description of the property.
|
static java.lang.String |
getPropertyDescription(int propertyTypeId)
Returns the description of the property.
|
int |
getPropertyId()
Returns the D2FP_x Forms ID integer of this property.
|
static int |
getPropertyId(java.lang.String propertyName)
Returns the property ID for a property given the Jdapi name.
|
java.lang.String |
getPropertyName()
Returns the Jdapi name for a given property.
|
static java.lang.String |
getPropertyName(int propertyTypeId)
Returns the Jdapi name for a given property.
|
java.lang.Class |
getPropertyType()
Returns the datatype (class) of the property.
|
static java.lang.Class |
getPropertyType(int propertyTypeId)
Returns the datatype (class) of the property.
|
static java.lang.String |
getPropertyValueName(int propertyTypeId,
int val)
Returns the string representation of a given property's value.
|
static int |
getPropertyValueValue(int propertyTypeId,
java.lang.String name)
Returns the numeric value for a given property's string representation for that value.
|
JdapiMetaProperty(int propId, boolean get, boolean set, int[] allowedValues)
propId
- D2FP_x Forms Id of this propertyget
- Do we allow getsset
- Do we allow setsallowedValues
- Array of allowed values for enumerated
properties, 'null' if not applicable.public int getPropertyId()
public boolean allowGet()
public boolean allowSet()
public int[] getAllowedValues()
public java.lang.String getPropertyName()
Item
object. For the static version
of this method, see getPropertyName(int propertyTypeId)
.public java.lang.Class getPropertyType()
getPropertyType(int propertyTypeId)
.public java.lang.String getPropertyDescription()
public static java.lang.Class getPropertyType(int propertyTypeId)
getPropertyType()
.propertyTypeId
- the number that identifies the property.public static java.lang.String getPropertyDescription(int propertyTypeId)
getPropertyDescription()
.propertyTypeId
- the number that identifies the property.public static java.lang.String getPropertyName(int propertyTypeId)
Item
object. For the non-static version
of this method, see getPropertyName()
.propertyTypeId
- the property type ID that identifies the property.public static int getPropertyId(java.lang.String propertyName)
Item
object) to obtain the corresponding
integer property ID.propertyName
- the Jdapi name of a property.public static int[] getAllowedValues(int propertyId)
propertyId
- the property ID that identifies the propertypublic static java.lang.String getPropertyValueName(int propertyTypeId, int val)
getAllowedValues
to an enumerated property to get the integer
values which the property can have. Then pass the property's type ID and the integer values to
this method to return the names associated with the values.propertyTypeId
- the property number.val
- the integer value of property.public static int getPropertyValueValue(int propertyTypeId, java.lang.String name)
propertyTypeId
- the property number.name
- String representation of the property associated with val.public static int getPropertyConstantValue(java.lang.String pname)
getPropertyConstantName
or by
removing the D2FP_ prefix from the C Forms API #defines.pname
- the name of the property.public static java.lang.String getPropertyConstantName(int propertyTypeId)
getPropertyName
but in a different style.
It is recommended that you use getPropertyName instead.propertyTypeId
- the property ID number.