Search in sources :

Example 11 with PlasticClass

use of org.apache.tapestry5.plastic.PlasticClass in project tapestry-5 by apache.

the class ImportWorker method processClassAnnotationAtSetupRenderPhase.

private void processClassAnnotationAtSetupRenderPhase(PlasticClass componentClass, MutableComponentModel model) {
    Import annotation = componentClass.getAnnotation(Import.class);
    if (annotation != null) {
        PlasticMethod setupRender = componentClass.introduceMethod(TransformConstants.SETUP_RENDER_DESCRIPTION);
        decorateMethod(componentClass, model, setupRender, annotation);
        model.addRenderPhase(SetupRender.class);
    }
}
Also used : Import(org.apache.tapestry5.annotations.Import)

Example 12 with PlasticClass

use of org.apache.tapestry5.plastic.PlasticClass in project tapestry-5 by apache.

the class ApplicationStateWorker method transform.

public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) {
    for (PlasticField field : plasticClass.getFieldsWithAnnotation(SessionState.class)) {
        SessionState annotation = field.getAnnotation(SessionState.class);
        transform(plasticClass, field, annotation.create());
        field.claim(annotation);
    }
}
Also used : SessionState(org.apache.tapestry5.annotations.SessionState) PlasticField(org.apache.tapestry5.plastic.PlasticField)

Example 13 with PlasticClass

use of org.apache.tapestry5.plastic.PlasticClass in project tapestry-5 by apache.

the class MetaWorkerImpl method transform.

public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) {
    for (Class c : configuration.keySet()) {
        Annotation annotation = plasticClass.getAnnotation(c);
        if (annotation != null) {
            MetaDataExtractor extractor = configuration.get(c);
            extractor.extractMetaData(model, annotation);
        }
    }
}
Also used : MetaDataExtractor(org.apache.tapestry5.services.meta.MetaDataExtractor) PlasticClass(org.apache.tapestry5.plastic.PlasticClass) Annotation(java.lang.annotation.Annotation)

Example 14 with PlasticClass

use of org.apache.tapestry5.plastic.PlasticClass in project tapestry-5 by apache.

the class MixinAfterWorkerTest method annotation_not_present.

@Test
public void annotation_not_present() {
    PlasticClass pc = newMock(PlasticClass.class);
    MutableComponentModel model = mockMutableComponentModel();
    expect(pc.hasAnnotation(MixinAfter.class)).andReturn(false);
    replay();
    new MixinAfterWorker().transform(pc, null, model);
    verify();
}
Also used : PlasticClass(org.apache.tapestry5.plastic.PlasticClass) MutableComponentModel(org.apache.tapestry5.model.MutableComponentModel) Test(org.testng.annotations.Test)

Example 15 with PlasticClass

use of org.apache.tapestry5.plastic.PlasticClass in project tapestry-5 by apache.

the class CommitAfterWorker method transform.

@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()));
    }
}
Also used : PersistenceContext(javax.persistence.PersistenceContext) PlasticMethod(org.apache.tapestry5.plastic.PlasticMethod)

Aggregations

PlasticField (org.apache.tapestry5.plastic.PlasticField)13 PlasticClass (org.apache.tapestry5.plastic.PlasticClass)11 InstructionBuilder (org.apache.tapestry5.plastic.InstructionBuilder)5 InstructionBuilderCallback (org.apache.tapestry5.plastic.InstructionBuilderCallback)5 PlasticMethod (org.apache.tapestry5.plastic.PlasticMethod)5 Method (java.lang.reflect.Method)4 MutableComponentModel (org.apache.tapestry5.model.MutableComponentModel)4 PlasticClassTransformer (org.apache.tapestry5.plastic.PlasticClassTransformer)3 Test (org.testng.annotations.Test)3 PersistenceContext (javax.persistence.PersistenceContext)2 SneakyThrows (lombok.SneakyThrows)2 ComponentResources (org.apache.tapestry5.ComponentResources)2 Import (org.apache.tapestry5.annotations.Import)2 InternalComponentResources (org.apache.tapestry5.internal.InternalComponentResources)2 InstanceContext (org.apache.tapestry5.plastic.InstanceContext)2 MethodAdvice (org.apache.tapestry5.plastic.MethodAdvice)2 IFn (clojure.lang.IFn)1 Symbol (clojure.lang.Symbol)1 SessionTracker (com.flowlogix.web.mixins.SessionTracker)1 AJAX (com.flowlogix.web.services.annotations.AJAX)1