Package com.networknt.schema.keyword
Class DiscriminatorState
- java.lang.Object
-
- com.networknt.schema.keyword.DiscriminatorState
-
public class DiscriminatorState extends Object
Discriminator state for an instance location.
-
-
Constructor Summary
Constructors Constructor Description DiscriminatorState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDiscriminatingValue()Gets the discriminating value, which is the value in the payload corresponding with the property name.StringgetMappedSchema()Gets the mapped schema which is the discriminating value mapped to the schema name or uri.StringgetMatchedSchema()Gets the matched schema $ref.StringgetPropertyName()Gets the property name defined in the discriminator keyword schema.booleanhasDiscriminatingValue()Returns true if the discriminating value is found in the payload corresponding to the property name.booleanhasMatchedSchema()Returns true if there was a schema that matched the discriminating value.booleanisExplicitMapping()Gets whether the mapping is explicit using the mappings on the discriminator keyword.booleanmatches(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.voidsetDiscriminatingValue(String discriminatingValue)Sets the discriminating value, which is the value in the payload corresponding with the property name.voidsetExplicitMapping(boolean explicitMapping)Sets whether the mapping is explicit using the mappings on the discriminator keyword.voidsetMappedSchema(String mappedSchema)Sets the mapped schema which is the discriminating value mapped to the schema name or uri.voidsetMatchedSchema(String matchedSchema)Sets the matched schema $ref.voidsetPropertyName(String propertyName)Sets the property name defined in the discriminator keyword schema.
-
-
-
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.
- Returns:
- true if there was a schema that matched the discriminating value.
-
-