Class DiscriminatorState


  • public class DiscriminatorState
    extends Object
    Discriminator state for an instance location.
    • Constructor Detail

      • DiscriminatorState

        public DiscriminatorState()
    • Method Detail

      • matches

        public boolean matches​(String refSchema)
        Determines if there is a match of the mapped schema to the ref and update the matched schema if there is a match.
        Parameters:
        refSchema - the $ref value
        Returns:
        true if there is a match
      • getPropertyName

        public String getPropertyName()
        Gets the property name defined in the discriminator keyword schema.
        Returns:
      • setPropertyName

        public void setPropertyName​(String propertyName)
        Sets the property name defined in the discriminator keyword schema.
        Parameters:
        propertyName - the property name
      • getDiscriminatingValue

        public String getDiscriminatingValue()
        Gets the discriminating value, which is the value in the payload corresponding with the property name.
        Returns:
        the discriminating value
      • setDiscriminatingValue

        public void setDiscriminatingValue​(String discriminatingValue)
        Sets the discriminating value, which is the value in the payload corresponding with the property name.
        Parameters:
        discriminatingValue -
      • hasDiscriminatingValue

        public boolean hasDiscriminatingValue()
        Returns true if the discriminating value is found in the payload corresponding to the property name.
        Returns:
        true if the discriminating value is found in the payload corresponding to the property name
      • getMappedSchema

        public String getMappedSchema()
        Gets the mapped schema which is the discriminating value mapped to the schema name or uri.
        Returns:
        the mapped schema
      • setMappedSchema

        public void setMappedSchema​(String mappedSchema)
        Sets the mapped schema which is the discriminating value mapped to the schema name or uri.
        Parameters:
        mappedSchema - the mapped schema
      • isExplicitMapping

        public boolean isExplicitMapping()
        Gets whether the mapping is explicit using the mappings on the discriminator keyword.
        Returns:
        true if the mapping is explicitly mapped using mappings
      • setExplicitMapping

        public void setExplicitMapping​(boolean explicitMapping)
        Sets whether the mapping is explicit using the mappings on the discriminator keyword.
        Parameters:
        explicitMapping - true if explicitly mapped using mappings
      • setMatchedSchema

        public void setMatchedSchema​(String matchedSchema)
        Sets the matched schema $ref.
        Parameters:
        matchedSchema - the matched schema $ref
      • getMatchedSchema

        public String getMatchedSchema()
        Gets the matched schema $ref.
        Returns:
        the matched schema $ref
      • hasMatchedSchema

        public boolean hasMatchedSchema()
        Returns true if there was a schema that matched the discriminating value.

        If the discriminating value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Therefore if this returns false validation should fail.

        4.8.25.4 Examples

        Returns:
        true if there was a schema that matched the discriminating value.