/** * Reads the attribute maxOccurs of the element tag and configures the SType with its maximum size * @param element The element tag * @param newType The SType that is represented by the element tag */ private static void readXsdOwnAttributeMaxOccurs(ElementReader element, SType<?> newType) { String value = element.getAttr("maxOccurs"); if (value != null && !"unbounded".equalsIgnoreCase(value)) { int maxOccurs = Integer.parseInt(value); if (newType.isList()) { ((STypeList<?, ?>) newType).withMaximumSizeOf(maxOccurs); } } }
private static void readXsdOwnAttributeMaxOccurs(ElementReader element, SType<?> newType) { String value = element.getAttr("maxOccurs"); if ("unbounded".equalsIgnoreCase(value)) { if (!newType.isList()) { throw new SingularFormException(element.errorMsgInvalidAttribute("maxOccurs"), newType); } } else if (value != null) { int maxOccurs = Integer.parseInt(value); if (newType.isList()) { ((STypeList) newType).withMaximumSizeOf(maxOccurs); } else if (maxOccurs != 1) { throw new SingularFormException(element.errorMsgInvalidAttribute("maxOccurs"), newType); } } }
private static void readXsdOwnAttributeMaxOccurs(ElementReader element, SType<?> newType) { String value = element.getAttr("maxOccurs"); if ("unbounded".equalsIgnoreCase(value)) { if (!newType.isList()) { throw new SingularFormException(element.errorMsgInvalidAttribute("maxOccurs")); } } else if (value != null) { int maxOccurs = Integer.parseInt(value); if (newType.isList()) { ((STypeList) newType).withMaximumSizeOf(maxOccurs); } else if (maxOccurs != 1) { throw new SingularFormException(element.errorMsgInvalidAttribute("maxOccurs")); } } }