Class ProxyBuilder<T>
- java.lang.Object
-
- org.wickedsource.docxstamper.proxy.ProxyBuilder<T>
-
- Type Parameters:
T- the type of the root object.
public class ProxyBuilder<T> extends Object
Allows an object to be wrapped by a proxy so that it will implement additional interfaces.
-
-
Constructor Summary
Constructors Constructor Description ProxyBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tbuild()Creates a proxy object out of the specified root object and the specified interfaces and implementations.ProxyBuilder<T>withInterface(Class<?> interfaceClass, Object interfaceImpl)Specifies an interfaces and an implementation of an interface by which the root object shall be extended.ProxyBuilder<T>withRoot(T rootObject)Specifies the root object for the proxy that shall be enhanced.
-
-
-
Method Detail
-
withRoot
public ProxyBuilder<T> withRoot(T rootObject)
Specifies the root object for the proxy that shall be enhanced.- Parameters:
rootObject- the root object.- Returns:
- this builder for chaining.
-
withInterface
public ProxyBuilder<T> withInterface(Class<?> interfaceClass, Object interfaceImpl)
Specifies an interfaces and an implementation of an interface by which the root object shall be extended.- Parameters:
interfaceClass- the class of the interfaceinterfaceImpl- an implementation of the interface- Returns:
- this builder for chaining.
-
build
public T build() throws ProxyException
Creates a proxy object out of the specified root object and the specified interfaces and implementations.- Returns:
- a proxy object that is still of type T but additionally implements all specified interfaces.
- Throws:
ProxyException- if the proxy could not be created.
-
-