private void decorateMethod(PlasticClass componentClass, MutableComponentModel model, PlasticMethod method) { Import annotation = method.getAnnotation(Import.class); decorateMethod(componentClass, model, method, annotation); }
EventHandlerMethod(PlasticMethod method) { this.method = method; description = method.getDescription(); parameterSource = buildSource(); String methodName = method.getDescription().methodName; OnEvent onEvent = method.getAnnotation(OnEvent.class); eventType = extractEventType(methodName, onEvent); componentId = extractComponentId(methodName, onEvent); publishEvent = method.getAnnotation(PublishEvent.class); }
@Override public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { for (final PlasticMethod method : plasticClass.getMethodsWithAnnotation(CommitAfter.class)) { PersistenceContext annotation = method.getAnnotation(PersistenceContext.class); method.addAdvice(methodAdvices.get(annotation == null ? null : annotation.unitName())); } } }
@Override public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { for (final PlasticMethod method : plasticClass .getMethodsWithAnnotation(CommitAfter.class)) { PersistenceContext annotation = method.getAnnotation(PersistenceContext.class); MethodAdvice advice = annotation == null ? shared : new CommitAfterMethodAdvice(manager); method.addAdvice(advice); } } }
public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) { for (PlasticMethod method : plasticClass.getMethodsWithAnnotation(Operation.class)) { Operation annotation = method.getAnnotation(Operation.class); method.addAdvice(advisor.createAdvice(annotation.value())); } } }
private void adviseMethod(PlasticClass plasticClass, PlasticMethod method) { // Every instance of the clas srequires its own per-thread value. This handles the case of multiple // pages containing the component, or the same page containing the component multiple times. PlasticField cacheField = plasticClass.introduceField(PerThreadValue.class, "cache$" + method.getDescription().methodName); cacheField.injectComputed(new ComputedValue<PerThreadValue>() { public PerThreadValue get(InstanceContext context) { // Each instance will get a new PerThreadValue return perThreadManager.createValue(); } }); Cached annotation = method.getAnnotation(Cached.class); MethodResultCacheFactory factory = createFactory(plasticClass, annotation.watch(), method); MethodAdvice advice = createAdvice(cacheField, factory); method.addAdvice(advice); }