Package org.xmlet.xsdparser.xsdelements
Class AttributeValidations
- java.lang.Object
-
- org.xmlet.xsdparser.xsdelements.AttributeValidations
-
public class AttributeValidations extends java.lang.Object
-
-
Constructor Summary
Constructors Modifier Constructor Description privateAttributeValidations()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringattributeMissingMessage(java.lang.String elementName, java.lang.String attributeName)static <T extends XsdEnum>
TbelongsToEnum(XsdEnum<T> instance, java.lang.String value)Verifies if a given value is present in a givenEnumtype.(package private) static java.lang.StringgetBlockDefaultValue(XsdAbstractElement parent)Obtains the default value of theXsdSchema.blockDefaultattribute by iterating in the element tree by going fromXsdAbstractElement.parenttoXsdAbstractElement.parentuntil reaching the top level element.(package private) static java.lang.StringgetFinalDefaultValue(XsdAbstractElement parent)Obtains the default value of theXsdSchema.finalDefaultattribute by iterating in the element tree by going fromXsdAbstractElement.parenttoXsdAbstractElement.parentuntil reaching the top level element.(package private) static java.lang.StringgetFormDefaultValue(XsdAbstractElement parent)Obtains the default value of theXsdSchema.attributeFormDefaultattribute by iterating in the element tree by going fromXsdAbstractElement.parenttoXsdAbstractElement.parentuntil reaching the top level element.(package private) static java.lang.StringmaxOccursValidation(java.lang.String elementName, java.lang.String value)Checks if the maxOccurs attribute is unbounded or anIntegervalue.static java.lang.BooleanvalidateBoolean(java.lang.String value)private static java.lang.DoublevalidateDouble(java.lang.String elementName, java.lang.String attributeName, java.lang.String value)Validates if a givenStringis aDouble.(package private) static java.lang.IntegervalidateNonNegativeInteger(java.lang.String elementName, java.lang.String attributeName, java.lang.String value)Validates if a given String is a non negativeInteger.private static java.lang.IntegervalidatePositiveInteger(java.lang.String elementName, java.lang.String attributeName, java.lang.String value)Validates if a given String is a positiveInteger.static java.lang.DoublevalidateRequiredDouble(java.lang.String elementName, java.lang.String attributeName, java.lang.String value)Validates if a givenStringis aDouble.static java.lang.IntegervalidateRequiredNonNegativeInteger(java.lang.String elementName, java.lang.String attributeName, java.lang.String value)Validates if a given String is a non negativeInteger.static java.lang.IntegervalidateRequiredPositiveInteger(java.lang.String elementName, java.lang.String attributeName, java.lang.String value)Validates if a given String is a positiveInteger.
-
-
-
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 givenEnumtype.- Type Parameters:
T- The concrete type of theEnumtype.- Parameters:
instance- An instance of the concreteEnumtype that is expected to contain thevaluereceived.value- The value that is expected to be present in the receivedEnumtype.- Returns:
- The instance of the concrete
Enumtype that representsvaluein the respectiveEnum.
-
maxOccursValidation
static java.lang.String maxOccursValidation(java.lang.String elementName, java.lang.String value)Checks if the maxOccurs attribute is unbounded or anIntegervalue.- 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 negativeInteger. Throws an exception if theStringisn't a non negativeInteger.- Parameters:
elementName- The element name containing the field with theIntegervalue.attributeName- The name of the attribute with theInteger.value- The value to be parsed to aIntegerobject.- Returns:
- The parsed
Integervalue.
-
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 negativeInteger. Throws an exception if theStringisn't a non negativeInteger.- Parameters:
elementName- The element name containing the field with theIntegervalue.attributeName- The name of the attribute with theInteger.value- The value to be parsed to aIntegerobject.- Returns:
- The parsed
Integervalue.
-
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 positiveInteger. Throws an exception if theStringisn't a positiveInteger.- Parameters:
elementName- The element name containing the field with theIntegervalue.attributeName- The name of the attribute with theIntegertype.value- The value to be parsed to aIntegerobject.- Returns:
- The parsed
Integervalue.
-
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 positiveInteger. Throws an exception if theStringisn't a positiveInteger.- Parameters:
elementName- The element name containing the field with theIntegervalue.attributeName- The name of the attribute with theIntegertype.value- The value to be parsed to aIntegerobject.- Returns:
- The parsed
Integervalue.
-
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 givenStringis aDouble. Throws an exception if theStringisn't aDouble.- Parameters:
elementName- The element name containing the field with theDoublevalue.attributeName- The name of the attribute with the typeDouble.value- The value to be parsed to aDoubleobject.- Returns:
- The parsed
Doublevalue.
-
validateRequiredDouble
public static java.lang.Double validateRequiredDouble(java.lang.String elementName, java.lang.String attributeName, java.lang.String value)Validates if a givenStringis aDouble. Throws an exception if theStringisn't aDouble.- Parameters:
elementName- The element name containing the field with theDoublevalue.attributeName- The name of the attribute with the typeDouble.value- The value to be parsed to aDoubleobject.- Returns:
- The parsed
Doublevalue.
-
getFormDefaultValue
static java.lang.String getFormDefaultValue(XsdAbstractElement parent)
Obtains the default value of theXsdSchema.attributeFormDefaultattribute by iterating in the element tree by going fromXsdAbstractElement.parenttoXsdAbstractElement.parentuntil reaching the top level element.- Parameters:
parent- The parent of the element requesting the default form value.- Returns:
- The default value for the form attribute.
-
getFinalDefaultValue
static java.lang.String getFinalDefaultValue(XsdAbstractElement parent)
Obtains the default value of theXsdSchema.finalDefaultattribute by iterating in the element tree by going fromXsdAbstractElement.parenttoXsdAbstractElement.parentuntil reaching the top level element.- Parameters:
parent- The parent of the element requesting the default final value.- Returns:
- The default value for the final attribute.
-
getBlockDefaultValue
static java.lang.String getBlockDefaultValue(XsdAbstractElement parent)
Obtains the default value of theXsdSchema.blockDefaultattribute by iterating in the element tree by going fromXsdAbstractElement.parenttoXsdAbstractElement.parentuntil reaching the top level element.- Parameters:
parent- The parent of the element requesting the default block value.- Returns:
- The default value for the block attribute.
-
attributeMissingMessage
private static java.lang.String attributeMissingMessage(java.lang.String elementName, java.lang.String attributeName)
-
-