public class FieldUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FieldUtils.FieldSearchResult
Return type for
searchField(Class, String, ComponentLogger) |
| Constructor and Description |
|---|
FieldUtils() |
| Modifier and Type | Method and Description |
|---|---|
static FieldUtils.FieldSearchResult |
searchField(Class<?> componentClass,
String fieldName,
ComponentLogger logger)
Searches the field named
fieldName in the given
targetClass. |
static void |
setField(Field f,
Object component,
Object value,
ComponentLogger logger)
Set the field, type etc.
|
static String |
toString(Class<?> componentClass,
Field field)
Return a string representation of the field
|
public static FieldUtils.FieldSearchResult searchField(Class<?> componentClass, String fieldName, ComponentLogger logger)
fieldName in the given
targetClass. If the target class has no acceptable field
the class hierarchy is traversed until a field is found or the root
of the class hierarchy is reached without finding a field.
If an unexpected error occurs while searching, null is
returned. In all other cases a FieldSearchResult is
returned. If no field is found, FieldSearchResult#field
is set to null. If the field is found, but not usable
(e.g. due to visibility restrictions), FieldSearchResult#usable
is set to false.
targetClass - The class of the componentfieldName - The name of the fieldlogger - A logger to log errors / problemsnull if an unexpected
error occurred.public static String toString(Class<?> componentClass, Field field)
componentClass - The component classfield - The fieldpublic static void setField(Field f, Object component, Object value, ComponentLogger logger)
f - The fieldcomponent - The component instancevalue - The value to setlogger - The loggerCopyright © 2006–2020 The Apache Software Foundation. All rights reserved.