Class AttributeCollector
- java.lang.Object
-
- com.github.victools.jsonschema.generator.impl.AttributeCollector
-
public class AttributeCollector extends Object
Helper class for looking-up various attribute values for a field or method via a given configuration instance.
-
-
Constructor Summary
Constructors Constructor Description AttributeCollector(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Constructor accepting the object mapper to use.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static com.fasterxml.jackson.databind.node.ObjectNode
collectFieldAttributes(FieldScope field, SchemaGeneratorConfig config)
Collect a field's contextual attributes (i.e.static com.fasterxml.jackson.databind.node.ObjectNode
collectMethodAttributes(MethodScope method, SchemaGeneratorConfig config)
Collect a method's contextual attributes (i.e.static com.fasterxml.jackson.databind.node.ObjectNode
collectTypeAttributes(TypeScope scope, SchemaGeneratorConfig config)
Collect a given scope's general type attributes (i.e.AttributeCollector
setArrayMaxItems(com.fasterxml.jackson.databind.node.ObjectNode node, Integer maxItemCount)
Setter for ""maxItems"" attribute.AttributeCollector
setArrayMinItems(com.fasterxml.jackson.databind.node.ObjectNode node, Integer minItemCount)
Setter for ""minItems"" attribute.AttributeCollector
setArrayUniqueItems(com.fasterxml.jackson.databind.node.ObjectNode node, Boolean uniqueItems)
Setter for ""uniqueItems"" attribute.AttributeCollector
setDefault(com.fasterxml.jackson.databind.node.ObjectNode node, Object defaultValue)
Setter for ""default"" attribute.AttributeCollector
setDescription(com.fasterxml.jackson.databind.node.ObjectNode node, String description)
Setter for ""description"" attribute.AttributeCollector
setEnum(com.fasterxml.jackson.databind.node.ObjectNode node, Collection<?> enumValues)
AttributeCollector
setNumberExclusiveMaximum(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal exclusiveMaximum)
Setter for ""exclusiveMaximum"" attribute.AttributeCollector
setNumberExclusiveMinimum(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal exclusiveMinimum)
Setter for ""exclusiveMinimum"" attribute.AttributeCollector
setNumberInclusiveMaximum(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal inclusiveMaximum)
Setter for ""maximum"" attribute.AttributeCollector
setNumberInclusiveMinimum(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal inclusiveMinimum)
Setter for ""minimum"" attribute.AttributeCollector
setNumberMultipleOf(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal multipleOf)
Setter for ""multipleOf"" attribute.AttributeCollector
setStringFormat(com.fasterxml.jackson.databind.node.ObjectNode node, String format)
Setter for ""format"" attribute.AttributeCollector
setStringMaxLength(com.fasterxml.jackson.databind.node.ObjectNode node, Integer maxLength)
Setter for ""maxLength"" attribute.AttributeCollector
setStringMinLength(com.fasterxml.jackson.databind.node.ObjectNode node, Integer minLength)
Setter for ""minLength"" attribute.AttributeCollector
setStringPattern(com.fasterxml.jackson.databind.node.ObjectNode node, String pattern)
Setter for ""pattern"" attribute.AttributeCollector
setTitle(com.fasterxml.jackson.databind.node.ObjectNode node, String title)
Setter for ""title"" attribute.
-
-
-
Method Detail
-
collectFieldAttributes
public static com.fasterxml.jackson.databind.node.ObjectNode collectFieldAttributes(FieldScope field, SchemaGeneratorConfig config)
Collect a field's contextual attributes (i.e. everything not related to the structure).- Parameters:
field
- the field for which to collect JSON schema attributesconfig
- configuration to apply when looking-up attribute values- Returns:
- node holding all collected attributes (possibly empty)
-
collectMethodAttributes
public static com.fasterxml.jackson.databind.node.ObjectNode collectMethodAttributes(MethodScope method, SchemaGeneratorConfig config)
Collect a method's contextual attributes (i.e. everything not related to the structure).- Parameters:
method
- the method for which to collect JSON schema attributesconfig
- configuration to apply when looking-up attribute values- Returns:
- node holding all collected attributes (possibly empty)
-
collectTypeAttributes
public static com.fasterxml.jackson.databind.node.ObjectNode collectTypeAttributes(TypeScope scope, SchemaGeneratorConfig config)
Collect a given scope's general type attributes (i.e. everything not related to the structure).- Parameters:
scope
- the scope/type representation for which to collect JSON schema attributesconfig
- configuration to apply when looking-up attribute values- Returns:
- node holding all collected attributes (possibly empty)
-
setTitle
public AttributeCollector setTitle(com.fasterxml.jackson.databind.node.ObjectNode node, String title)
Setter for ""title"" attribute.- Parameters:
node
- schema node to set attribute ontitle
- attribute value to set- Returns:
- this instance (for chaining)
-
setDescription
public AttributeCollector setDescription(com.fasterxml.jackson.databind.node.ObjectNode node, String description)
Setter for ""description"" attribute.- Parameters:
node
- schema node to set attribute ondescription
- attribute value to set- Returns:
- this instance (for chaining)
-
setDefault
public AttributeCollector setDefault(com.fasterxml.jackson.databind.node.ObjectNode node, Object defaultValue)
Setter for ""default"" attribute.- Parameters:
node
- schema node to set attribute ondefaultValue
- attribute value to set- Returns:
- this instance (for chaining)
-
setEnum
public AttributeCollector setEnum(com.fasterxml.jackson.databind.node.ObjectNode node, Collection<?> enumValues)
- Parameters:
node
- schema node to set attribute onenumValues
- attribute value to set- Returns:
- this instance (for chaining)
-
setStringMinLength
public AttributeCollector setStringMinLength(com.fasterxml.jackson.databind.node.ObjectNode node, Integer minLength)
Setter for ""minLength"" attribute.- Parameters:
node
- schema node to set attribute onminLength
- attribute value to set- Returns:
- this instance (for chaining)
-
setStringMaxLength
public AttributeCollector setStringMaxLength(com.fasterxml.jackson.databind.node.ObjectNode node, Integer maxLength)
Setter for ""maxLength"" attribute.- Parameters:
node
- schema node to set attribute onmaxLength
- attribute value to set- Returns:
- this instance (for chaining)
-
setStringFormat
public AttributeCollector setStringFormat(com.fasterxml.jackson.databind.node.ObjectNode node, String format)
Setter for ""format"" attribute.- Parameters:
node
- schema node to set attribute onformat
- attribute value to set- Returns:
- this instance (for chaining)
-
setStringPattern
public AttributeCollector setStringPattern(com.fasterxml.jackson.databind.node.ObjectNode node, String pattern)
Setter for ""pattern"" attribute.- Parameters:
node
- schema node to set attribute onpattern
- attribute value to set- Returns:
- this instance (for chaining)
-
setNumberInclusiveMinimum
public AttributeCollector setNumberInclusiveMinimum(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal inclusiveMinimum)
Setter for ""minimum"" attribute.- Parameters:
node
- schema node to set attribute oninclusiveMinimum
- attribute value to set- Returns:
- this instance (for chaining)
-
setNumberExclusiveMinimum
public AttributeCollector setNumberExclusiveMinimum(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal exclusiveMinimum)
Setter for ""exclusiveMinimum"" attribute.- Parameters:
node
- schema node to set attribute onexclusiveMinimum
- attribute value to set- Returns:
- this instance (for chaining)
-
setNumberInclusiveMaximum
public AttributeCollector setNumberInclusiveMaximum(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal inclusiveMaximum)
Setter for ""maximum"" attribute.- Parameters:
node
- schema node to set attribute oninclusiveMaximum
- attribute value to set- Returns:
- this instance (for chaining)
-
setNumberExclusiveMaximum
public AttributeCollector setNumberExclusiveMaximum(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal exclusiveMaximum)
Setter for ""exclusiveMaximum"" attribute.- Parameters:
node
- schema node to set attribute onexclusiveMaximum
- attribute value to set- Returns:
- this instance (for chaining)
-
setNumberMultipleOf
public AttributeCollector setNumberMultipleOf(com.fasterxml.jackson.databind.node.ObjectNode node, BigDecimal multipleOf)
Setter for ""multipleOf"" attribute.- Parameters:
node
- schema node to set attribute onmultipleOf
- attribute value to set- Returns:
- this instance (for chaining)
-
setArrayMinItems
public AttributeCollector setArrayMinItems(com.fasterxml.jackson.databind.node.ObjectNode node, Integer minItemCount)
Setter for ""minItems"" attribute.- Parameters:
node
- schema node to set attribute onminItemCount
- attribute value to set- Returns:
- this instance (for chaining)
-
setArrayMaxItems
public AttributeCollector setArrayMaxItems(com.fasterxml.jackson.databind.node.ObjectNode node, Integer maxItemCount)
Setter for ""maxItems"" attribute.- Parameters:
node
- schema node to set attribute onmaxItemCount
- attribute value to set- Returns:
- this instance (for chaining)
-
setArrayUniqueItems
public AttributeCollector setArrayUniqueItems(com.fasterxml.jackson.databind.node.ObjectNode node, Boolean uniqueItems)
Setter for ""uniqueItems"" attribute.- Parameters:
node
- schema node to set attribute onuniqueItems
- attribute value to set- Returns:
- this instance (for chaining)
-
-