All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.streamsets.pipeline.api.ext.json.JsonModel Maven / Gradle / Ivy

There is a newer version: 6.2.1
Show newest version
/*
 * Copyright 2021 StreamSets Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.streamsets.pipeline.api.ext.json;

import java.io.IOException;
import java.util.Map;

/**
 * An interface abstraction basic functionality on a JSON tree.
 */
public interface JsonModel {

  /**
   * Seeks for a key inside the JSON tree.
   * @param key the name of the key, in xpath notation.
   * @return tha value of the key, if present.
   */
  String getKeyTextValue(String key);

  /**
   * Deserializes a tree onto a new object.
   *
   * @param valueType The class type to use to deserialize.
   * @param  The deserialized object.
   * @return
   * @throws IOException
   */
  T readValue(Class valueType) throws IOException;

  /**
   * Deserializes a tree onto a new object, using optional runtime parameters.
   *
   * @param valueType The class type to use to deserialize.
   * @param parameters the runtime parameters to use.
   * @param  The deserialized object.
   * @return
   * @throws IOException
   */
  T readValue(Class valueType, Map parameters) throws IOException;


  /**
   * Deserializes a tree onto an existing object.
   *
   * @param valueType The class type to use to deserialize.
   * @param valueObject the target object.
   * @param  The deserialized object.
   * @return
   * @throws IOException
   */
  T readValue(Class valueType, Object valueObject) throws IOException;

  /**
   * Deserializes a tree onto an existing object, using optional runtime parameters.
   *
   * @param valueType The class type to use to deserialize.
   * @param valueObject the target object.   *
   * @param parameters the runtime parameters to use.
   * @param  The deserialized object.
   * @return
   * @throws IOException
   */
  T readValue(Class valueType, Object valueObject, Map parameters) throws IOException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy