Package org.apache.iceberg.common
Class DynFields.Builder
java.lang.Object
org.apache.iceberg.common.DynFields.Builder
- Enclosing class:
- DynFields
-
Method Summary
Modifier and TypeMethodDescription<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>Returns the first valid implementation as a BoundMethod or throws a RuntimeException if there is none.<T> DynFields.UnboundField<T>Returns the first valid implementation as a UnboundField or throws a NoSuchFieldException if there is none.<T> DynFields.BoundField<T>buildChecked(Object target) Returns the first valid implementation as a BoundMethod or throws a NoSuchMethodException if there is none.<T> DynFields.StaticField<T>Returns the first valid implementation as a StaticField or throws a RuntimeException if there is none.<T> DynFields.StaticField<T>Deprecated.since 1.6.0, will be removed in 1.7.0Instructs this builder to return AlwaysNull if no implementation is found.hiddenImpl(Class<?> targetClass, String fieldName) Checks for a hidden implementation.hiddenImpl(String className, String fieldName) Checks for a hidden implementation, first finding the class by name.Checks for an implementation.Checks for an implementation, first finding the class by name.loader(ClassLoader newLoader) Set theClassLoaderused to lookup classes by name.
-
Method Details
-
loader
Set theClassLoaderused to lookup classes by name.If not set, the current thread's ClassLoader is used.
- Parameters:
newLoader- a ClassLoader- Returns:
- this Builder for method chaining
-
defaultAlwaysNull
Instructs this builder to return AlwaysNull if no implementation is found.- Returns:
- this Builder for method chaining
-
impl
Checks for an implementation, first finding the class by name.- Parameters:
className- name of a classfieldName- name of the field- Returns:
- this Builder for method chaining
- See Also:
-
impl
Checks for an implementation.- Parameters:
targetClass- a class instancefieldName- name of a field (different from constructor)- Returns:
- this Builder for method chaining
- See Also:
-
buildChecked
Returns the first valid implementation as a UnboundField or throws a NoSuchFieldException if there is none.- Type Parameters:
T- Java class stored in the field- Returns:
- a
DynFields.UnboundFieldwith a valid implementation - Throws:
NoSuchFieldException- if no implementation was found
-
buildChecked
Returns the first valid implementation as a BoundMethod or throws a NoSuchMethodException if there is none.- Type Parameters:
T- Java class stored in the field- Parameters:
target- an Object on which to get and set the field- Returns:
- a
DynFields.BoundFieldwith a valid implementation and target - Throws:
IllegalStateException- if the method is staticIllegalArgumentException- if the receiver's class is incompatibleNoSuchFieldException- if no implementation was found
-
build
Returns the first valid implementation as a UnboundField or throws a NoSuchFieldException if there is none.- Type Parameters:
T- Java class stored in the field- Returns:
- a
DynFields.UnboundFieldwith a valid implementation - Throws:
RuntimeException- if no implementation was found
-
build
Returns the first valid implementation as a BoundMethod or throws a RuntimeException if there is none.- Type Parameters:
T- Java class stored in the field- Parameters:
target- an Object on which to get and set the field- Returns:
- a
DynFields.BoundFieldwith a valid implementation and target - Throws:
IllegalStateException- if the method is staticIllegalArgumentException- if the receiver's class is incompatibleRuntimeException- if no implementation was found
-
buildStaticChecked
Deprecated.since 1.6.0, will be removed in 1.7.0Returns the first valid implementation as a StaticField or throws a NoSuchFieldException if there is none.- Type Parameters:
T- Java class stored in the field- Returns:
- a
DynFields.StaticFieldwith a valid implementation - Throws:
IllegalStateException- if the method is not staticNoSuchFieldException- if no implementation was found
-
buildStatic
Returns the first valid implementation as a StaticField or throws a RuntimeException if there is none.- Type Parameters:
T- Java class stored in the field- Returns:
- a
DynFields.StaticFieldwith a valid implementation - Throws:
IllegalStateException- if the method is not staticRuntimeException- if no implementation was found
-