V
- the type of JsonValue
to which this facet will be applied.public class MinLengthFacet<V extends JsonValue> extends Object implements Facet<V>
This facet is applicable to string()
or array()
type.
If the value of the type has the length shorter than the expected length,
a problem will be reported by this facet.
The type of the problem to be reported is determined by LengthProblemFactory
which is passed in to the constructor.
Constructor and Description |
---|
MinLengthFacet(int minLength,
ToIntFunction<V> lengthMapper,
LengthProblemFactory<V> problemFactory)
Constructs this facet.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(V value,
List<Problem> problems)
Applies this facet to a value in JSON document and
when the value is out of valid value space, it reports one or more corresponding problems.
|
public MinLengthFacet(int minLength, ToIntFunction<V> lengthMapper, LengthProblemFactory<V> problemFactory)
minLength
- the minimum length allowed for the type.lengthMapper
- the mapper used to retrieve the length of the value.problemFactory
- the factory used to create a new problem when given value has an invalid length.Copyright © 2016–2017. All rights reserved.