import dk.brics.automaton.RegExp;
import java.io.IOException;
import java.math.BigDecimal;
+import java.math.BigInteger;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
}
if (leafTypeDef instanceof DecimalTypeDefinition) {
+ leafTypeDef.getDefaultValue().ifPresent(number ->
+ setDefaultValue(property, Decimal64.valueOf((String) number).decimalValue()));
maybeLower.ifPresent(number -> setExampleValue(property, ((Decimal64) number).decimalValue()));
return NUMBER_TYPE;
}
|| leafTypeDef instanceof Int32TypeDefinition) {
property.put(FORMAT_KEY, INT32_FORMAT);
+ leafTypeDef.getDefaultValue().ifPresent(number -> setDefaultValue(property,
+ Integer.valueOf((String) number)));
maybeLower.ifPresent(number -> setExampleValue(property, Integer.valueOf(number.toString())));
} else if (leafTypeDef instanceof Uint32TypeDefinition
|| leafTypeDef instanceof Int64TypeDefinition) {
property.put(FORMAT_KEY, INT64_FORMAT);
+ leafTypeDef.getDefaultValue().ifPresent(number -> setDefaultValue(property,
+ Long.valueOf((String) number)));
maybeLower.ifPresent(number -> setExampleValue(property, Long.valueOf(number.toString())));
} else {
//uint64
+ leafTypeDef.getDefaultValue().ifPresent(number -> setDefaultValue(property,
+ new BigInteger((String) number)));
setExampleValue(property, 0);
}
return INTEGER_TYPE;
property.put(DEFAULT_KEY, value);
}
+ private static void setDefaultValue(final ObjectNode property, final Integer value) {
+ property.put(DEFAULT_KEY, value);
+ }
+
private static void setDefaultValue(final ObjectNode property, final Long value) {
property.put(DEFAULT_KEY, value);
}
+ private static void setDefaultValue(final ObjectNode property, final BigInteger value) {
+ property.put(DEFAULT_KEY, value);
+ }
+
private static void setDefaultValue(final ObjectNode property, final BigDecimal value) {
property.put(DEFAULT_KEY, value);
}