Interface DeprecationHandler
public interface DeprecationHandler
Callback for notifying the creator of the
XContentParser that
parsing hit a deprecated field.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic DeprecationHandlerIgnores all deprecationsstatic DeprecationHandlerThrows anUnsupportedOperationExceptionwhen parsing hits a deprecated field. -
Method Summary
Modifier and TypeMethodDescriptionvoidusedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName)Called when the provided field name matches the current field but the entire field has been marked as deprecated with no replacementvoidusedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName, String replacedWith)Called when the provided field name matches the current field but the entire field has been marked as deprecated and another field should be usedvoidusedDeprecatedName(String parserName, Supplier<XContentLocation> location, String usedName, String modernName)Called when the provided field name matches a deprecated name for the field.
-
Field Details
-
THROW_UNSUPPORTED_OPERATION
Throws anUnsupportedOperationExceptionwhen parsing hits a deprecated field. Use this when creating anXContentParserthat won't interact with deprecation logic at all or when you want to fail fast when parsing deprecated fields. -
IGNORE_DEPRECATIONS
Ignores all deprecations
-
-
Method Details
-
usedDeprecatedName
void usedDeprecatedName(String parserName, Supplier<XContentLocation> location, String usedName, String modernName)Called when the provided field name matches a deprecated name for the field.- Parameters:
usedName- the provided field namemodernName- the modern name for the field
-
usedDeprecatedField
void usedDeprecatedField(String parserName, Supplier<XContentLocation> location, String usedName, String replacedWith)Called when the provided field name matches the current field but the entire field has been marked as deprecated and another field should be used- Parameters:
usedName- the provided field namereplacedWith- the name of the field that replaced this field
-
usedDeprecatedField
Called when the provided field name matches the current field but the entire field has been marked as deprecated with no replacement- Parameters:
usedName- the provided field name
-