Package org.elasticsearch.xcontent
Class ParseField
java.lang.Object
org.elasticsearch.xcontent.ParseField
Holds a field that can be found in a request while parsing and its different
variants, which may be deprecated.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionString[]
String[]
boolean
match
(String parserName, Supplier<XContentLocation> location, String fieldName, DeprecationHandler deprecationHandler) DoesfieldName
match this field?boolean
match
(String fieldName, DeprecationHandler deprecationHandler) DoesfieldName
match this field?toString()
Return a new ParseField where all field names are deprecated with no replacementwithAllDeprecated
(String allReplacedWithOverride) Return a new ParseField where all field names are deprecated and replaced withallReplacedWith
.withDeprecation
(String... deprecatedNamesOverride)
-
Constructor Details
-
ParseField
- Parameters:
name
- the primary name for this field. This will be returned bygetPreferredName()
deprecatedNames
- names for this field which are deprecated and will not be accepted when strict matching is used.
-
-
Method Details
-
getPreferredName
- Returns:
- the preferred name used for this field
-
getAllNamesIncludedDeprecated
- Returns:
- All names for this field regardless of whether they are deprecated
-
withDeprecation
- Parameters:
deprecatedNamesOverride
- deprecated names to include with the returnedParseField
- Returns:
- a new
ParseField
using the preferred name from this one but with the specified deprecated names
-
withAllDeprecated
Return a new ParseField where all field names are deprecated and replaced withallReplacedWith
. -
withAllDeprecated
Return a new ParseField where all field names are deprecated with no replacement -
match
DoesfieldName
match this field?- Parameters:
fieldName
- the field name to match against thisParseField
deprecationHandler
- called iffieldName
is deprecated- Returns:
- true if
fieldName
matches any of the acceptable names for thisParseField
.
-
match
public boolean match(String parserName, Supplier<XContentLocation> location, String fieldName, DeprecationHandler deprecationHandler) DoesfieldName
match this field?- Parameters:
parserName
- the name of the parent object holding this fieldlocation
- the XContentLocation of the fieldfieldName
- the field name to match against thisParseField
deprecationHandler
- called iffieldName
is deprecated- Returns:
- true if
fieldName
matches any of the acceptable names for thisParseField
.
-
toString
-
getAllReplacedWith
- Returns:
- the message to use if this
ParseField
has been entirely deprecated in favor of something else. This method will returnnull
if the ParseField has not been completely deprecated.
-
getDeprecatedNames
- Returns:
- an array of the names for the
ParseField
which are deprecated.
-