public interface DeprecationHandler
Callback for notifying the creator of the
XContentParser that
parsing hit a deprecated field.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DeprecationHandlerIgnores all deprecationsstatic final DeprecationHandlerThrows anUnsupportedOperationExceptionwhen parsing hits a deprecated field. -
Method Summary
Modifier and TypeMethodDescriptionvoidlogRemovedField(String parserName, Supplier<XContentLocation> location, String removedName) Called when the provided field name matches the current field but the entire field has been marked as deprecated with no replacement Emits a compatible api warning instead of deprecation warning when isCompatibleDeprecation is truedefault voidlogRemovedField(String parserName, Supplier<XContentLocation> location, String removedName, boolean isCompatibleDeprecation) voidlogRenamedField(String parserName, Supplier<XContentLocation> location, String oldName, String currentName) Called when the provided field name matches a deprecated name for the field.default voidlogRenamedField(String parserName, Supplier<XContentLocation> location, String oldName, String currentName, boolean isCompatibleDeprecation) voidlogReplacedField(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName) Called when the provided field name matches the current field but the entire field has been marked as deprecated and another field should be useddefault voidlogReplacedField(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName, boolean isCompatibleDeprecation)
-
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
-
logRenamedField
void logRenamedField(String parserName, Supplier<XContentLocation> location, String oldName, String currentName) Called when the provided field name matches a deprecated name for the field.- Parameters:
oldName- the provided field namecurrentName- the modern name for the field
-
logReplacedField
void logReplacedField(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName) 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:
oldName- the provided field namereplacedName- the name of the field that replaced this field
-
logRemovedField
Called when the provided field name matches the current field but the entire field has been marked as deprecated with no replacement Emits a compatible api warning instead of deprecation warning when isCompatibleDeprecation is true- Parameters:
removedName- the provided field name
-
logRenamedField
default void logRenamedField(String parserName, Supplier<XContentLocation> location, String oldName, String currentName, boolean isCompatibleDeprecation) - See Also:
-
logReplacedField
default void logReplacedField(String parserName, Supplier<XContentLocation> location, String oldName, String replacedName, boolean isCompatibleDeprecation) - See Also:
-
logRemovedField
default void logRemovedField(String parserName, Supplier<XContentLocation> location, String removedName, boolean isCompatibleDeprecation) - See Also:
-