public static class StringSwitcher.Generator extends AbstractClassGenerator
AbstractClassGenerator.ClassLoaderData, AbstractClassGenerator.Source
Modifier and Type | Field and Description |
---|---|
private boolean |
fixedInput |
private int[] |
ints |
private static AbstractClassGenerator.Source |
SOURCE |
private java.lang.String[] |
strings |
Constructor and Description |
---|
Generator() |
Modifier and Type | Method and Description |
---|---|
StringSwitcher |
create()
Generate the
StringSwitcher . |
protected java.lang.Object |
firstInstance(java.lang.Class type) |
void |
generateClass(org.objectweb.asm.ClassVisitor v) |
protected java.lang.ClassLoader |
getDefaultClassLoader() |
protected java.lang.Object |
nextInstance(java.lang.Object instance) |
void |
setFixedInput(boolean fixedInput)
Configure how unknown String keys will be handled.
|
void |
setInts(int[] ints)
Set the array of integer results.
|
void |
setStrings(java.lang.String[] strings)
Set the array of recognized Strings.
|
create, generate, getAttemptLoad, getClassLoader, getClassName, getCurrent, getNamingPolicy, getProtectionDomain, getStrategy, getUseCache, setAttemptLoad, setClassLoader, setNamePrefix, setNamingPolicy, setStrategy, setUseCache, unwrapCachedValue, wrapCachedClass
private static final AbstractClassGenerator.Source SOURCE
private java.lang.String[] strings
private int[] ints
private boolean fixedInput
public void setStrings(java.lang.String[] strings)
strings
- the array of String keys; must be the same length as the value arraysetInts(int[])
public void setInts(int[] ints)
ints
- the array of integer results; must be the same length as the key arraysetStrings(java.lang.String[])
public void setFixedInput(boolean fixedInput)
fixedInput
- if false, an unknown key will be returned from StringSwitcher.intValue(java.lang.String)
as -1
; if true,
the result will be undefined, and the resulting code will be fasterprotected java.lang.ClassLoader getDefaultClassLoader()
getDefaultClassLoader
in class AbstractClassGenerator
public StringSwitcher create()
StringSwitcher
.public void generateClass(org.objectweb.asm.ClassVisitor v) throws java.lang.Exception
java.lang.Exception
protected java.lang.Object firstInstance(java.lang.Class type)
firstInstance
in class AbstractClassGenerator
protected java.lang.Object nextInstance(java.lang.Object instance)
nextInstance
in class AbstractClassGenerator