org.autosemantix
Class NameValidator

java.lang.Object
  extended byorg.autosemantix.NameValidator

public class NameValidator
extends java.lang.Object

This class is responsible for defining which names are valid class and attribute names in Java. If an invlid name is detected, this class can convert it to an acceptable one which is still easily identifiable and easy to read.

Version:
Created Jul 31, 2005
Author:
Shawn Simister

Constructor Summary
NameValidator()
           
 
Method Summary
static java.lang.String getGetterMethodName(EStructuralFeature feature)
          Get an appropriate getter method name for the given attribute.
static java.lang.String getSetterMethodName(EStructuralFeature feature)
          Get an appropriate setter method name for the given attribute.
static java.lang.String getValidAttributeName(java.lang.String name)
          Converts an invalid attribute name to a valid one.
static java.lang.String getValidClassName(java.lang.String name)
          Converts an invalid class name to a valid one.
static boolean isValid(java.lang.String name)
          Validates names to determine whether they are valid Java class or attribute names.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NameValidator

public NameValidator()
Method Detail

getGetterMethodName

public static java.lang.String getGetterMethodName(EStructuralFeature feature)
Get an appropriate getter method name for the given attribute.

Parameters:
feature - The attribute to be accessed by the getter method.
Returns:
A method name for the getter method.

getSetterMethodName

public static java.lang.String getSetterMethodName(EStructuralFeature feature)
Get an appropriate setter method name for the given attribute.

Parameters:
feature - The attribute to be modified by the setter method.
Returns:
A method name for the setter method.

isValid

public static boolean isValid(java.lang.String name)
Validates names to determine whether they are valid Java class or attribute names.

Parameters:
name - The name to be validated.
Returns:
Whether the name is valid.
See Also:
NameValidator#validate(String)

getValidAttributeName

public static java.lang.String getValidAttributeName(java.lang.String name)
Converts an invalid attribute name to a valid one.

Parameters:
name - The invalid name.
Returns:
A valid Java name equivalent to the original.
See Also:
isValid(String)

getValidClassName

public static java.lang.String getValidClassName(java.lang.String name)
Converts an invalid class name to a valid one.

Parameters:
name - The invalid name.
Returns:
A valid Java name equivalent to the original.
See Also:
isValid(String)