- private void processExtendedType(final TypeDefinition<?> leafTypeDef, final JSONObject property) throws JSONException {
- TypeDefinition<?> leafBaseType = leafTypeDef.getBaseType();
- if (leafBaseType instanceof ExtendedType) {
- // recursively process an extended type until we hit a base type
- processExtendedType(leafBaseType, property);
- } else {
- List<LengthConstraint> lengthConstraints = ((ExtendedType) leafTypeDef).getLengthConstraints();
- for (LengthConstraint lengthConstraint : lengthConstraints) {
- Number min = lengthConstraint.getMin();
- Number max = lengthConstraint.getMax();
- property.putOpt(MIN_LENGTH_KEY, min);
- property.putOpt(MAX_LENGTH_KEY, max);
- }
- String jsonType = jsonTypeFor(leafBaseType);
- property.putOpt(TYPE_KEY, jsonType);
- }
-
- }
-