Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.wli.worklist.build
Class ControlGeneratorUtility

    java.lang.Object
      com.bea.wli.worklist.build.ControlGeneratorUtility

    public class ControlGeneratorUtility

extends Object

Utility methods for use by the control generator tool.

Field Summary
`static Set<String>` | `JAVA_KEY_RESERVED_WORDS`

Constructor Summary
`ControlGeneratorUtility()`

Method Summary
`static String` | `sanitizeName(String name)` Sanitize a user-defined name for use in Java code as an interface, method, enum, or parameter name.
`static String` | `sanitizeName(String name, Set<String> reservedWordsForContext, Set<String> existingNames)` Sanitize a user-defined name for use in Java code as an interface, method, enum, or parameter name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### JAVA_KEY_RESERVED_WORDS

    public static final Set<String> JAVA_KEY_RESERVED_WORDS

Constructor Detail

### ControlGeneratorUtility

    public ControlGeneratorUtility()

Method Detail

### sanitizeName

    public static String sanitizeName(String name)

  Sanitize a user-defined name for use in Java code as an interface, method, enum, or parameter name. The following rules are applied in order.
  1. Remove leading/trailing/internal whitespace
  2. If the name starts with any non-legal first character, the sanitized name will start with ‘x’
  3. Any invalid Java identifier character is replaced with ‘X’
  4. If the resulting name matches any Java reserved word, an ‘x’ is prepended to the name.

  Parameters:
    `name` - The user-defined name to be sanitized.
  Returns:
    The sanitized name suitable for use in Java code.

### sanitizeName

    public static String sanitizeName(String name,
                                      Set<String> reservedWordsForContext,
                                      Set<String> existingNames)

  Sanitize a user-defined name for use in Java code as an interface, method, enum, or parameter name. The following rules are applied in order.
  1. Remove leading/trailing/internal whitespace
  2. If the name starts with any non-legal first character, the sanitized name will start with ‘x’
  3. Any invalid Java identifier character is replaced with ‘X’
  4. If the resulting name matches any Java reserved word, an ‘x’ is prepended to the name.
  5. If the resulting name matches any reserved word for the current context (as determined by the reservedWordsForContext param), an ‘x’ is prepended to the name.
  6. If the resulting name matches an existing name, a numeric counter is appended to the resulting name

  Parameters:
    `name` - The user-defined name to be sanitized.
    `reservedWordsForContext` - A set of names (as Strings) that would be reserved (and therefore illegal as return values from this method) within the context from which this method is being called. For example, the caller could pass the names of system defined method or interfaces when trying to generate a sanitized name for a new method within the interface.
    `existingNames` - A set of names (as Strings) for existing elements of the same type as the element for which the sanitized name is being generated. For example, the caller might pass the names of existing methods when trying to generate a sanitized name for a new method.
  Returns:
    The sanitized name suitable for use in Java code.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD