public static class StringSwitcher.Generator extends AbstractClassGenerator
AbstractClassGenerator.Source
Constructor and Description |
---|
StringSwitcher.Generator() |
Modifier and Type | Method and Description |
---|---|
StringSwitcher |
create()
Generate the
StringSwitcher . |
protected Object |
firstInstance(Class type) |
void |
generateClass(ClassVisitor v) |
protected ClassLoader |
getDefaultClassLoader() |
protected Object |
nextInstance(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(String[] strings)
Set the array of recognized Strings.
|
create, getAttemptLoad, getClassLoader, getClassName, getCurrent, getNamingPolicy, getStrategy, getUseCache, setAttemptLoad, setClassLoader, setNamePrefix, setNamingPolicy, setStrategy, setUseCache
public void setStrings(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 ClassLoader getDefaultClassLoader()
getDefaultClassLoader
in class AbstractClassGenerator
public StringSwitcher create()
StringSwitcher
.public void generateClass(ClassVisitor v) throws Exception
Exception
protected Object firstInstance(Class type)
firstInstance
in class AbstractClassGenerator
protected Object nextInstance(Object instance)
nextInstance
in class AbstractClassGenerator
Copyright © 2016. All rights reserved.