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
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionParseField(String name, String... deprecatedNames) Creates a field available for lookup for both current and previous REST API versions -
Method Summary
Modifier and TypeMethodDescriptionforRestApiVersion(Predicate<RestApiVersion> forRestApiVersionOverride) Creates a new field with current name and deprecatedNames, but overrides forRestApiVersionString[]String[]booleanmatch(String parserName, Supplier<XContentLocation> location, String fieldName, DeprecationHandler deprecationHandler) DoesfieldNamematch this field?booleanmatch(String fieldName, DeprecationHandler deprecationHandler) DoesfieldNamematch 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
Creates a field available for lookup for both current and previous REST API versions- 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
ParseFieldusing the preferred name from this one but with the specified deprecated names
-
forRestApiVersion
Creates a new field with current name and deprecatedNames, but overrides forRestApiVersion- Parameters:
forRestApiVersionOverride- - a boolean function indicating for what version a deprecated name is available
-
getForRestApiVersion
- Returns:
- a function indicating for which RestApiVersion a deprecated name is declared for
-
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
DoesfieldNamematch this field?- Parameters:
fieldName- the field name to match against thisParseFielddeprecationHandler- called iffieldNameis deprecated- Returns:
- true if
fieldNamematches any of the acceptable names for thisParseField.
-
match
public boolean match(String parserName, Supplier<XContentLocation> location, String fieldName, DeprecationHandler deprecationHandler) DoesfieldNamematch this field?- Parameters:
parserName- the name of the parent object holding this fieldlocation- the XContentLocation of the fieldfieldName- the field name to match against thisParseFielddeprecationHandler- called iffieldNameis deprecated- Returns:
- true if
fieldNamematches any of the acceptable names for thisParseField.
-
toString
-
getAllReplacedWith
- Returns:
- the message to use if this
ParseFieldhas been entirely deprecated in favor of something else. This method will returnnullif the ParseField has not been completely deprecated.
-
getDeprecatedNames
- Returns:
- an array of the names for the
ParseFieldwhich are deprecated.
-