V - The type of values passed to the DSL.F - The type of converted values passed to the backend.public final class DslConverter<V,F> extends Object
| Constructor and Description |
|---|
DslConverter(Class<V> valueType,
ToDocumentFieldValueConverter<V,F> delegate) |
| Modifier and Type | Method and Description |
|---|---|
F |
convert(V value,
ToDocumentFieldValueConvertContext context) |
F |
convertUnknown(Object value,
ToDocumentFieldValueConvertContext context)
Convert an input value of unknown type that may not have the required type
V. |
Class<V> |
getValueType() |
boolean |
isCompatibleWith(DslConverter<?,?> other) |
boolean |
isValidInputType(Class<?> inputTypeCandidate)
Check whether the given type is a valid type for values passed
to
convert(Object, ToDocumentFieldValueConvertContext),
which generally means the given type is a subtype of V. |
String |
toString() |
public DslConverter(Class<V> valueType, ToDocumentFieldValueConverter<V,F> delegate)
public boolean isValidInputType(Class<?> inputTypeCandidate)
convert(Object, ToDocumentFieldValueConvertContext),
which generally means the given type is a subtype of V.inputTypeCandidate - A candidate type for the input of convertUnknown(Object, ToDocumentFieldValueConvertContext).true if values of type inputTypeCandidate
may be accepted by convertUnknown(Object, ToDocumentFieldValueConvertContext),
false otherwise.public F convert(V value, ToDocumentFieldValueConvertContext context)
value - The source value to convert.context - A context that can be
extended
to a more useful type, giving access to such things as a Hibernate ORM SessionFactory (if using the Hibernate ORM mapper).public F convertUnknown(Object value, ToDocumentFieldValueConvertContext context)
V.
Called when passing values to the predicate DSL in particular.
value - The value to convert.context - A context that can be
extended
to a more useful type, giving access to such things as a Hibernate ORM SessionFactory (if using the Hibernate ORM mapper).RuntimeException - If the value does not match the expected type.public boolean isCompatibleWith(DslConverter<?,?> other)
other - Another DslConverter, never null.true if the given object behaves exactly the same as this object,
i.e. its convert(Object, ToDocumentFieldValueConvertContext) and convertUnknown(Object, ToDocumentFieldValueConvertContext)
methods are guaranteed to always return the same value as this object's
when given the same input. false otherwise, or when in doubt.Copyright © 2006-2020 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.