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

com.balajeetm.mystique.core.MystiqueMystTurn Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
/*
 * Copyright (c) Balajee TM 2016.
 * All rights reserved.
 * License -  @see 
 */

/*
 * Created on 25 Aug, 2016 by balajeetm
 * http://www.balajeetm.com
 */
package com.balajeetm.mystique.core;

import java.util.List;

import com.balajeetm.mystique.core.util.MystiqueConstants;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

/**
 * The Class MystiqueMystTurn.
 *
 * @author balajeetm
 */
public class MystiqueMystTurn extends AbstractMystTurn {

  /** The json genie. */
  private JsonMystique jsonMystique;

  /* (non-Javadoc)
   * @see com.futuresight.util.mystique.Mystique#transform(java.util.List, com.google.gson.JsonObject, java.lang.String)
   */
  @Override
  public JsonElement transmute(
      List source, JsonObject deps, JsonObject aces, JsonObject turn) {
    JsonElement transform = null;
    JsonElement elementSource = mystiqueLever.getFirst(source);
    if (null != elementSource) {
      turn = mystiqueLever.asJsonObject(turn, new JsonObject());
      String value = mystiqueLever.asString(turn.get(MystiqueConstants.VALUE));
      if (null != value) {
        JsonElement granularSource = getGranularSource(elementSource, turn, deps, aces);
        transform = jsonMystique().transform(granularSource, value, deps);
      }
    }
    return transform;
  }

  /**
   * Json mystique.
   *
   * @return the json mystique
   */
  private JsonMystique jsonMystique() {
    if (jsonMystique == null) {
      jsonMystique = JsonMystique.getInstance();
    }
    return jsonMystique;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy