- private void emitUnsignedIntegerSpecification(final UnsignedIntegerTypeDefinition typeDef) {
- emitRangeNodeOptional(typeDef.getRangeConstraints());
-
- }
-
- private void emitRangeNodeOptional(final List<RangeConstraint> list) {
- // FIXME: BUG-2444: Wrong decomposition in API, should be
- // LenghtConstraint
- // which contains ranges.
- if (!list.isEmpty()) {
- super.writer.startRangeNode(toRangeString(list));
- final RangeConstraint first = list.iterator().next();
- emitErrorMessageNode(first.getErrorMessage());
- emitErrorAppTagNode(first.getErrorAppTag());
- emitDescriptionNode(first.getDescription());
- emitReferenceNode(first.getReference());
- super.writer.endNode();
- }
-
+ private void emitRangeNode(final RangeConstraint<?> constraint) {
+ super.writer.startRangeNode(toRangeString(constraint.getAllowedRanges()));
+ constraint.getErrorMessage().ifPresent(this::emitErrorMessageNode);
+ constraint.getErrorAppTag().ifPresent(this::emitErrorAppTagNode);
+ emitDocumentedNode(constraint);
+ super.writer.endNode();