|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sadun.util.codegen.VariableNameGenerator
A class to generate variable names depending on types.
Given a method name and a Java type, the generateNext()
method produces valid (i.e. compilable) sequences of variable names, depending on the passed type,
until either a different method name is passed or the reset()
method is invoked.
For example, the invocations:
generateNext("myMethod", t1); generateNext("myMethod", t2); generateNext("myMethod", t3);where t1=String, t2=int, t3=String will produce string1, i1, string2.
This generator supports both JDK1.3 and JDK1.4 keywords.
Field Summary | |
static int |
JDK1_3
Constant to use at construction to indicate JDK1_3 keyword compliance. |
static int |
JDK1_4
Constant to use at construction to indicate JDK1_4 keyword compliance. |
Constructor Summary | |
VariableNameGenerator()
Create a variable name generator for the JDK1_4 target compiler (see class constants). |
|
VariableNameGenerator(int jdkRelease)
Create a variable name generator for the given target compiler (see class constants). |
Method Summary | |
java.lang.String |
generateNext(java.lang.String methodName,
java.lang.Class type)
|
void |
reset()
Reset the name generator |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int JDK1_3
public static final int JDK1_4
Constructor Detail |
public VariableNameGenerator(int jdkRelease)
jdkRelease
- one of the JDK_x constants.public VariableNameGenerator()
Method Detail |
public void reset()
public java.lang.String generateNext(java.lang.String methodName, java.lang.Class type)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |