ix.util.reflect
Class DashSyntaxClassFinder
java.lang.Object
ix.util.reflect.ClassFinder
ix.util.reflect.DashSyntaxClassFinder
public class DashSyntaxClassFinder
- extends ClassFinder
A translator between names and classes that uses lower-case
names and separates words within names with dashes.
Method Summary |
protected void |
cacheBothWays(java.lang.String name,
java.lang.Class c)
Caches the mapping from name to class and from class to name. |
java.lang.String |
externalName(java.lang.String javaName)
Returns the dash-syntax name that corresponds to a Java name. |
java.lang.String |
javaFieldName(java.lang.String externalName)
Returns the Java name that corresponds to an external field name. |
java.lang.String |
javaName(java.lang.String externalName)
Returns the Java name that corresponds to an dash-syntax name. |
static void |
main(java.lang.String[] argv)
Simple main program for testing. |
Methods inherited from class ix.util.reflect.ClassFinder |
addImport, addInitialImports, addInitialNames, addName, classForName, classHasShortName, do_main, externalFieldName, findImportClass, nameForClass, preLoad, tryClassForName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DashSyntaxClassFinder
public DashSyntaxClassFinder()
DashSyntaxClassFinder
public DashSyntaxClassFinder(ClassFinder base)
javaName
public java.lang.String javaName(java.lang.String externalName)
- Returns the Java name that corresponds to an dash-syntax name.
- Overrides:
javaName
in class ClassFinder
javaFieldName
public java.lang.String javaFieldName(java.lang.String externalName)
- Returns the Java name that corresponds to an external field name.
- Overrides:
javaFieldName
in class ClassFinder
externalName
public java.lang.String externalName(java.lang.String javaName)
- Returns the dash-syntax name that corresponds to a Java name.
- Overrides:
externalName
in class ClassFinder
cacheBothWays
protected void cacheBothWays(java.lang.String name,
java.lang.Class c)
- Description copied from class:
ClassFinder
- Caches the mapping from name to class and from class to name.
This method must be used with care, because it's possible
for more than one name to map to the same class: for example,
a fully-qualified name, and a short, packageless name.
There may even be more than one short name that works.
A ClassFinder that has lower-case (e.g. "dash-syntax") external
names may convert to Java names by capitalizing some letters,
but leaving any existing capitals in place. It might thus
accept both "Issue" and "issue".
- Overrides:
cacheBothWays
in class ClassFinder
main
public static void main(java.lang.String[] argv)
- Simple main program for testing. This method calls
ClassFinder.do_main(ClassFinder)
with an instance of
this class as the finder.