public class XRayInterface extends InvocationResolver implements InvocationHandler
InterfaceOfTheDecorator unlocked = XRayInterface.xray(object).to(InterfaceOfTheDecorator.class);
After that the variable unlocked contains an object of type InterfaceOfTheDecorator, where each method is mapped according to the xrayinterface conventions:
| Method | Maps to | |
|---|---|---|
void setProperty([sometype] t) |
void setProperty([sometype] t) |
if exists |
property = t; |
if there is a property [sometype] property; |
|
[sometype] getProperty() |
[sometype] getProperty() |
if exists |
return property; |
if there is a property [sometype] property; |
|
[booleantype] isProperty() |
[booleantype] getProperty() |
if exists |
return property; |
if there is a property [booleantype] property; |
|
[return type] methodname([signature]) |
[return type] methodname([signature]) |
| Constructor and Description |
|---|
XRayInterface(Class<?> clazz) |
XRayInterface(Object object) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
List<ConstructorInvoker> |
getConstructors() |
List<FieldGetter> |
getFieldGetters() |
List<FieldProperty> |
getFieldProperties() |
List<FieldSetter> |
getFieldSetters() |
Map<Method,MethodInvocationHandler> |
getInterfaceMethods() |
List<MethodInvoker> |
getMethods() |
Object |
getObject() |
List<StaticGetter> |
getStaticGetters() |
List<StaticMethodInvoker> |
getStaticMethods() |
List<StaticProperty> |
getStaticProperties() |
List<StaticSetter> |
getStaticSetters() |
int |
hashCode() |
Object |
invoke(Object proxy,
Method method,
Object[] args) |
<T> T |
to(Class<T> interfaceClass)
maps the given interface to the wrapped object
|
List<Method> |
unMappable(Class<?> interfaceClazz)
collects all methods of the given interface conflicting with the wrapped object
|
static XRayInterface |
xray(Object object)
wraps the given object.
|
createConstructorInvocator, createGetterInvocator, createMethodInvocator, createSetterInvocator, findConstructor, findField, findInvocationHandler, findMethod, getType, resolveSignaturepublic XRayInterface(Object object)
public XRayInterface(Class<?> clazz)
public Map<Method,MethodInvocationHandler> getInterfaceMethods()
public List<ConstructorInvoker> getConstructors()
public List<FieldProperty> getFieldProperties()
public List<FieldSetter> getFieldSetters()
public List<FieldGetter> getFieldGetters()
public List<StaticProperty> getStaticProperties()
public List<StaticSetter> getStaticSetters()
public List<StaticGetter> getStaticGetters()
public List<MethodInvoker> getMethods()
public List<StaticMethodInvoker> getStaticMethods()
public Object getObject()
public static XRayInterface xray(Object object)
object - the object to unlock/decoratepublic <T> T to(Class<T> interfaceClass)
T - the type to wrap the object ininterfaceClass - the given interface class (defining the type of the result)public List<Method> unMappable(Class<?> interfaceClazz)
interfaceClazz - the interface to check on conflictspublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke in interface InvocationHandlerThrowableCopyright © 2024. All rights reserved.