Package org.apache.iceberg.common
Class DynConstructors.Builder
java.lang.Object
org.apache.iceberg.common.DynConstructors.Builder
- Enclosing class:
- DynConstructors
Builder for resolving a constructor from candidate implementations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<C> DynConstructors.Ctor<C>build()Returns the first valid constructor as aDynConstructors.Ctoror throws a RuntimeException if there is none.<C> DynConstructors.Ctor<C>Returns the first valid constructor as aDynConstructors.Ctoror throws a NoSuchMethodException if there is none.hiddenImpl(Class<T> targetClass, Class<?>... types) Checks for a hidden implementation.hiddenImpl(String className, Class<?>... types) 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.
-
Constructor Details
-
Builder
Constructs a builder for the given base class.- Parameters:
baseClass- the base class used in error messages when no constructor is found
-
Builder
public Builder()Constructs a builder with no base class.
-
-
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
-
impl
Checks for an implementation, first finding the class by name.- Parameters:
className- name of a classtypes- the constructor argument types- Returns:
- this Builder for method chaining
-
impl
Checks for an implementation.- Type Parameters:
T- the type of the target class- Parameters:
targetClass- a class instancetypes- the constructor argument types- Returns:
- this Builder for method chaining
-
buildChecked
Returns the first valid constructor as aDynConstructors.Ctoror throws a NoSuchMethodException if there is none.- Type Parameters:
C- Java class constructed by the constructor- Returns:
- a
DynConstructors.Ctorwith a valid implementation - Throws:
NoSuchMethodException- if no implementation was found
-
build
Returns the first valid constructor as aDynConstructors.Ctoror throws a RuntimeException if there is none.- Type Parameters:
C- Java class constructed by the constructor- Returns:
- a
DynConstructors.Ctorwith a valid implementation - Throws:
RuntimeException- if no implementation was found
-