Class NegativeOrZeroConstraint
- java.lang.Object
-
- graphql.validation.constraints.AbstractDirectiveConstraint
-
- graphql.validation.constraints.standard.NegativeOrZeroConstraint
-
- All Implemented Interfaces:
DirectiveConstraint,ValidationRule
public class NegativeOrZeroConstraint extends AbstractDirectiveConstraint
-
-
Constructor Summary
Constructors Constructor Description NegativeOrZeroConstraint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanappliesToListElements()booleanappliesToType(graphql.schema.GraphQLInputType inputType)A derived class will be called to indicate whether this input type applies to the constraintjava.util.List<graphql.schema.GraphQLScalarType>getApplicableTypes()DocumentationgetDocumentation()protected booleanisOK(java.math.BigDecimal bigDecimal)protected java.util.List<graphql.GraphQLError>runConstraint(ValidationEnvironment validationEnvironment)This is called to perform the constraint validation-
Methods inherited from class graphql.validation.constraints.AbstractDirectiveConstraint
appliesTo, appliesTo, asBigDecimal, asBoolean, asMap, getBoolArg, getIntArg, getMessageTemplate, getMessageTemplate, getName, getStrArg, getStringOrIDOrObjectOrMapLength, isMap, isOneOfTheseTypes, isOneOfTheseTypes, isStringOrID, isStringOrIDOrList, isStringOrIDOrListOrMap, mkError, mkError, mkMessageParams, runValidation, toString
-
-
-
-
Method Detail
-
getDocumentation
public Documentation getDocumentation()
- Returns:
- documentation meta data about this constraint
-
isOK
protected boolean isOK(java.math.BigDecimal bigDecimal)
-
appliesToType
public boolean appliesToType(graphql.schema.GraphQLInputType inputType)
Description copied from class:AbstractDirectiveConstraintA derived class will be called to indicate whether this input type applies to the constraint- Specified by:
appliesToTypein classAbstractDirectiveConstraint- Parameters:
inputType- the input type- Returns:
- true if the constraint can handle that type
-
getApplicableTypes
public java.util.List<graphql.schema.GraphQLScalarType> getApplicableTypes()
-
runConstraint
protected java.util.List<graphql.GraphQLError> runConstraint(ValidationEnvironment validationEnvironment)
Description copied from class:AbstractDirectiveConstraintThis is called to perform the constraint validation- Specified by:
runConstraintin classAbstractDirectiveConstraint- Parameters:
validationEnvironment- the validation environment- Returns:
- a list of errors or an empty one if there are no errors
-
appliesToListElements
protected boolean appliesToListElements()
- Specified by:
appliesToListElementsin classAbstractDirectiveConstraint
-
-