Package net.sf.cglib.util
Class StringSwitcher.Generator
- java.lang.Object
-
- net.sf.cglib.core.AbstractClassGenerator
-
- net.sf.cglib.util.StringSwitcher.Generator
-
- All Implemented Interfaces:
ClassGenerator
- Enclosing class:
- StringSwitcher
public static class StringSwitcher.Generator extends AbstractClassGenerator
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.cglib.core.AbstractClassGenerator
AbstractClassGenerator.ClassLoaderData, AbstractClassGenerator.Source
-
-
Field Summary
Fields Modifier and Type Field Description private booleanfixedInputprivate int[]intsprivate static AbstractClassGenerator.SourceSOURCEprivate java.lang.String[]strings
-
Constructor Summary
Constructors Constructor Description Generator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringSwitchercreate()Generate theStringSwitcher.protected java.lang.ObjectfirstInstance(java.lang.Class type)voidgenerateClass(org.objectweb.asm.ClassVisitor v)protected java.lang.ClassLoadergetDefaultClassLoader()protected java.lang.ObjectnextInstance(java.lang.Object instance)voidsetFixedInput(boolean fixedInput)Configure how unknown String keys will be handled.voidsetInts(int[] ints)Set the array of integer results.voidsetStrings(java.lang.String[] strings)Set the array of recognized Strings.-
Methods inherited from class net.sf.cglib.core.AbstractClassGenerator
create, generate, getAttemptLoad, getClassLoader, getClassName, getCurrent, getNamingPolicy, getProtectionDomain, getStrategy, getUseCache, setAttemptLoad, setClassLoader, setNamePrefix, setNamingPolicy, setStrategy, setUseCache, unwrapCachedValue, wrapCachedClass
-
-
-
-
Field Detail
-
SOURCE
private static final AbstractClassGenerator.Source SOURCE
-
strings
private java.lang.String[] strings
-
ints
private int[] ints
-
fixedInput
private boolean fixedInput
-
-
Method Detail
-
setStrings
public void setStrings(java.lang.String[] strings)
Set the array of recognized Strings.- Parameters:
strings- the array of String keys; must be the same length as the value array- See Also:
setInts(int[])
-
setInts
public void setInts(int[] ints)
Set the array of integer results.- Parameters:
ints- the array of integer results; must be the same length as the key array- See Also:
setStrings(java.lang.String[])
-
setFixedInput
public void setFixedInput(boolean fixedInput)
Configure how unknown String keys will be handled.- Parameters:
fixedInput- if false, an unknown key will be returned fromStringSwitcher.intValue(java.lang.String)as-1; if true, the result will be undefined, and the resulting code will be faster
-
getDefaultClassLoader
protected java.lang.ClassLoader getDefaultClassLoader()
- Specified by:
getDefaultClassLoaderin classAbstractClassGenerator
-
create
public StringSwitcher create()
Generate theStringSwitcher.
-
generateClass
public void generateClass(org.objectweb.asm.ClassVisitor v) throws java.lang.Exception- Throws:
java.lang.Exception
-
firstInstance
protected java.lang.Object firstInstance(java.lang.Class type)
- Specified by:
firstInstancein classAbstractClassGenerator
-
nextInstance
protected java.lang.Object nextInstance(java.lang.Object instance)
- Specified by:
nextInstancein classAbstractClassGenerator
-
-