protected boolean remove(final JvmOperation op) { final Predicate<JvmAnnotationValue> _function = (JvmAnnotationValue it) -> { return (Objects.equal(op, it.getOperation()) || ((it.getOperation() == null) && Objects.equal(op.getSimpleName(), "value"))); }; return Iterators.<JvmAnnotationValue>removeIf(this.delegate.getExplicitValues().iterator(), _function); }
protected void recordAnnotationExpressions(List<JvmAnnotationReference> annotations) { for(JvmAnnotationReference annotation: annotations) { EObject sourceElement = getSourceElement(annotation); if (sourceElement != annotation) { rootedInstances.add(sourceElement); } else { for(JvmAnnotationValue value: annotation.getExplicitValues()) { if (value instanceof JvmCustomAnnotationValue) { JvmCustomAnnotationValue custom = (JvmCustomAnnotationValue) value; for(Object object: custom.getValues()) { if (object instanceof XExpression) { rootedInstances.add(sourceElement); } } } else if (value instanceof JvmAnnotationAnnotationValue) { recordAnnotationExpressions(((JvmAnnotationAnnotationValue) value).getValues()); } } } } }
protected void setValues(final String name, final Object values, final String componentType, final boolean mustBeArray) { final JvmOperation op = this.findOperation(name, mustBeArray); final JvmAnnotationValue newValue = this.createAnnotationValue(op, values); newValue.setOperation(op); this.setValue(newValue, values, componentType, mustBeArray); this.remove(op); this.delegate.getExplicitValues().add(newValue); }
public JvmAnnotationReferenceBuilder(InternalEList<JvmAnnotationReference> target, String desc, Proxies proxies) { super(Opcodes.ASM7); this.proxies = proxies; this.target = target; this.annotationType = BinarySignatures.createTypeSignature(desc); result = TypesFactory.eINSTANCE.createJvmAnnotationReference(); result.setAnnotation(proxies.createAnnotationProxy(annotationType)); values = (InternalEList<JvmAnnotationValue>) result.getExplicitValues(); }
JvmStringAnnotationValue annotationValue = typesFactory.createJvmStringAnnotationValue(); annotationValue.getValues().add((String) value); result.getExplicitValues().add(annotationValue);
annotationValue.getValues().add(value); result.getExplicitValues().add(annotationValue);
/** Create an annotation with classes as values. * * @param type the type of the annotation. * @param values the values. * @return the reference to the JVM annotation. */ private JvmAnnotationReference annotationClassRef(Class<? extends Annotation> type, List<? extends JvmTypeReference> values) { try { final JvmAnnotationReference annot = this._annotationTypesBuilder.annotationRef(type); final JvmTypeAnnotationValue annotationValue = this.services.getTypesFactory().createJvmTypeAnnotationValue(); for (final JvmTypeReference value : values) { annotationValue.getValues().add(this.typeBuilder.cloneWithProxies(value)); } annot.getExplicitValues().add(annotationValue); return annot; } catch (IllegalArgumentException exception) { // ignore } return null; }
EList<JvmAnnotationValue> _explicitValues = null; if (annotationType!=null) { _explicitValues=annotationType.getExplicitValues();
protected JvmAnnotationReference createAnnotationReference(Annotation annotation) { JvmAnnotationReference annotationReference = TypesFactory.eINSTANCE.createJvmAnnotationReference(); Class<? extends Annotation> type = annotation.annotationType(); annotationReference.setAnnotation(createAnnotationProxy(type)); Method[] declaredMethods = type.getDeclaredMethods(); if (declaredMethods.length > 0) { InternalEList<JvmAnnotationValue> values = (InternalEList<JvmAnnotationValue>)annotationReference.getExplicitValues(); for (Method method : declaredMethods) { try { Object value = method.invoke(annotation, EMPTY_ARRAY); Class<?> returnType = method.getReturnType(); if (returnType.isArray()) { JvmAnnotationValue annotationValue = createArrayAnnotationValue(value, returnType); values.addUnique(annotationValue); annotationValue.setOperation(createMethodProxy(method)); } else { JvmAnnotationValue annotationValue = createAnnotationValue(value, returnType); values.addUnique(annotationValue); annotationValue.setOperation(createMethodProxy(method)); } } catch (Exception e) { log.error(e.getMessage(), e); } } } return annotationReference; }
annotationValue.getValues().add(inlineExpression); annotationValue.setOperation(annotationInfo.valueOperation); annotationReference.getExplicitValues().add(annotationValue); annotationImportedType.getValues().add(this.typeBuilder.cloneWithProxies(type)); annotationImportedType.setOperation(annotationInfo.importedOperation); annotationReference.getExplicitValues().add(annotationImportedType); annotationConstant.getValues().add(Boolean.valueOf(isConstantExpression)); annotationConstant.setOperation(annotationInfo.constantExpressionOperation); annotationReference.getExplicitValues().add(annotationConstant); annotationStatement.getValues().add(Boolean.valueOf(isStatementExpression)); annotationStatement.setOperation(annotationInfo.statementExpressionOperation); annotationReference.getExplicitValues().add(annotationStatement);
final JvmIntAnnotationValue annotationValue = this.typesFactory.createJvmIntAnnotationValue(); annotationValue.getValues().add(value); result.getExplicitValues().add(annotationValue); if (target.getAnnotations().add(result)) { return result;
JvmStringAnnotationValue annotationValue = typesFactory.createJvmStringAnnotationValue(); annotationValue.getValues().add(generator.getClass().getName()); annotationRef.getExplicitValues().add(annotationValue); if (generatorConfig.isIncludeDateInGeneratedAnnotation()) { if (dateFormat == null) { annotationValue.setOperation(getOperation(generatedAnnotationType, "date")); annotationValue.getValues().add(date); annotationRef.getExplicitValues().add(annotationValue); annotationValue.setOperation(getOperation(generatedAnnotationType, "comments")); annotationValue.getValues().add(transformedComment); annotationRef.getExplicitValues().add(annotationValue);
public void generateAnnotation(final JvmAnnotationReference it, final ITreeAppendable appendable, final GeneratorConfig config) { appendable.append("@"); appendable.append(it.getAnnotation()); final Procedure1<LoopParams> _function = (LoopParams it_1) -> { it_1.setPrefix("("); it_1.setSeparator(", "); it_1.setSuffix(")"); }; final Procedure1<JvmAnnotationValue> _function_1 = (JvmAnnotationValue it_1) -> { this.toJava(it_1, appendable, config); }; this._loopExtensions.<JvmAnnotationValue>forEach(appendable, it.getExplicitValues(), _function, _function_1); }
public void toJava(final JvmAnnotationValue it, final ITreeAppendable appendable, final GeneratorConfig config) { JvmOperation _operation = it.getOperation(); boolean _tripleNotEquals = (_operation != null); if (_tripleNotEquals) { String _simpleName = it.getOperation().getSimpleName(); boolean _tripleEquals = (_simpleName == null); if (_tripleEquals) { return; } appendable.append(it.getOperation().getSimpleName()); appendable.append(" = "); } else { EObject _eContainer = it.eContainer(); int _size = ((JvmAnnotationReference) _eContainer).getExplicitValues().size(); boolean _greaterThan = (_size > 1); if (_greaterThan) { appendable.append("value = "); } } this.toJavaLiteral(it, appendable, config); }
protected void computeAnnotationTypes(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, List<JvmAnnotationReference> annotations) { for(JvmAnnotationReference annotation: annotations) { EObject sourceElement = getSourceElement(annotation); if (sourceElement != annotation) { computeTypes(resolvedTypes, featureScopeSession, sourceElement); } else { for(JvmAnnotationValue value: annotation.getExplicitValues()) { if (value instanceof JvmCustomAnnotationValue) { JvmCustomAnnotationValue custom = (JvmCustomAnnotationValue) value; for(Object object: custom.getValues()) { if (object instanceof XExpression) { AnnotationValueTypeComputationState state = new AnnotationValueTypeComputationState(resolvedTypes, featureScopeSession, value, (XExpression) object); state.computeTypes(); } } } else if (value instanceof JvmAnnotationAnnotationValue) { computeAnnotationTypes(resolvedTypes, featureScopeSession, ((JvmAnnotationAnnotationValue) value).getValues()); } } } } }
XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT, false); annotationValue.setOperation(op); reference.getExplicitValues().add(annotationValue); JvmAnnotationValue value = toJvmAnnotationValue(anno.getValue()); if (value != null) { reference.getExplicitValues().add(value);
List<String> _map = ListExtensions.<JvmAnnotationValue, String>map(baseJvmAnnotationReference.getExplicitValues(), _function_1); for (final String valueName : _map) {
final JvmAnnotationReference clone = SARLJvmModelInferrer.this._annotationTypesBuilder .annotationRef(id); for (final JvmAnnotationValue annotationValue : annotation.getExplicitValues()) { clone.getExplicitValues().add(EcoreUtil.copy(annotationValue));