Package org.apache.juneau.utils
Class ReflectionMap<V>
java.lang.Object
org.apache.juneau.utils.ReflectionMap<V>
- Type Parameters:
V
- The type of object in this map.
- Direct Known Subclasses:
DebugEnablementMap
Allows arbitrary objects to be mapped to classes and methods base on class/method name keys.
The valid pattern matches are:
- Classes:
- Fully qualified:
"com.foo.MyClass"
- Fully qualified inner class:
"com.foo.MyClass$Inner1$Inner2"
- Simple:
"MyClass"
- Simple inner:
"MyClass$Inner1$Inner2" "Inner1$Inner2" "Inner2"
- Fully qualified:
- Methods:
- Fully qualified with args:
"com.foo.MyClass.myMethod(String,int)" "com.foo.MyClass.myMethod(java.lang.String,int)" "com.foo.MyClass.myMethod()"
- Fully qualified:
"com.foo.MyClass.myMethod"
- Simple with args:
"MyClass.myMethod(String,int)" "MyClass.myMethod(java.lang.String,int)" "MyClass.myMethod()"
- Simple:
"MyClass.myMethod"
- Simple inner class:
"MyClass$Inner1$Inner2.myMethod" "Inner1$Inner2.myMethod" "Inner2.myMethod"
- Fully qualified with args:
- Fields:
- Fully qualified:
"com.foo.MyClass.myField"
- Simple:
"MyClass.myField"
- Simple inner class:
"MyClass$Inner1$Inner2.myField" "Inner1$Inner2.myField" "Inner2.myField"
- Fully qualified:
- Constructors:
- Fully qualified with args:
"com.foo.MyClass(String,int)" "com.foo.MyClass(java.lang.String,int)" "com.foo.MyClass()"
- Simple with args:
"MyClass(String,int)" "MyClass(java.lang.String,int)" "MyClass()"
- Simple inner class:
"MyClass$Inner1$Inner2()" "Inner1$Inner2()" "Inner2()"
- Fully qualified with args:
- A comma-delimited list of anything on this list.
See Also:
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionV[]
Finds all values in this map that matches the specified class.V[]
appendAll
(Constructor<?> c, Class<? extends V> ofType, V[] array) Finds all values in this map that matches the specified constructor.V[]
Finds all values in this map that matches the specified field.V[]
Finds all values in this map that matches the specified method.static <V> ReflectionMap.Builder<V>
Static builder creator.Finds first value in this map that matches the specified class.Finds first value in this map that matches the specified class.find
(Constructor<?> c) Finds first value in this map that matches the specified constructor.find
(Constructor<?> c, Class<? extends V> ofType) Finds first value in this map that matches the specified constructor.Finds first value in this map that matches the specified field.Finds first value in this map that matches the specified field.Finds first value in this map that matches the specified method.Finds first value in this map that matches the specified method.Finds all values in this map that matches the specified class.Finds all values in this map that matches the specified class.findAll
(Constructor<?> c) Finds all values in this map that matches the specified constructor.findAll
(Constructor<?> c, Class<? extends V> ofType) Finds all values in this map that matches the specified constructor.Finds all values in this map that matches the specified field.Finds all values in this map that matches the specified field.Finds all values in this map that matches the specified method.Finds all values in this map that matches the specified method.toString()
-
Constructor Details
-
ReflectionMap
Constructor.- Parameters:
b
- Initializer object.
-
-
Method Details
-
create
Static builder creator.- Type Parameters:
V
- The type of object in this map.- Parameters:
c
- The type of object in this map.- Returns:
- A new instance of this object.
-
find
Finds first value in this map that matches the specified class.- Parameters:
c
- The class to test for.ofType
- Only return objects of the specified type.- Returns:
- The matching object. Never
null .
-
find
Finds first value in this map that matches the specified class.- Parameters:
c
- The class to test for.- Returns:
- The matching object. Never
null .
-
findAll
Finds all values in this map that matches the specified class.- Parameters:
c
- The class to test for.ofType
- Only return objects of the specified type.- Returns:
- A modifiable list of matching values. Never
null .
-
findAll
Finds all values in this map that matches the specified class.- Parameters:
c
- The class to test for.- Returns:
- A modifiable list of matching values. Never
null .
-
appendAll
Finds all values in this map that matches the specified class.- Parameters:
c
- The class to test for.ofType
- Only return objects of the specified type.array
- The array to append values to.- Returns:
- The same list passed in or a new modifiable list if
null .
-
find
Finds first value in this map that matches the specified method.- Parameters:
m
- The method to test for.ofType
- Only return objects of the specified type.- Returns:
- The matching object. Never
null .
-
find
Finds first value in this map that matches the specified method.- Parameters:
m
- The method to test for.- Returns:
- The matching object. Never
null .
-
findAll
Finds all values in this map that matches the specified method.- Parameters:
m
- The method to test for.ofType
- Only return objects of the specified type.- Returns:
- A modifiable list of matching values. Never
null .
-
findAll
Finds all values in this map that matches the specified method.- Parameters:
m
- The method to test for.- Returns:
- A modifiable list of matching values. Never
null .
-
appendAll
Finds all values in this map that matches the specified method.- Parameters:
m
- The method to test for.ofType
- Only return objects of the specified type.array
- The array to append values to.- Returns:
- The same list passed in or a new modifiable list if
null .
-
find
Finds first value in this map that matches the specified field.- Parameters:
f
- The field to test for.ofType
- Only return objects of the specified type.- Returns:
- The matching object. Never
null .
-
find
Finds first value in this map that matches the specified field.- Parameters:
f
- The field to test for.- Returns:
- The matching object. Never
null .
-
findAll
Finds all values in this map that matches the specified field.- Parameters:
f
- The field to test for.ofType
- Only return objects of the specified type.- Returns:
- A modifiable list of matching values. Never
null .
-
findAll
Finds all values in this map that matches the specified field.- Parameters:
f
- The field to test for.- Returns:
- A modifiable list of matching values. Never
null .
-
appendAll
Finds all values in this map that matches the specified field.- Parameters:
f
- The field to test for.ofType
- Only return objects of the specified type.array
- The array to append values to.- Returns:
- The same list passed in or a new modifiable list if
null .
-
find
Finds first value in this map that matches the specified constructor.- Parameters:
c
- The constructor to test for.ofType
- Only return objects of the specified type.- Returns:
- The matching object. Never
null .
-
find
Finds first value in this map that matches the specified constructor.- Parameters:
c
- The constructor to test for.- Returns:
- The matching object. Never
null .
-
findAll
Finds all values in this map that matches the specified constructor.- Parameters:
c
- The constructor to test for.ofType
- Only return objects of the specified type.- Returns:
- A modifiable list of matching values. Never
null .
-
findAll
Finds all values in this map that matches the specified constructor.- Parameters:
c
- The constructor to test for.- Returns:
- A modifiable list of matching values. Never
null .
-
appendAll
Finds all values in this map that matches the specified constructor.- Parameters:
c
- The constructor to test for.ofType
- Only return objects of the specified type.array
- The array to append values to.- Returns:
- The same list passed in or a new modifiable list if
null .
-
toString
-