All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.graphics.components
Class ConstantCollection

    com.sas.graphics.components.ConstantCollection

    @SASScope(value="ALL")
    public class ConstantCollection

Constant collections are used to support a common set of static actions applied on constants defined in the com.sas.graphics.components package. These actions include:
(1) validation of public constant values
(2) translation between constant value and string value
(3) translation between constant value and JSP string value
(4) translation between constant value and localized string value
(5) generation of constant int or string arrays
Please note that the set of constants is defined at construction time and is immutable. The methods here, are a convenience for working with the constant values.

## Usage

If a com.sas.graphics.components class defines a set of constants then it is likely to also define an associated ConstantCollection to support the actions listed above on those constants. For example the com.sas.graphics.components.FillStyle class defines a set of constants for its fillType property (all having the FILL_TYPE prefix). The FillStyle class also defines a static ConstantCollection named FILL_TYPE to support the actions listed above being performed on this set of constants.

The methods toName, toJSPAttribute and toLocalizedName support the conversion of a constant value into its associated form.

The methods valueOfName, valueOfJSPAttribute and valueOfLocalizedName support the conversion from the identifed from back into its associated constant value.

The methods getConstants, getNames, getJSPAttributes and getLocalizedNames are a convenience to produce the specified set of constants as an array in the the desired form.

The methods validate and isValid verify whether or not a specified value is contained in the set of constants.

Since:
  SAS 9.1

Constructor Summary
`ConstantCollection(java.lang.Class rbClass, com.sas.graphics.components.ConstantCollection.Element[] elements)` Constructor used to specify a collection (an immutable set) of constant values.
`ConstantCollection(java.lang.Class rbClass, java.lang.String rbKey, com.sas.graphics.components.ConstantCollection.Element[] elements)` Constructor used to specify a collection (an immutable set) of constant values.

Method Summary
`int[]` | `getConstants()` Returns all the constants in this set as an int array.
`java.lang.String[]` | `getJSPAttributes()` Returns all the constants in this set in the form of a string JSP (Java Server Page)attribute name.
`java.lang.String[]` | `getLocalizedNames()` Returns all the constants in this set in the form of easily readable localized string names.
`java.lang.String[]` | `getNames()` Returns all the constants in this set in the form of a string name.
`boolean` | `isValid(int styleNum)` This method identifies by boolean value whether or not the specified value is contained in this set.
`java.lang.String` | `toJSPAttribute(int styleNum)` Provides a conversion from the JSP (Java Server Page) string attribute name representation to its int constant value.
`java.lang.String` | `toLocalizedName(int styleNum)` Provides a conversion from the localized string name representation to its int constant value.
`java.lang.String` | `toName(int styleNum)` Provides a conversion from the string name representation to its int constant value.
`void` | `validate(int styleNum)` This method will throw an IllegalArgument exception if the specified value is not one of the constants specified in this set.
`int` | `valueOfJSPAttribute(java.lang.String name)` Provides a conversion from the JSP (Java Server Page) string attribute name to the int constant value.
`int` | `valueOfLocalizedName(java.lang.String name)` Provides a conversion from the localized string name to the int constant value.
`int` | `valueOfName(java.lang.String name)` Provides a conversion from the string constant name form to the int constant value.

Constructor Detail

### ConstantCollection

    public ConstantCollection(java.lang.Class rbClass,
                              com.sas.graphics.components.ConstantCollection.Element[] elements)

  Constructor used to specify a collection (an immutable set) of constant values.

### ConstantCollection

    public ConstantCollection(java.lang.Class rbClass,
                              java.lang.String rbKey,
                              com.sas.graphics.components.ConstantCollection.Element[] elements)

  Constructor used to specify a collection (an immutable set) of constant values.

Method Detail

### validate

    public void validate(int styleNum)
                  throws java.lang.IllegalArgumentException

  This method will throw an IllegalArgument exception if the specified value is not one of the constants specified in this set.

  Throws:
    `an` - IllegalArgumentException is thrown if the specified value is not contained in the collection.
    `java.lang.IllegalArgumentException`

### isValid

    public boolean isValid(int styleNum)

  This method identifies by boolean value whether or not the specified value is contained in this set.

  Returns:
    true if `styleNum` is contained in this set.

### getConstants

    public int[] getConstants()

  Returns all the constants in this set as an int array.

  Returns:
    the set of constant values as an int array

### getNames

    public java.lang.String[] getNames()

  Returns all the constants in this set in the form of a string name.

  Returns:
    all the constants in this set in the form of a string name.

### getJSPAttributes

    public java.lang.String[] getJSPAttributes()

  Returns all the constants in this set in the form of a string JSP (Java Server Page)attribute name.

  Returns:
    all the constants in this set in the form of a string JSP (Java Server Page)attribute name.

### getLocalizedNames

    public java.lang.String[] getLocalizedNames()

  Returns all the constants in this set in the form of easily readable localized string names.

  Returns:
    all the constants in this set in the form of easily readable localized string names.

### toName

    public java.lang.String toName(int styleNum)
                            throws java.lang.IllegalArgumentException

  Provides a conversion from the string name representation to its int constant value.

  Returns:
    the specified constant value in the form of a localized string name.
  Throws:
    `an` - IllegalArgumentException is thrown if the specified value is not contained in the collection.
    `java.lang.IllegalArgumentException`

### toJSPAttribute

    public java.lang.String toJSPAttribute(int styleNum)
                                    throws java.lang.IllegalArgumentException

  Provides a conversion from the JSP (Java Server Page) string attribute name representation to its int constant value.

  Returns:
    the specified constant value in the form of a JSP (Java Server Page) string name.
  Throws:
    `an` - IllegalArgumentException is thrown if the specified value is not contained in the collection.
    `java.lang.IllegalArgumentException`

### toLocalizedName

    public java.lang.String toLocalizedName(int styleNum)
                                     throws java.lang.IllegalArgumentException

  Provides a conversion from the localized string name representation to its int constant value. localized string name.

  Returns:
    the specified constant value in the form of an easily readable localized string name.
  Throws:
    `an` - IllegalArgumentException is thrown if the specified value is not contained in the collection.
    `java.lang.IllegalArgumentException`

### valueOfName

    public int valueOfName(java.lang.String name)
                    throws java.lang.IllegalArgumentException

  Provides a conversion from the string constant name form to the int constant value.

  Returns:
    the constant value for the specified string name.
  Throws:
    `an` - IllegalArgumentException is thrown if the specified value is not recognised as belonging to this set of constants.
    `java.lang.IllegalArgumentException`

### valueOfJSPAttribute

    public int valueOfJSPAttribute(java.lang.String name)
                            throws java.lang.IllegalArgumentException

  Provides a conversion from the JSP (Java Server Page) string attribute name to the int constant value.

  Returns:
    the constant value for the specified string JSP attribute name.
  Throws:
    `an` - IllegalArgumentException is thrown if the specified value is not recognised as belonging to this set of constants.
    `java.lang.IllegalArgumentException`

### valueOfLocalizedName

    public int valueOfLocalizedName(java.lang.String name)
                             throws java.lang.IllegalArgumentException

  Provides a conversion from the localized string name to the int constant value.

  Returns:
    the constant value for the specified localized string name.
  Throws:
    `an` - IllegalArgumentException is thrown if the specified value is not recognised as belonging to this set of constants.
    `java.lang.IllegalArgumentException`

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.