public void advise(MethodInvocation invocation) { invocation.proceed(); handle.invoke(invocation.getInstance()).rethrow(); } };
@Override public T build() { return (T) transformation.createInstantiator().newInstance(); } }
@Override public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { for (PlasticMethod method : plasticClass.getMethodsWithAnnotation(CommitAfter.class)) { method.addAdvice(advice); } } }
public void doBuild(InstructionBuilder builder) { builder.loadThis().loadArgument(0).invokeVirtual(getRootMethod); for (InstructionBuilderCallback callback : callbacks) { callback.doBuild(builder); } builder.returnResult(); } });
@Override public void doBuild(InstructionBuilder builder) { // Load the field builder.loadThis().getField(field); builder.loadArguments(); invokeDelegateAndReturnResult(builder, field.getTypeName()); } });
public void advise(MethodInvocation invocation) { ComponentResources resources = invocation.getInstanceContext().get(ComponentResources.class); Binding binding = bindingSource.newBinding("@Cached watch", resources, BindingConstants.PROP, watch); bindingFieldHandle.set(invocation.getInstance(), binding); invocation.proceed(); } });
public void advise(MethodInvocation invocation) { invocation.proceed(); Object instance = invocation.getInstance(); for (MethodHandle handle : handles) { handle.invoke(instance); } } });
private void implementComponentInterface(PlasticClass plasticClass) { plasticClass.introduceInterface(Component.class); final PlasticField resourcesField = plasticClass.introduceField(InternalComponentResources.class, "internalComponentResources").injectFromInstanceContext(); plasticClass.introduceMethod(GET_COMPONENT_RESOURCES, new InstructionBuilderCallback() { public void doBuild(InstructionBuilder builder) { builder.loadThis().getField(resourcesField).returnResult(); } }); }
private void addSuperCall(InstructionBuilder builder) { builder.loadThis().loadArguments().invokeSpecial(plasticClass.getSuperClassName(), interfaceMethodDescription); }
private FieldConduit<Object> createConduit(PlasticField field, final String blockId) { final String className = field.getPlasticClass().getClassName(); final String fieldName = field.getName(); return new ReadOnlyComponentFieldConduit(className, fieldName) { public Object get(Object instance, InstanceContext context) { ComponentResources resources = context.get(ComponentResources.class); return resources.getBlock(blockId); } }; }
/** * Defer creation of the delegate field unless actually needed. */ private PlasticField getDelegateField() { if (delegateField == null) delegateField = plasticClass.introduceField(PropertyConduitDelegate.class, "delegate").inject( sharedDelegate); return delegateField; } }
/** * Claims each field with the {@link org.apache.tapestry5.annotations.Retain} , claiming it using the * annotation class (not the annotation instance, to avoid * instantiating the annotation) as the tag. */ public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { for (PlasticField field : plasticClass.getFieldsWithAnnotation(Retain.class)) { field.claim(Retain.class); } } }
public PlasticProxyFactoryImpl(ClassLoader parentClassLoader, Logger logger) { this(PlasticManager.withClassLoader(parentClassLoader).create(), logger); }
/** * Creates the PlasticManager with the current set of options. * * @return the PlasticManager */ public PlasticManager create() { lock(); return new PlasticManager(loader, delegate, packages, options); } }
@Override public void doBuild(InstructionBuilder builder) { // Load the field builder.loadThis().getField(field); builder.loadArguments(); invokeDelegateAndReturnResult(builder, field.getTypeName()); } });
@Override public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { for (PlasticMethod method : plasticClass.getMethodsWithAnnotation(CommitAfter.class)) { method.addAdvice(advice); } } }
@Override public T build() { return (T) transformation.createInstantiator().newInstance(); } }
/** * Creates the PlasticManager with the current set of options. * * @return the PlasticManager */ public PlasticManager create() { lock(); return new PlasticManager(loader, delegate, packages, options); } }
public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { for (PlasticMethod method : plasticClass.getMethodsWithAnnotation(DiscardAfter.class)) { method.addAdvice(advice); } } }
public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { for (PlasticMethod method : plasticClass.getMethodsWithAnnotation(ReverseStrings.class)) { method.addAdvice(advice); } } }