Search in sources :

Example 1 with ProxyReferenceInvocationHandler

use of org.qi4j.runtime.composite.ProxyReferenceInvocationHandler in project qi4j-sdk by Qi4j.

the class AbstractAssociationInstance method getEntityReference.

protected EntityReference getEntityReference(Object composite) {
    if (composite == null) {
        return null;
    }
    InvocationHandler handler = Proxy.getInvocationHandler(composite);
    if (handler instanceof ProxyReferenceInvocationHandler) {
        handler = Proxy.getInvocationHandler(((ProxyReferenceInvocationHandler) handler).proxy());
    }
    EntityInstance instance = (EntityInstance) handler;
    return instance.identity();
}
Also used : ProxyReferenceInvocationHandler(org.qi4j.runtime.composite.ProxyReferenceInvocationHandler) EntityInstance(org.qi4j.runtime.entity.EntityInstance) ProxyReferenceInvocationHandler(org.qi4j.runtime.composite.ProxyReferenceInvocationHandler) InvocationHandler(java.lang.reflect.InvocationHandler)

Aggregations

InvocationHandler (java.lang.reflect.InvocationHandler)1 ProxyReferenceInvocationHandler (org.qi4j.runtime.composite.ProxyReferenceInvocationHandler)1 EntityInstance (org.qi4j.runtime.entity.EntityInstance)1