org.enhydra.zeus.util
Class Verifier

java.lang.Object
  |
  +--org.enhydra.zeus.util.Verifier

public class Verifier
extends java.lang.Object

Verifier is a Zeus utility class that checks whether identifiers violate naming rules as defined by the Java language specification. Verifier applies conversions to such names (i.e. names that clash with Java reserved words, or names that use illegal characters). It's assumed that the names being checked are valid XML names, which limits the amount of checking to be done.

Version:
1.0
Author:
Robert Sese

Field Summary
static java.lang.String DEFAULT_MAPPING
          The default alternative representation for illegal characters.
static java.lang.String XML_PREFIX
          Prefix to append to names that clash with Java reserved words.
 
Method Summary
static java.lang.String getCharMapping(java.lang.Character key)
           Returns the value that the given key is mapped to.
static void setCharMapping(java.lang.Character key, java.lang.String value)
           Maps the given key to the given value.
static java.lang.String verify(java.lang.String name)
           Verifies whether the given name is a valid Java identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_PREFIX

public static final java.lang.String XML_PREFIX
Prefix to append to names that clash with Java reserved words.

DEFAULT_MAPPING

public static final java.lang.String DEFAULT_MAPPING
The default alternative representation for illegal characters.
Method Detail

getCharMapping

public static java.lang.String getCharMapping(java.lang.Character key)

Returns the value that the given key is mapped to. This value will replace any occurence of the key when verify(String) is called.

Parameters:
key - the key mapped to the value to return.
Returns:
String - the value the given key is mapped to.

setCharMapping

public static void setCharMapping(java.lang.Character key,
                                  java.lang.String value)

Maps the given key to the given value. This value will replace any occurence of the key when verify(String) is called.

Parameters:
key - the key to map the given value to.
value - the value to map the given key to.

verify

public static java.lang.String verify(java.lang.String name)

Verifies whether the given name is a valid Java identifier. If it is, the name is returned unchanged, else it is returned in a converted form that is a valid Java identifier.

Parameters:
name - the name to check.
Returns:
String - the converted name if it is not a valid Java identifier, else the same name.


Copyright © 2001 Enhydra. All Rights Reserved.