类 StringSwitcher
- java.lang.Object
-
- net.sf.cglib.util.StringSwitcher
-
public abstract class StringSwitcher extends java.lang.ObjectThis class implements a simple String->int mapping for a fixed set of keys.
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classStringSwitcher.Generator
-
构造器概要
构造器 限定符 构造器 说明 protectedStringSwitcher()
-
-
-
方法详细资料
-
create
public static StringSwitcher create(java.lang.String[] strings, int[] ints, boolean fixedInput)
Helper method to create a StringSwitcher. For finer control over the generated instance, use a new instance of StringSwitcher.Generator instead of this static method.- 参数:
strings- the array of String keys; must be the same length as the value arrayints- the array of integer results; must be the same length as the key arrayfixedInput- if false, an unknown key will be returned fromintValue(java.lang.String)as-1; if true, the result will be undefined, and the resulting code will be faster
-
intValue
public abstract int intValue(java.lang.String s)
Return the integer associated with the given key.- 参数:
s- the key- 返回:
- the associated integer value, or
-1if the key is unknown (unlessfixedInputwas specified when thisStringSwitcherwas created, in which case the return value for an unknown key is undefined)
-
-