public static class DynFields.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
<T> DynFields.UnboundField<T> |
build()
Returns the first valid implementation as a UnboundField or throws a
NoSuchFieldException if there is none.
|
<T> DynFields.BoundField<T> |
build(java.lang.Object target)
Returns the first valid implementation as a BoundMethod or throws a
RuntimeException if there is none.
|
<T> DynFields.UnboundField<T> |
buildChecked()
Returns the first valid implementation as a UnboundField or throws a
NoSuchFieldException if there is none.
|
<T> DynFields.BoundField<T> |
buildChecked(java.lang.Object target)
Returns the first valid implementation as a BoundMethod or throws a
NoSuchMethodException if there is none.
|
<T> DynFields.StaticField<T> |
buildStatic()
Returns the first valid implementation as a StaticField or throws a
RuntimeException if there is none.
|
<T> DynFields.StaticField<T> |
buildStaticChecked()
Returns the first valid implementation as a StaticField or throws a
NoSuchFieldException if there is none.
|
DynFields.Builder |
defaultAlwaysNull()
Instructs this builder to return AlwaysNull if no implementation is
found.
|
DynFields.Builder |
hiddenImpl(java.lang.Class<?> targetClass,
java.lang.String fieldName)
Checks for a hidden implementation.
|
DynFields.Builder |
hiddenImpl(java.lang.String className,
java.lang.String fieldName)
Checks for a hidden implementation, first finding the class by name.
|
DynFields.Builder |
impl(java.lang.Class<?> targetClass,
java.lang.String fieldName)
Checks for an implementation.
|
DynFields.Builder |
impl(java.lang.String className,
java.lang.String fieldName)
Checks for an implementation, first finding the class by name.
|
DynFields.Builder |
loader(java.lang.ClassLoader newLoader)
Set the
ClassLoader used to lookup classes by name. |
public DynFields.Builder loader(java.lang.ClassLoader newLoader)
ClassLoader used to lookup classes by name.
If not set, the current thread's ClassLoader is used.
newLoader - a ClassLoaderpublic DynFields.Builder defaultAlwaysNull()
public DynFields.Builder impl(java.lang.String className, java.lang.String fieldName)
className - name of a classfieldName - name of the fieldClass.forName(String),
Class.getField(String)public DynFields.Builder impl(java.lang.Class<?> targetClass, java.lang.String fieldName)
targetClass - a class instancefieldName - name of a field (different from constructor)Class.forName(String),
Class.getField(String)public DynFields.Builder hiddenImpl(java.lang.String className, java.lang.String fieldName)
className - name of a classfieldName - name of a field (different from constructor)Class.forName(String),
Class.getField(String)public DynFields.Builder hiddenImpl(java.lang.Class<?> targetClass, java.lang.String fieldName)
targetClass - a class instancefieldName - name of a field (different from constructor)Class.forName(String),
Class.getField(String)public <T> DynFields.UnboundField<T> buildChecked() throws java.lang.NoSuchFieldException
T - Java class stored in the fieldDynFields.UnboundField with a valid implementationjava.lang.NoSuchFieldException - if no implementation was foundpublic <T> DynFields.BoundField<T> buildChecked(java.lang.Object target) throws java.lang.NoSuchFieldException
T - Java class stored in the fieldtarget - an Object on which to get and set the fieldDynFields.BoundField with a valid implementation and targetjava.lang.IllegalStateException - if the method is staticjava.lang.IllegalArgumentException - if the receiver's class is incompatiblejava.lang.NoSuchFieldException - if no implementation was foundpublic <T> DynFields.UnboundField<T> build()
T - Java class stored in the fieldDynFields.UnboundField with a valid implementationjava.lang.RuntimeException - if no implementation was foundpublic <T> DynFields.BoundField<T> build(java.lang.Object target)
T - Java class stored in the fieldtarget - an Object on which to get and set the fieldDynFields.BoundField with a valid implementation and targetjava.lang.IllegalStateException - if the method is staticjava.lang.IllegalArgumentException - if the receiver's class is incompatiblejava.lang.RuntimeException - if no implementation was foundpublic <T> DynFields.StaticField<T> buildStaticChecked() throws java.lang.NoSuchFieldException
T - Java class stored in the fieldDynFields.StaticField with a valid implementationjava.lang.IllegalStateException - if the method is not staticjava.lang.NoSuchFieldException - if no implementation was foundpublic <T> DynFields.StaticField<T> buildStatic()
T - Java class stored in the fieldDynFields.StaticField with a valid implementationjava.lang.IllegalStateException - if the method is not staticjava.lang.RuntimeException - if no implementation was found