Search in sources :

Example 1 with ValuePair

use of org.jboss.forge.roaster.model.ValuePair in project kie-wb-common by kiegroup.

the class DefaultJavaRoasterModelAnnotationDriver method buildAnnotation.

@Override
public Annotation buildAnnotation(AnnotationDefinition annotationDefinition, Object annotationToken) throws ModelDriverException {
    AnnotationSource javaAnnotationToken = (AnnotationSource) annotationToken;
    AnnotationImpl annotation = new AnnotationImpl(annotationDefinition);
    if (annotationDefinition.isMarker()) {
        return annotation;
    } else {
        if (javaAnnotationToken.getValues() != null) {
            List<ValuePair> values = javaAnnotationToken.getValues();
            if (values != null && values.size() > 0) {
                for (AnnotationValuePairDefinition valuePairDefinition : annotationDefinition.getValuePairs()) {
                    Object annotationValue = buildAnnotationValue(javaAnnotationToken, valuePairDefinition);
                    if (annotationValue != null) {
                        annotation.setValue(valuePairDefinition.getName(), annotationValue);
                    }
                }
            }
        }
    }
    return annotation;
}
Also used : ValuePair(org.jboss.forge.roaster.model.ValuePair) AnnotationSource(org.jboss.forge.roaster.model.source.AnnotationSource) AnnotationImpl(org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl) AnnotationValuePairDefinition(org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition)

Aggregations

ValuePair (org.jboss.forge.roaster.model.ValuePair)1 AnnotationSource (org.jboss.forge.roaster.model.source.AnnotationSource)1 AnnotationValuePairDefinition (org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition)1 AnnotationImpl (org.kie.workbench.common.services.datamodeller.core.impl.AnnotationImpl)1