@Override public String apply(AnnotationParameter input) { Preconditions.checkNotNull(input, "annotation"); return input.getName(); } }
@Override public boolean apply(AnnotationParameter input) { Preconditions.checkNotNull(input, "input"); return !Iterables.contains(parameterNames, input.getName()); } });
@Override public boolean apply(AnnotationParameter parameter) { Preconditions.checkArgument(parameter != null); return parameter.getName().equals(parameterName); } }), new Function<AnnotationParameter, ValueReference>() {
@Override public Class<? extends ValueReference> getExpectedParameterType(AnnotationParameter parameter) { PatternAnnotationParameter expectedParameter = null; for (PatternAnnotationParameter p : definedAttributes) { if (p.getName().equals(parameter.getName())) { expectedParameter = p; } } if (expectedParameter == null) { return null; } String type = expectedParameter.getType(); if (type != null && TYPEMAPPING.containsKey(type)) { return TYPEMAPPING.get(type); } return null; }
public static Map<String, Object> evaluateAnnotationParameters(Annotation annotation) { Map<String, Object> result = Maps.newHashMap(); for (AnnotationParameter param : annotation.getParameters()) { String parameterName = param.getName(); ValueReference ref = param.getValue(); if (ref != null) { final Object valueReference = CorePatternLanguageHelper.getValue(ref); if (!Strings.isNullOrEmpty(parameterName) && valueReference != null) { result.put(parameterName, valueReference); } } } return result; }
public String getDescription(AnnotationParameter parameter) { Annotation annotation = (Annotation) parameter.eContainer(); return getDescription(annotation.getName(), parameter.getName()); }
public boolean isDeprecated(AnnotationParameter parameter) { Annotation annotation = (Annotation) parameter.eContainer(); return isDeprecated(annotation.getName(), parameter.getName()); }
@Override public QualifiedName getFullyQualifiedName(EObject obj) { if (obj instanceof Annotation) { Annotation annotation = (Annotation) obj; String name = annotation.getName(); return nameConverter.toQualifiedName("annotation." + name); } else if (obj instanceof AnnotationParameter) { AnnotationParameter parameter = (AnnotationParameter) obj; Annotation annotation = (Annotation) parameter.eContainer(); return getFullyQualifiedName(annotation).append(parameter.getName()); } return super.getFullyQualifiedName(obj); }
error(UNKNOWN_ANNOTATION_ATTRIBUTE + unknownParameter.getName(), unknownParameter, PatternLanguagePackage.Literals.ANNOTATION_PARAMETER__NAME, annotation.getParameters().indexOf(unknownParameter), IssueCodes.UNKNOWN_ANNOTATION_PARAMETER);
/** * Contexts: * AnnotationParameter returns AnnotationParameter * * Constraint: * (name=ID value=AnnotationValueReference) */ protected void sequence_AnnotationParameter(ISerializationContext context, AnnotationParameter semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, PatternLanguagePackage.Literals.ANNOTATION_PARAMETER__NAME) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, PatternLanguagePackage.Literals.ANNOTATION_PARAMETER__NAME)); if (transientValues.isValueTransient(semanticObject, PatternLanguagePackage.Literals.ANNOTATION_PARAMETER__VALUE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, PatternLanguagePackage.Literals.ANNOTATION_PARAMETER__VALUE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getAnnotationParameterAccess().getNameIDTerminalRuleCall_0_0(), semanticObject.getName()); feeder.accept(grammarAccess.getAnnotationParameterAccess().getValueAnnotationValueReferenceParserRuleCall_2_0(), semanticObject.getValue()); feeder.finish(); }