Package org.xmlet.xsdparser.xsdelements
Class XsdSimpleType
- java.lang.Object
-
public class XsdSimpleType extends XsdNamedElements
A class representing the xsd:simpleType element.
-
-
Field Summary
Fields Modifier and Type Field Description private SimpleTypeFinalEnumfinalObjPrevents other elements to derive depending on its value.private XsdListlistAXsdListinstance that is present in theXsdSimpleTypeinstance.private XsdRestrictionrestrictionAXsdRestrictioninstance that is present in theXsdSimpleTypeinstance.static java.lang.StringTAGprivate XsdUnionunionAXsdUnioninstance that is present in theXsdSimpleTypeinstance.static java.lang.StringXS_TAGstatic java.lang.StringXSD_TAG-
Fields inherited from class org.xmlet.xsdparser.xsdelements.XsdNamedElements
name
-
Fields inherited from class org.xmlet.xsdparser.xsdelements.XsdAbstractElement
ABSTRACT_TAG, ATTRIBUTE_FORM_DEFAULT, attributesMap, BASE_TAG, BLOCK_DEFAULT, BLOCK_TAG, cloneOf, DEFAULT_ELEMENT_TAG, DEFAULT_TAG, ELEMENT_FORM_DEFAULT, FINAL_DEFAULT, FINAL_TAG, FIXED_TAG, FORM_TAG, ID_TAG, ITEM_TYPE_TAG, MAX_OCCURS_TAG, MEMBER_TYPES_TAG, MIN_OCCURS_TAG, MIXED_TAG, NAME_TAG, NAMESPACE, NILLABLE_TAG, parent, parentAvailable, parser, REF_TAG, SCHEMA_LOCATION, SOURCE_TAG, SUBSTITUTION_GROUP_TAG, TARGET_NAMESPACE, TYPE_TAG, USE_TAG, VALUE_TAG, VERSION, visitor, visitorFunction, XML_LANG_TAG, XMLNS
-
-
Constructor Summary
Constructors Constructor Description XsdSimpleType(XsdParserCore parser, java.util.Map<java.lang.String,java.lang.String> attributesMap, java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)XsdSimpleType(XsdAbstractElement parent, XsdParserCore parser, java.util.Map<java.lang.String,java.lang.String> elementFieldsMapParam, java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(XsdAbstractElementVisitor visitorParam)Base method for all accept methods.XsdSimpleTypeclone(java.util.Map<java.lang.String,java.lang.String> placeHolderAttributes)Performs a copy of the current object for replacing purposes.private booleanexistsRestrictionOverlap(XsdRestriction existing, XsdRestriction newRestriction)Checks for any restriction overlap between two differentXsdRestrictioninstances.java.util.List<XsdRestriction>getAllRestrictions()This method obtains all the restrictions for the currentXsdSimpleTypeelement.java.lang.StringgetFinalObj()XsdListgetList()XsdRestrictiongetRestriction()XsdUniongetUnion()static ReferenceBaseparse(ParseData parseData)private voidrule2()Asserts that the current object has the required name attribute when not being a direct child of the XsdSchema element.private voidrule3()Asserts if the current has no value for its name attribute while being a direct child of the top level XsdSchema element, which is required.voidsetList(XsdList list)voidsetRestriction(XsdRestriction restriction)voidsetUnion(XsdUnion union)private voidupdateExistingRestriction(XsdRestriction existing, XsdRestriction newRestriction)Joins two distinctXsdRestrictioninstances.private voidupdateExistingRestrictionEnumerations(XsdRestriction existing, XsdRestriction newRestriction)Updates the existingXsdRestrictionwith the restrictions of the newXsdRestrictioninstance.voidvalidateSchemaRules()Runs verifications on each concrete element to ensure that the XSD schema rules are verified.-
Methods inherited from class org.xmlet.xsdparser.xsdelements.XsdNamedElements
getName, getRawName, setName
-
Methods inherited from class org.xmlet.xsdparser.xsdelements.XsdAnnotatedElements
getAnnotation, setAnnotation
-
Methods inherited from class org.xmlet.xsdparser.xsdelements.XsdIdentifierElements
getId
-
Methods inherited from class org.xmlet.xsdparser.xsdelements.XsdAbstractElement
clone, compareReference, compareReference, convertNodeMap, getAttributesMap, getCloneOf, getElements, getParent, getParent, getParser, getVisitor, getXsdElements, getXsdSchema, getXsdSchema, replaceUnsolvedElements, setCloneOf, setParent, setParentAvailable, xsdParseSkeleton, xsdRawContentParse
-
-
-
-
Field Detail
-
XSD_TAG
public static final java.lang.String XSD_TAG
- See Also:
- Constant Field Values
-
XS_TAG
public static final java.lang.String XS_TAG
- See Also:
- Constant Field Values
-
TAG
public static final java.lang.String TAG
- See Also:
- Constant Field Values
-
restriction
private XsdRestriction restriction
AXsdRestrictioninstance that is present in theXsdSimpleTypeinstance.
-
union
private XsdUnion union
AXsdUnioninstance that is present in theXsdSimpleTypeinstance.
-
list
private XsdList list
AXsdListinstance that is present in theXsdSimpleTypeinstance.
-
finalObj
private SimpleTypeFinalEnum finalObj
Prevents other elements to derive depending on its value.
-
-
Constructor Detail
-
XsdSimpleType
XsdSimpleType(@NotNull XsdParserCore parser, @NotNull java.util.Map<java.lang.String,java.lang.String> attributesMap, @NotNull java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
XsdSimpleType
XsdSimpleType(XsdAbstractElement parent, XsdParserCore parser, @NotNull java.util.Map<java.lang.String,java.lang.String> elementFieldsMapParam, @NotNull java.util.function.Function<XsdAbstractElement,XsdAbstractElementVisitor> visitorFunction)
-
-
Method Detail
-
validateSchemaRules
public void validateSchemaRules()
Runs verifications on each concrete element to ensure that the XSD schema rules are verified.- Overrides:
validateSchemaRulesin classXsdNamedElements
-
rule2
private void rule2()
Asserts that the current object has the required name attribute when not being a direct child of the XsdSchema element. Throws an exception if the required attribute is not present.
-
rule3
private void rule3()
Asserts if the current has no value for its name attribute while being a direct child of the top level XsdSchema element, which is required. Throws an exception if no name is present.
-
accept
public void accept(XsdAbstractElementVisitor visitorParam)
Description copied from class:XsdAbstractElementBase method for all accept methods. It serves as a way to guarantee that every accept call assigns the parent field.- Overrides:
acceptin classXsdAbstractElement- Parameters:
visitorParam- The visitor that is visiting the current instance.
-
clone
public XsdSimpleType clone(@NotNull java.util.Map<java.lang.String,java.lang.String> placeHolderAttributes)
Performs a copy of the current object for replacing purposes. The cloned objects are used to replaceUnsolvedReferenceobjects in the reference solving process.- Overrides:
clonein classXsdAbstractElement- Parameters:
placeHolderAttributes- The additional attributes to add to the clone.- Returns:
- A copy of the object from which is called upon.
-
parse
public static ReferenceBase parse(@NotNull ParseData parseData)
-
getRestriction
public XsdRestriction getRestriction()
-
getUnion
public XsdUnion getUnion()
-
getList
public XsdList getList()
-
getAllRestrictions
public java.util.List<XsdRestriction> getAllRestrictions()
This method obtains all the restrictions for the currentXsdSimpleTypeelement. It also joins multiple restrictions with the same base attribute in the sameXsdRestrictionobject, if a overlap doesn't occur. In case of restriction overlap an exception is thrown because the information on the xsd file is contradictory.- Returns:
- A list of restrictions.
-
updateExistingRestriction
private void updateExistingRestriction(XsdRestriction existing, XsdRestriction newRestriction)
Joins two distinctXsdRestrictioninstances. This method assumes that the information of bothXsdRestrictionobjects don't have overlapping or contradictory information.- Parameters:
existing- The existing restriction.newRestriction- The new restriction.
-
updateExistingRestrictionEnumerations
private void updateExistingRestrictionEnumerations(XsdRestriction existing, XsdRestriction newRestriction)
Updates the existingXsdRestrictionwith the restrictions of the newXsdRestrictioninstance.- Parameters:
existing- The existingXsdRestrictioninstance.newRestriction- The newXsdRestrictioninstance.
-
existsRestrictionOverlap
private boolean existsRestrictionOverlap(XsdRestriction existing, XsdRestriction newRestriction)
Checks for any restriction overlap between two differentXsdRestrictioninstances.- Parameters:
existing- The existing restriction.newRestriction- The second restriction found.- Returns:
- True if an overlap between the restrictions occur, false if it doesn't occur.
-
setList
public void setList(XsdList list)
-
setUnion
public void setUnion(XsdUnion union)
-
setRestriction
public void setRestriction(XsdRestriction restriction)
-
getFinalObj
public java.lang.String getFinalObj()
-
-