Class JdapiMetaProperty

java.lang.Object
oracle.forms.jdapi.JdapiMetaProperty

public class JdapiMetaProperty extends Object
The class JdapiMetaProperty represents the metadata for a given property, obtained from a given 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.<prop>_PTID constant
        int propNum = prop.getPropertyID();
        System.out.println(
            "Property No. " + propNum + " has value " + jo.getStringProperty(propNum));
      }
    }
 
  • Method Details

    • getPropertyId

      public int getPropertyId()
      Returns the D2FP_x Forms ID integer of this property.
      Returns:
      the D2FP_x Forms ID of this property.
    • allowGet

      public boolean allowGet()
      Returns whether the property value can be retrieved.
      Returns:
      true if the property can be retrieved; false otherwise.
    • allowSet

      public boolean allowSet()
      Returns whether the property value can be set.
      Returns:
      true if the property value can be set; false otherwise.
    • getAllowedValues

      public 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".
      Returns:
      an array of valid values or "null" if the method is not applicable to the property.
    • getPropertyName

      public String getPropertyName()
      Returns the Jdapi name for a given property. Examples of Jdapi names would be Name and DataSourceBlock which are associated with the Forms Item object. For the static version of this method, see getPropertyName(int propertyTypeId).
      Returns:
      the Jdapi name of the property.
    • getPropertyType

      public Class getPropertyType()
      Returns the datatype (class) of the property. The datatype can be Boolean, Integer, String, or JdapiObjectChildIterator. For the static version of this method see getPropertyType(int propertyTypeId).
      Returns:
      the datatype as a class: Boolean, Integer, String, or JdapiObjectChildIterator.
    • getPropertyDescription

      public String getPropertyDescription()
      Returns the description of the property. Each property can have a short descriptive phrase associated with it. This method returns that phrase.
      Returns:
      a string description of property.
    • getPropertyType

      public static Class getPropertyType(int propertyTypeId)
      Returns the datatype (class) of the property. The datatype can be Boolean, Integer, String, or JdapiObjectChildIterator. For the non-static version of this method see getPropertyType().
      Parameters:
      propertyTypeId - the number that identifies the property.
      Returns:
      the datatype as a class: Boolean, Integer, String, or JdapiObject.
    • getPropertyDescription

      public static String getPropertyDescription(int propertyTypeId)
      Returns the description of the property. Each property can have a short descriptive phrase associated with it. This method returns that phrase. For the non-static version of this method, see getPropertyDescription().
      Parameters:
      propertyTypeId - the number that identifies the property.
      Returns:
      a string description of property.
    • getPropertyName

      public static String getPropertyName(int propertyTypeId)
      Returns the Jdapi name for a given property. Examples of Jdapi names would be Name and DataSourceBlock which are associated with the Forms Item object. For the non-static version of this method, see getPropertyName().
      Parameters:
      propertyTypeId - the property type ID that identifies the property.
      Returns:
      the Jdapi name of the property that corresponds to the property type ID.
    • getPropertyId

      public static int getPropertyId(String propertyName)
      Returns the property ID for a property given the Jdapi name. For example, this method could be given the given the Name and DataSourceBlock Jdapi names (which are associated with the Forms Item object) to obtain the corresponding integer property ID.
      Parameters:
      propertyName - the Jdapi name of a property.
      Returns:
      propertyTypeId the integer corresponding to the property.
    • getAllowedValues

      public 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".
      Parameters:
      propertyId - the property ID that identifies the property
      Returns:
      an array of valid values or "null" if the method is not applicable to the property.
    • getPropertyValueName

      public static String getPropertyValueName(int propertyTypeId, int val)
      Returns the string representation of a given property's value. For example, you could apply 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.
      Parameters:
      propertyTypeId - the property number.
      val - the integer value of property.
      Returns:
      String representation of the property associated with val.
    • getPropertyValueValue

      public static int getPropertyValueValue(int propertyTypeId, String name)
      Returns the numeric value for a given property's string representation for that value. This is the opposite of method getPropertyValueName.
      Parameters:
      propertyTypeId - the property number.
      name - String representation of the property associated with val.
      Returns:
      val the integer value of property.
    • getPropertyConstantValue

      public static int getPropertyConstantValue(String pname)
      Returns the property number (propertyTypeId) for a named property. Property names (pname) can be found using getPropertyConstantName or by removing the D2FP_ prefix from the C Forms API #defines.
      Parameters:
      pname - the name of the property.
      Returns:
      the property number.
    • getPropertyConstantName

      public static String getPropertyConstantName(int propertyTypeId)
      Returns the property name for a given property type ID. This method returns the same name as getPropertyName but in a different style. It is recommended that you use getPropertyName instead.
      Parameters:
      propertyTypeId - the property ID number.
      Returns:
      the property name in the style of the C API #define, but without the D2FP_ prefix.