Class XContentObjectTransformer<T extends org.elasticsearch.xcontent.ToXContentObject>

java.lang.Object
org.elasticsearch.xpack.core.ml.utils.XContentObjectTransformer<T>
Type Parameters:
T - The type of the object that we will be transforming to/from

public class XContentObjectTransformer<T extends org.elasticsearch.xcontent.ToXContentObject> extends Object
This is a utility class that allows simple one-to-one transformations between an ToXContentObject type to and from other supported objects.
  • Method Details

    • aggregatorTransformer

      public static XContentObjectTransformer<AggregatorFactories.Builder> aggregatorTransformer(org.elasticsearch.xcontent.NamedXContentRegistry registry)
    • queryBuilderTransformer

      public static XContentObjectTransformer<QueryBuilder> queryBuilderTransformer(org.elasticsearch.xcontent.NamedXContentRegistry registry)
    • fromMap

      public T fromMap(Map<String,Object> stringObjectMap) throws IOException
      Parses the map into the type T with the previously supplied parserFunction All deprecation warnings are ignored
      Parameters:
      stringObjectMap - The Map to parse into the Object
      Returns:
      parsed object T
      Throws:
      IOException - When there is an unforeseen parsing issue
    • fromMap

      public T fromMap(Map<String,Object> stringObjectMap, List<String> deprecationWarnings) throws IOException
      Parses the map into the type T with the previously supplied parserFunction All deprecation warnings are added to the passed deprecationWarnings list.
      Parameters:
      stringObjectMap - The Map to parse into the Object
      deprecationWarnings - The list to which to add all deprecation warnings
      Returns:
      parsed object T
      Throws:
      IOException - When there is an unforeseen parsing issue
    • toMap

      public Map<String,Object> toMap(T object) throws IOException
      Throws:
      IOException