/**
   * Start the string parsing. If base is not a string, will return null.
   *
   * @param base base JsonValue object to begin parsing from
   * @return a string with any interpolation expanded or null if base is not a string
   */
  private static String parse(JsonValue base) {
    if (!base.isString()) {
      return null;
    }

    return buildString(base.asString());
  }
 /**
  * TODO: Description.
  *
  * @param service
  * @param config TODO.
  * @throws JsonValueException TODO.
  */
 public Policy(SynchronizationService service, JsonValue config) throws JsonValueException {
   this.service = service;
   situation = config.get("situation").required().asEnum(Situation.class);
   JsonValue action = config.get("action").required();
   if (action.isString()) {
     this.action = action.asEnum(Action.class);
     this.script = null;
     this.scriptScope = null;
   } else {
     this.action = null;
     this.script = Scripts.newInstance("Policy", action);
     if (action.isMap() && action.asMap().size() > 2) {
       // If there is additional attributes then copy them
       scriptScope = action.copy().asMap();
       scriptScope.remove("type");
       scriptScope.remove("source");
       scriptScope.remove("file");
     } else {
       scriptScope = null;
     }
   }
   JsonValue pAction = config.get("postAction");
   if (pAction.isNull()) {
     this.postAction = null;
   } else {
     this.postAction = Scripts.newInstance("PostAction", pAction);
   }
 }