Class stringswitcher
java.lang.Object
org.springframework.cglib.util.stringswitcher
This class implements a simple string → int mapping for a fixed set of keys.
-
Nested Class summary
Nested Classes -
Constructor summary
Constructors -
Method summary
Modifier and TypeMethodDescriptionstatic stringswitcherHelper method to create a stringswitcher.abstract intReturn the integer associated with the given key.
-
Constructor Details
-
stringswitcher
protected stringswitcher()
-
-
Method Details
-
create
public static stringswitcher create(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.- Parameters:
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(string)as-1; if true, the result will be undefined, and the resulting code will be faster
-
intValue
Return the integer associated with the given key.- Parameters:
s- the key- Returns:
- 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)
-