Search in sources :

Example 26 with JvmAnnotationType

use of org.eclipse.xtext.common.types.JvmAnnotationType in project xtext-xtend by eclipse.

the class XtendAnnotationReferenceImpl method translateAnnotationValue.

protected Object translateAnnotationValue(final XExpression value, final String property) {
    final JvmType annotationType = this.getDelegate().getAnnotationType();
    if ((annotationType instanceof JvmAnnotationType)) {
        final Function1<JvmOperation, Boolean> _function = (JvmOperation it) -> {
            String _simpleName = it.getSimpleName();
            return Boolean.valueOf(Objects.equal(_simpleName, property));
        };
        final JvmOperation operation = IterableExtensions.<JvmOperation>findFirst(Iterables.<JvmOperation>filter(((JvmAnnotationType) annotationType).getMembers(), JvmOperation.class), _function);
        if ((operation != null)) {
            final boolean array = this.getCompilationUnit().getTypeReferences().isArray(operation.getReturnType());
            return this.getCompilationUnit().translateAnnotationValue(value, operation.getReturnType(), array);
        }
    }
    return this.getCompilationUnit().translateAnnotationValue(value, null, false);
}
Also used : JvmAnnotationType(org.eclipse.xtext.common.types.JvmAnnotationType) JvmOperation(org.eclipse.xtext.common.types.JvmOperation) JvmType(org.eclipse.xtext.common.types.JvmType)

Aggregations

JvmAnnotationType (org.eclipse.xtext.common.types.JvmAnnotationType)26 JvmType (org.eclipse.xtext.common.types.JvmType)9 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)8 JvmEnumerationType (org.eclipse.xtext.common.types.JvmEnumerationType)6 EObject (org.eclipse.emf.ecore.EObject)5 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)5 JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)5 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)5 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)5 JvmAnnotationReference (org.eclipse.xtext.common.types.JvmAnnotationReference)4 JvmMember (org.eclipse.xtext.common.types.JvmMember)4 Test (org.junit.Test)4 InternalEObject (org.eclipse.emf.ecore.InternalEObject)3 JvmAnnotationTypeDeclarationImpl (org.eclipse.xtend.core.macro.declaration.JvmAnnotationTypeDeclarationImpl)3 XAnnotation (org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation)3 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)3 URI (org.eclipse.emf.common.util.URI)2 XtendAnnotationType (org.eclipse.xtend.core.xtend.XtendAnnotationType)2 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)2 XtendConstructor (org.eclipse.xtend.core.xtend.XtendConstructor)2