org.nakedobjects.headlessviewer.viewer.internal.Proxy Maven / Gradle / Ivy
The newest version!
package org.nakedobjects.headlessviewer.viewer.internal;
import java.util.Collection;
import java.util.Map;
import org.nakedobjects.headlessviewer.applib.HeadlessViewer;
import org.nakedobjects.headlessviewer.applib.HeadlessViewer.ExecutionMode;
import org.nakedobjects.metamodel.runtimecontext.RuntimeContext;
import org.nakedobjects.metamodel.spec.feature.OneToManyAssociation;
public class Proxy {
public static T proxy(
final T toProxy,
final HeadlessViewer embeddedViewer,
final ExecutionMode mode,
final RuntimeContext runtimeContext) {
final DomainObjectInvocationHandler invocationHandler =
new DomainObjectInvocationHandler(toProxy, embeddedViewer, mode, runtimeContext);
final CgLibProxy cglibProxy = new CgLibProxy(invocationHandler);
return cglibProxy.proxy();
}
/**
* Whether to execute or not will be picked up from the supplied parent handler.
*/
public static Collection proxy(
final Collection collectionToProxy,
final String collectionName,
final DomainObjectInvocationHandler handler,
final RuntimeContext runtimeContext,
final OneToManyAssociation otma) {
final CollectionInvocationHandler> collectionInvocationHandler =
new CollectionInvocationHandler>(
collectionToProxy, collectionName, handler, runtimeContext, otma);
collectionInvocationHandler.setResolveObjectChangedEnabled(handler.isResolveObjectChangedEnabled());
final CgLibProxy> cglibProxy = new CgLibProxy>(collectionInvocationHandler);
return cglibProxy.proxy();
}
/**
* Whether to execute or not will be picked up from the supplied parent handler.
*/
public static Map proxy(
final Map
collectionToProxy,
final String collectionName,
final DomainObjectInvocationHandler handler,
final RuntimeContext runtimeContext,
final OneToManyAssociation otma) {
final MapInvocationHandler> mapInvocationHandler = new MapInvocationHandler>(collectionToProxy,
collectionName, handler, runtimeContext, otma);
mapInvocationHandler.setResolveObjectChangedEnabled(handler.isResolveObjectChangedEnabled());
final CgLibProxy