public void addLongAttribute(final String key, final long value) { addAttribute(new LongAttributeValue(new JavaSymbolName(key), value)); }
@Override public String toString() { return getName() + " -> " + value; } }
attributeValue = ((IntegerAttributeValue) value).getValue().toString(); } else if (value instanceof LongAttributeValue) { attributeValue = ((LongAttributeValue) value).getValue().toString() + "L"; } else if (value instanceof StringAttributeValue) { attributeValue = "\"" + ((StringAttributeValue) value).getValue() + "\"";
final Long castValue = ((LongAttributeValue) value).getValue(); final LongLiteralExpr convertedValue = new LongLiteralExpr(castValue.toString() + "L"); return new MemberValuePair(value.getName().getSymbolName(), convertedValue);
@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)); }
attributeValue = ((IntegerAttributeValue) value).getValue().toString(); } else if (value instanceof LongAttributeValue) { attributeValue = ((LongAttributeValue) value).getValue().toString() + "L"; } else if (value instanceof StringAttributeValue) { attributeValue = "\"" + ((StringAttributeValue) value).getValue() + "\"";
@Override public String toString() { return getName() + " -> " + value; } }
value = value.substring(0, value.length() - 1); final long l = new Long(value); return new LongAttributeValue(annotationName, l); value = value.toUpperCase().endsWith("L") ? value.substring(0, value.length() - 1) : value; final long l = new Long(value); return new LongAttributeValue(annotationName, l); } else { throw new UnsupportedOperationException("Only negative operator in UnaryExpr is supported");
public void addLongAttribute(final String key, final long value) { addAttribute(new LongAttributeValue(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)); }