private static String createLengthString(final Collection<LengthConstraint> constraints) { final List<Range<BigInteger>> ranges = new ArrayList<>(constraints.size()); for (LengthConstraint c : constraints) { ranges.add(Range.closed(new BigInteger(c.getMin().toString()), new BigInteger(c.getMax().toString()))); } return ranges.toString(); }
private static final Collection<String> createExpressions(final Collection<LengthConstraint> constraints) { final Collection<String> ret = new ArrayList<>(constraints.size()); for (LengthConstraint l : constraints) { final StringBuilder sb = new StringBuilder("length >"); // We have to deal with restrictions being out of integer's range if (l.getMin().longValue() <= Integer.MAX_VALUE) { sb.append('='); } sb.append(' ').append(l.getMin().intValue()); final int max = l.getMax().intValue(); if (max < Integer.MAX_VALUE) { sb.append(" && length <= ").append(max); } ret.add(sb.toString()); } return ret; }
private static void processStringType(final StringTypeDefinition stringType, final JSONObject property) throws JSONException { StringTypeDefinition type = stringType; List<LengthConstraint> lengthConstraints = stringType.getLengthConstraints(); while (lengthConstraints.isEmpty() && type.getBaseType() != null) { type = type.getBaseType(); lengthConstraints = type.getLengthConstraints(); } // FIXME: json-schema is not expressive enough to capture min/max laternatives. We should find the true minimum // and true maximum implied by the constraints and use that. for (LengthConstraint lengthConstraint : lengthConstraints) { Number min = lengthConstraint.getMin(); Number max = lengthConstraint.getMax(); property.putOpt(MIN_LENGTH_KEY, min); property.putOpt(MAX_LENGTH_KEY, max); } property.put(TYPE_KEY, STRING); }
_builder.append(_numericValue, " "); _builder.append(", "); Number _max = r.getMax(); String _numericValue_1 = this.numericValue(numberClass, _max); _builder.append(_numericValue_1, " ");
_builder.append(_numericValue, ""); _builder.append(", "); Number _max = r.getMax(); String _numericValue_1 = this.numericValue(numberClass, _max); _builder.append(_numericValue_1, "");