public List<JavaSymbolName> getAttributeNames() { final List<JavaSymbolName> result = new ArrayList<JavaSymbolName>(); for (final AnnotationAttributeValue<?> value : attributes) { result.add(value.getName()); } return result; }
public void addAttribute(final AnnotationAttributeValue<?> value) { // Locate existing attribute with this key and replace it attributeValues.put(value.getName().getSymbolName(), value); }
/** * Constructor * * @param annotationType the type of annotation for which these are the * metadata (required) * @param attributeValues the given annotation's values; can be * <code>null</code> */ DefaultAnnotationMetadata(final JavaType annotationType, final List<AnnotationAttributeValue<?>> attributeValues) { Validate.notNull(annotationType, "Annotation type required"); this.annotationType = annotationType; attributes = new ArrayList<AnnotationAttributeValue<?>>(); attributeMap = new HashMap<JavaSymbolName, AnnotationAttributeValue<?>>(); if (attributeValues != null) { attributes.addAll(attributeValues); for (final AnnotationAttributeValue<?> value : attributeValues) { attributeMap.put(value.getName(), value); } } }
return new MemberValuePair(value.getName().getSymbolName(), annotationExpr); final boolean castValue = ((BooleanAttributeValue) value).getValue(); final BooleanLiteralExpr convertedValue = new BooleanLiteralExpr(castValue); return new MemberValuePair(value.getName().getSymbolName(), convertedValue); final CharLiteralExpr convertedValue = new CharLiteralExpr(new String(new char[] {castValue})); return new MemberValuePair(value.getName().getSymbolName(), convertedValue); final Long castValue = ((LongAttributeValue) value).getValue(); final LongLiteralExpr convertedValue = new LongLiteralExpr(castValue.toString() + "L"); return new MemberValuePair(value.getName().getSymbolName(), convertedValue); final Integer castValue = ((IntegerAttributeValue) value).getValue(); final IntegerLiteralExpr convertedValue = new IntegerLiteralExpr(castValue.toString()); return new MemberValuePair(value.getName().getSymbolName(), convertedValue); return new MemberValuePair(value.getName().getSymbolName(), convertedValue); final String castValue = ((StringAttributeValue) value).getValue(); final StringLiteralExpr convertedValue = new StringLiteralExpr(castValue.toString()); return new MemberValuePair(value.getName().getSymbolName(), convertedValue); new FieldAccessExpr(JavaParserUtils.getNameExpr(castValue.getType() .getFullyQualifiedTypeName()), castValue.getField().getSymbolName()); return new MemberValuePair(value.getName().getSymbolName(), convertedValue); compilationUnitServices.getImports(), castValue);
public List<JavaSymbolName> getAttributeNames() { final List<JavaSymbolName> result = new ArrayList<JavaSymbolName>(); for (final AnnotationAttributeValue<?> value : attributes) { result.add(value.getName()); } return result; }
public void addAttribute(final AnnotationAttributeValue<?> value) { // Locate existing attribute with this key and replace it attributeValues.put(value.getName().getSymbolName(), value); }
/** * Constructor * * @param annotationType the type of annotation for which these are the * metadata (required) * @param attributeValues the given annotation's values; can be * <code>null</code> */ DefaultAnnotationMetadata(final JavaType annotationType, final List<AnnotationAttributeValue<?>> attributeValues) { Validate.notNull(annotationType, "Annotation type required"); this.annotationType = annotationType; attributes = new ArrayList<AnnotationAttributeValue<?>>(); attributeMap = new HashMap<JavaSymbolName, AnnotationAttributeValue<?>>(); if (attributeValues != null) { attributes.addAll(attributeValues); for (final AnnotationAttributeValue<?> value : attributeValues) { attributeMap.put(value.getName(), value); } } }