private Map<String, Object> getAttributeMap(final FieldMetadata field) { final Map<String, Object> map = new HashMap<String, Object>(); final AnnotationMetadata annotationMetadata = getMatchingAnnotation(field); if (annotationMetadata != null) { for (final JavaSymbolName attributeName : annotationMetadata.getAttributeNames()) { map.put(attributeName.getSymbolName(), annotationMetadata.getAttribute(attributeName) .getValue()); } } return map; }
/** * Constructor for using an existing {@link AnnotationMetadata} as a * baseline for building a new instance. * * @param existing required */ public AnnotationMetadataBuilder(final AnnotationMetadata existing) { Validate.notNull(existing); annotationType = existing.getAnnotationType(); for (final JavaSymbolName attributeName : existing.getAttributeNames()) { attributeValues.put(attributeName.getSymbolName(), existing.getAttribute(attributeName)); } this.setCommentStructure(existing.getCommentStructure()); }
if (annotation.getAttributeNames().isEmpty()) { return sb.toString(); for (final JavaSymbolName attributeName : annotation.getAttributeNames()) { || annotation.getAttributeNames().size() > 1) { sb.append(attributeName.getSymbolName()); sb.append(" = ");
for (final JavaSymbolName incomingAttributeName : annotation.getAttributeNames()) { for (final JavaSymbolName existingAttributeName : existing.getAttributeNames()) { if (attributesToDeleteIfPresent != null && attributesToDeleteIfPresent.contains(existingAttributeName)) { for (final JavaSymbolName incomingAttributeName : annotation.getAttributeNames()) { final AnnotationAttributeValue<?> incomingValue = annotation.getAttribute(incomingAttributeName);
if (annotation.getAttributeNames().contains(attributeName)) {
/** * Constructor must contain {@link FieldMetadata} of existing field (may * already contain field annotations) and a list of new Annotations which * should be introduced by an AspectJ ITD. The added annotations can not * already be present in {@link FieldMetadata}. * * @param field FieldMetadata of existing field (may not be null) * @param fieldAnnotation Annotation to be added to field via an ITD (may * not be null) * @param removeAnnotation if true, will cause the specified annotation to * be REMOVED via AspectJ's "-" syntax (usually would be false) */ public DeclaredFieldAnnotationDetails(final FieldMetadata field, final AnnotationMetadata fieldAnnotation, final boolean removeAnnotation) { Validate.notNull(field, "Field metadata required"); Validate.notNull(fieldAnnotation, "Field annotation required"); if (removeAnnotation) { Validate .isTrue( fieldAnnotation.getAttributeNames().isEmpty(), "Field annotation '@%s' (on target field %s.%s) must not have any attributes when requesting its removal", fieldAnnotation.getAnnotationType().getSimpleTypeName(), field.getFieldType() .getFullyQualifiedTypeName(), field.getFieldName().getSymbolName()); } this.field = field; this.fieldAnnotation = fieldAnnotation; this.removeAnnotation = removeAnnotation; }
data.append(annotationType.getSimpleTypeName()); if (!annotationMetadata.getAttributeNames().isEmpty()) { data.append("("); int i = 0; for (final JavaSymbolName attributeName : annotationMetadata.getAttributeNames()) { i++; if (i > 1) {
for (final JavaSymbolName attributeName : annotation.getAttributeNames()) { final AnnotationAttributeValue<?> value = annotation.getAttribute(attributeName); Validate.notNull(value, "Unable to acquire value '%s' from annotation", attributeName);
AnnotationExpr annotationExpr; final AnnotationMetadata nestedAnnotation = castValue.getValue(); if (castValue.getValue().getAttributeNames().size() == 0) { annotationExpr = new MarkerAnnotationExpr(JavaParserUtils.getNameExpr(nestedAnnotation .getAnnotationType().getSimpleTypeName())); } else if (castValue.getValue().getAttributeNames().size() == 1 && (castValue.getValue().getAttributeNames().get(0) == null || "value".equals(castValue .getValue().getAttributeNames().get(0).getSymbolName()))) { annotationExpr = new SingleMemberAnnotationExpr(JavaParserUtils.getNameExpr(nestedAnnotation .getAnnotationType().getSimpleTypeName()), convert( nestedAnnotation.getAttribute(nestedAnnotation.getAttributeNames().get(0)), compilationUnitServices).getValue()); } else { final List<MemberValuePair> memberValuePairs = new ArrayList<MemberValuePair>(); for (final JavaSymbolName attributeName : nestedAnnotation.getAttributeNames()) { memberValuePairs.add(convert(nestedAnnotation.getAttribute(attributeName), compilationUnitServices));
private Map<String, Object> getAttributeMap(final FieldMetadata field) { final Map<String, Object> map = new HashMap<String, Object>(); final AnnotationMetadata annotationMetadata = getMatchingAnnotation(field); if (annotationMetadata != null) { for (final JavaSymbolName attributeName : annotationMetadata.getAttributeNames()) { map.put(attributeName.getSymbolName(), annotationMetadata.getAttribute(attributeName) .getValue()); } } return map; }
/** * Constructor for using an existing {@link AnnotationMetadata} as a * baseline for building a new instance. * * @param existing required */ public AnnotationMetadataBuilder(final AnnotationMetadata existing) { Validate.notNull(existing); annotationType = existing.getAnnotationType(); for (final JavaSymbolName attributeName : existing.getAttributeNames()) { attributeValues.put(attributeName.getSymbolName(), existing.getAttribute(attributeName)); } this.setCommentStructure(existing.getCommentStructure()); }
/** * Get GvNIXXmlElement annotation related with XmlElement annotation. * <p> * Creates the GvNIXXmlElement with all attributes defined in XmlElement * annotation. * </p> * * @param annot XmlElement annotation * @return GvNIXXmlElement annotation */ private AnnotationMetadata getXmlElementFieldAnnotation( AnnotationMetadata annot) { List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); for (JavaSymbolName attrName : annot.getAttributeNames()) { attrs.add(annot.getAttribute(attrName)); } return new AnnotationMetadataBuilder(new JavaType( GvNIXXmlElementField.class.getName()), attrs).build(); }
if (annotation.getAttributeNames().isEmpty()) { return sb.toString(); for (final JavaSymbolName attributeName : annotation.getAttributeNames()) { || annotation.getAttributeNames().size() > 1) { sb.append(attributeName.getSymbolName()); sb.append(" = ");
for (final JavaSymbolName incomingAttributeName : annotation.getAttributeNames()) { for (final JavaSymbolName existingAttributeName : existing.getAttributeNames()) { if (attributesToDeleteIfPresent != null && attributesToDeleteIfPresent.contains(existingAttributeName)) { for (final JavaSymbolName incomingAttributeName : annotation.getAttributeNames()) { final AnnotationAttributeValue<?> incomingValue = annotation.getAttribute(incomingAttributeName);
if (annotation.getAttributeNames().contains(attributeName)) {
/** * Constructor must contain {@link FieldMetadata} of existing field (may * already contain field annotations) and a list of new Annotations which * should be introduced by an AspectJ ITD. The added annotations can not * already be present in {@link FieldMetadata}. * * @param field FieldMetadata of existing field (may not be null) * @param fieldAnnotation Annotation to be added to field via an ITD (may * not be null) * @param removeAnnotation if true, will cause the specified annotation to * be REMOVED via AspectJ's "-" syntax (usually would be false) */ public DeclaredFieldAnnotationDetails(final FieldMetadata field, final AnnotationMetadata fieldAnnotation, final boolean removeAnnotation) { Validate.notNull(field, "Field metadata required"); Validate.notNull(fieldAnnotation, "Field annotation required"); if (removeAnnotation) { Validate .isTrue( fieldAnnotation.getAttributeNames().isEmpty(), "Field annotation '@%s' (on target field %s.%s) must not have any attributes when requesting its removal", fieldAnnotation.getAnnotationType().getSimpleTypeName(), field.getFieldType() .getFullyQualifiedTypeName(), field.getFieldName().getSymbolName()); } this.field = field; this.fieldAnnotation = fieldAnnotation; this.removeAnnotation = removeAnnotation; }
data.append(annotationType.getSimpleTypeName()); if (!annotationMetadata.getAttributeNames().isEmpty()) { data.append("("); int i = 0; for (final JavaSymbolName attributeName : annotationMetadata.getAttributeNames()) { i++; if (i > 1) {
.getAttributeNames()) { attrs.add(annotation.getAttribute(javaSymbolName));
!gvNixWebMethodAnnotation.getAttributeNames().isEmpty(), "The annotation @GvNIXWebMethod of '" .concat(methodMetadata.getMethodName()