Class AttributeValidations


  • public class AttributeValidations
    extends java.lang.Object
    • Constructor Detail

      • AttributeValidations

        private AttributeValidations()
    • Method Detail

      • belongsToEnum

        public static <T extends XsdEnum> T belongsToEnum​(XsdEnum<T> instance,
                                                          java.lang.String value)
        Verifies if a given value is present in a given Enum type.
        Type Parameters:
        T - The concrete type of the Enum type.
        Parameters:
        instance - An instance of the concrete Enum type that is expected to contain the value received.
        value - The value that is expected to be present in the received Enum type.
        Returns:
        The instance of the concrete Enum type that represents value in the respective Enum.
      • maxOccursValidation

        static java.lang.String maxOccursValidation​(java.lang.String elementName,
                                                    java.lang.String value)
        Checks if the maxOccurs attribute is unbounded or an Integer value.
        Parameters:
        value - The possible maxOccurs value.
        elementName - The name of the element containing the maxOccurs attribute.
        Returns:
        The validated maxOccurs value.
      • validateNonNegativeInteger

        static java.lang.Integer validateNonNegativeInteger​(java.lang.String elementName,
                                                            java.lang.String attributeName,
                                                            java.lang.String value)
        Validates if a given String is a non negative Integer. Throws an exception if the String isn't a non negative Integer.
        Parameters:
        elementName - The element name containing the field with the Integer value.
        attributeName - The name of the attribute with the Integer.
        value - The value to be parsed to a Integer object.
        Returns:
        The parsed Integer value.
      • validateRequiredNonNegativeInteger

        public static java.lang.Integer validateRequiredNonNegativeInteger​(java.lang.String elementName,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String value)
        Validates if a given String is a non negative Integer. Throws an exception if the String isn't a non negative Integer.
        Parameters:
        elementName - The element name containing the field with the Integer value.
        attributeName - The name of the attribute with the Integer.
        value - The value to be parsed to a Integer object.
        Returns:
        The parsed Integer value.
      • validatePositiveInteger

        private static java.lang.Integer validatePositiveInteger​(java.lang.String elementName,
                                                                 java.lang.String attributeName,
                                                                 java.lang.String value)
        Validates if a given String is a positive Integer. Throws an exception if the String isn't a positive Integer.
        Parameters:
        elementName - The element name containing the field with the Integer value.
        attributeName - The name of the attribute with the Integer type.
        value - The value to be parsed to a Integer object.
        Returns:
        The parsed Integer value.
      • validateRequiredPositiveInteger

        public static java.lang.Integer validateRequiredPositiveInteger​(java.lang.String elementName,
                                                                        java.lang.String attributeName,
                                                                        java.lang.String value)
        Validates if a given String is a positive Integer. Throws an exception if the String isn't a positive Integer.
        Parameters:
        elementName - The element name containing the field with the Integer value.
        attributeName - The name of the attribute with the Integer type.
        value - The value to be parsed to a Integer object.
        Returns:
        The parsed Integer value.
      • validateBoolean

        public static java.lang.Boolean validateBoolean​(java.lang.String value)
      • validateDouble

        private static java.lang.Double validateDouble​(java.lang.String elementName,
                                                       java.lang.String attributeName,
                                                       java.lang.String value)
        Validates if a given String is a Double. Throws an exception if the String isn't a Double.
        Parameters:
        elementName - The element name containing the field with the Double value.
        attributeName - The name of the attribute with the type Double.
        value - The value to be parsed to a Double object.
        Returns:
        The parsed Double value.
      • validateRequiredDouble

        public static java.lang.Double validateRequiredDouble​(java.lang.String elementName,
                                                              java.lang.String attributeName,
                                                              java.lang.String value)
        Validates if a given String is a Double. Throws an exception if the String isn't a Double.
        Parameters:
        elementName - The element name containing the field with the Double value.
        attributeName - The name of the attribute with the type Double.
        value - The value to be parsed to a Double object.
        Returns:
        The parsed Double value.
      • attributeMissingMessage

        private static java.lang.String attributeMissingMessage​(java.lang.String elementName,
                                                                java.lang.String attributeName)