Search in sources :

Example 1 with CDI

use of com.flowlogix.web.services.annotations.CDI in project flowlogix by flowlogix.

the class CDIAnnotationWorker method transform.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.apache.tapestry5.services.transform.ComponentClassTransformWorker2
	 * #transform(org.apache.tapestry5.plastic.PlasticClass,
	 * org.apache.tapestry5.services.transform.TransformationSupport,
	 * org.apache.tapestry5.model.MutableComponentModel)
	 */
@Override
public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model) {
    for (PlasticField field : plasticClass.getFieldsWithAnnotation(CDI.class)) {
        final CDI annotation = field.getAnnotation(CDI.class);
        Class<?> type = cache.forName(field.getTypeName());
        final Object injectionValue = cdiFactory.get(type);
        if (injectionValue != null) {
            field.inject(injectionValue);
            field.claim(annotation);
        }
    }
}
Also used : PlasticField(org.apache.tapestry5.plastic.PlasticField) CDI(com.flowlogix.web.services.annotations.CDI)

Aggregations

CDI (com.flowlogix.web.services.annotations.CDI)1 PlasticField (org.apache.tapestry5.plastic.PlasticField)1