Class ReflectionMap.Builder<V>
- Type Parameters:
V- The type of values stored in this map.
- Direct Known Subclasses:
DebugEnablementMap.Builder
- Enclosing class:
- ReflectionMap<V>
ReflectionMap instances.
Example:
ReflectionMap<String>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds one or more mappings to this builder.build()Builds a newReflectionMapfrom the current state of this builder.
-
Constructor Details
-
Builder
protected Builder()Constructor.
-
-
Method Details
-
append
Adds one or more mappings to this builder.This method accepts pattern strings that identify classes, methods, fields, or constructors, and associates them with the specified value. Multiple patterns can be specified in a single key using comma-delimited format.
Example:
Builder<String>
builder = ReflectionMap.create (String.class );// Map a class builder .append("com.foo.MyClass" ,"classValue" );// Map a specific method builder .append("MyClass.myMethod(String,int)" ,"methodValue" );// Map multiple patterns at once builder .append("MyClass.field1, MyClass.field2, MyClass.field3" ,"fieldValue" );- Parameters:
key- The mapping key pattern(s).
Can be any of the following:- Fully qualified class name (e.g.,
"com.foo.MyClass" ) - Simple class name (e.g.,
"MyClass" ) - All classes wildcard (e.g.,
"*" ) - Method with signature (e.g.,
"com.foo.MyClass.myMethod(String,int)" ) - Method without signature (e.g.,
"MyClass.myMethod" ) - matches any signature - Field (e.g.,
"MyClass.myField" ) - Constructor (e.g.,
"MyClass(String,int)" ) - Comma-delimited list of any of the above (e.g.,
"MyClass, MyClass.method1, MyClass.field1" )
- Fully qualified class name (e.g.,
value- The value to associate with the matching reflection element(s).
Can benull .- Returns:
- This object.
- Throws:
RuntimeException- If the key pattern is invalid or empty.
-
build
Builds a newReflectionMapfrom the current state of this builder.Multiple calls to this method will create independent copies of the map.
- Returns:
- A new immutable
ReflectionMapinstance.
-