@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); if (sizeMin != null || sizeMax != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); if (sizeMin != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("min"), sizeMin)); } if (sizeMax != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("max"), sizeMax)); } annotations.add(new AnnotationMetadataBuilder(SIZE, attrs)); } }
@Override public String toString() { return getName() + " -> " + value; } }
attributeValue = ((IntegerAttributeValue) value).getValue().toString(); } else if (value instanceof LongAttributeValue) { attributeValue = ((LongAttributeValue) value).getValue().toString() + "L";
final Integer castValue = ((IntegerAttributeValue) value).getValue(); final IntegerLiteralExpr convertedValue = new IntegerLiteralExpr(castValue.toString()); return new MemberValuePair(value.getName().getSymbolName(), convertedValue);
@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); if (sizeMin != null || sizeMax != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); if (sizeMin != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("min"), sizeMin)); } if (sizeMax != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("max"), sizeMax)); } annotations.add(new AnnotationMetadataBuilder(SIZE, attrs)); } if (regexp != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new StringAttributeValue(new JavaSymbolName("regexp"), regexp)); annotations.add(new AnnotationMetadataBuilder(PATTERN, attrs)); } }
attributeValue = ((IntegerAttributeValue) value).getValue().toString(); } else if (value instanceof LongAttributeValue) { attributeValue = ((LongAttributeValue) value).getValue().toString() + "L";
@Override public String toString() { return getName() + " -> " + value; } }
public void addIntegerAttribute(final String key, final int value) { addAttribute(new IntegerAttributeValue(new JavaSymbolName(key), value)); }
@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); if (min != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new LongAttributeValue(new JavaSymbolName("value"), min)); annotations.add(new AnnotationMetadataBuilder(MIN, attrs)); } if (max != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new LongAttributeValue(new JavaSymbolName("value"), max)); annotations.add(new AnnotationMetadataBuilder(MAX, attrs)); } Validate.isTrue(isDigitsSetCorrectly(), "Validation constraints for @Digit are not correctly set"); if (digitsInteger != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new IntegerAttributeValue(new JavaSymbolName("integer"), digitsInteger)); attrs.add(new IntegerAttributeValue(new JavaSymbolName("fraction"), digitsFraction)); annotations.add(new AnnotationMetadataBuilder(DIGITS, attrs)); } // Always add a default @NumberFormat annotations.add(new AnnotationMetadataBuilder(SpringJavaType.NUMBER_FORMAT)); }
final String value = ((IntegerLiteralExpr) expression).getValue(); final int i = new Integer(value); return new IntegerAttributeValue(annotationName, i);
@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); if (sizeMin != null || sizeMax != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); if (sizeMin != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("min"), sizeMin)); } if (sizeMax != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("max"), sizeMax)); } annotations.add(new AnnotationMetadataBuilder(SIZE, attrs)); } }
@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); if (sizeMin != null || sizeMax != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); if (sizeMin != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("min"), sizeMin)); } if (sizeMax != null) { attrs.add(new IntegerAttributeValue(new JavaSymbolName("max"), sizeMax)); } annotations.add(new AnnotationMetadataBuilder(SIZE, attrs)); } if (regexp != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new StringAttributeValue(new JavaSymbolName("regexp"), regexp)); annotations.add(new AnnotationMetadataBuilder(PATTERN, attrs)); } }
public void addIntegerAttribute(final String key, final int value) { addAttribute(new IntegerAttributeValue(new JavaSymbolName(key), value)); }
@Override public void decorateAnnotationsList(final List<AnnotationMetadataBuilder> annotations) { super.decorateAnnotationsList(annotations); if (min != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new LongAttributeValue(new JavaSymbolName("value"), min)); annotations.add(new AnnotationMetadataBuilder(MIN, attrs)); } if (max != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new LongAttributeValue(new JavaSymbolName("value"), max)); annotations.add(new AnnotationMetadataBuilder(MAX, attrs)); } Validate.isTrue(isDigitsSetCorrectly(), "Validation constraints for @Digit are not correctly set"); if (digitsInteger != null) { final List<AnnotationAttributeValue<?>> attrs = new ArrayList<AnnotationAttributeValue<?>>(); attrs.add(new IntegerAttributeValue(new JavaSymbolName("integer"), digitsInteger)); attrs.add(new IntegerAttributeValue(new JavaSymbolName("fraction"), digitsFraction)); annotations.add(new AnnotationMetadataBuilder(DIGITS, attrs)); } // Always add a default @NumberFormat annotations.add(new AnnotationMetadataBuilder(SpringJavaType.NUMBER_FORMAT)); }