@Override public void transform(PlasticClass plasticClass) { PlasticField filterField = plasticClass.introduceField(filterInterface, "filter") .injectFromInstanceContext(); PlasticField nextField = plasticClass.introduceField(serviceInterface, "next") .injectFromInstanceContext(); processMethods(plasticClass, filterField, nextField); plasticClass.addToString(String.format("<PipelineBridge from %s to %s>", serviceInterface.getName(), filterInterface.getName())); } });
@Override public void transform(PlasticClass plasticClass) { PlasticField filterField = plasticClass.introduceField(filterInterface, "filter") .injectFromInstanceContext(); PlasticField nextField = plasticClass.introduceField(serviceInterface, "next") .injectFromInstanceContext(); processMethods(plasticClass, filterField, nextField); plasticClass.addToString(String.format("<PipelineBridge from %s to %s>", serviceInterface.getName(), filterInterface.getName())); } });
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(); } }); }
public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { // Subclasses don't need to bother, they'll inherit from super-classes. if (!support.isRootTransformation()) { return; } plasticClass.introduceInterface(RenderCommand.class); PlasticField resourcesField = plasticClass.introduceField(InternalComponentResources.class, "resources").injectFromInstanceContext(); plasticClass.introduceMethod(RENDER_DESCRIPTION).delegateTo(resourcesField); plasticClass.introduceMethod(TransformConstants.POST_RENDER_CLEANUP_DESCRIPTION).delegateTo(resourcesField); } }