Examples of ScriptObject


Examples of com.orange.wink.model.ScriptObject

   * @param po
   * @param parentScope
   * @return
   */
  public static ScriptObject buildScriptObject(final ParseObject po, final ScriptObject parent) throws WinkParseException {
    ScriptObject so;

    if (po instanceof Function) {
      so = new FunctionObject(po.getNode());
    } else if (po instanceof ObjectLit) {
      so = new LiteralObject(po.getNode());
View Full Code Here

Examples of com.orange.wink.model.ScriptObject

  /**
   * @param name
   * @return
   */
  private ScriptObject getScriptObjectByName(final String name) {
    ScriptObject so = null;

    for (final FunctionObject f : functions) {
      if (f.getNamespace().toString().equals(name)) {
        if (f.getParentImpl() == null) {
          so = f;
View Full Code Here

Examples of com.orange.wink.model.ScriptObject

   * @param name
   * @return
   * @throws WinkBuildException
   */
  public Object jsFunction_getDeclarationsList(final String name) throws WinkBuildException {
    final ScriptObject so = getScriptObjectByName(name);
    final StringBuffer sb = new StringBuffer();

    if (so != null) {
      sb.append(so.toString()).append("\n");
      final List<ScriptObject> exts = so.getExtensions();
      for (final ScriptObject ext : exts) {
        sb.append("\t->").append(ext).append("\n");
      }
    } else {
      throw new WinkBuildException("getDeclarationsList failed : duplicate not found");
View Full Code Here

Examples of com.orange.wink.model.ScriptObject

   */
  public void jsFunction_deleteDuplicate(final String name) throws WinkBuildException {
    initFunctions();
    initLiterals();

    final ScriptObject so = getScriptObjectByName(name);
    final List<ScriptObject> toRemove = Common.newArrayList(1);

    toRemove.add(so);

    final List<ScriptObject> exts = so.getExtensions();
    for (int i = 0; i < exts.size(); i++) {
      if (i < exts.size() - 1) {
        toRemove.add(exts.get(i));
      }
    }
View Full Code Here

Examples of jdk.nashorn.internal.runtime.ScriptObject

      String filename = null;
      int line = -1;
      int column = -1;
      List<String> extractList = new ArrayList<String>();
      if (thrown instanceof ScriptObject) {
        ScriptObject so = (ScriptObject) e.getThrown();
        type = so.get("type").toString() + " Error";
        message = so.get("message").toString();
        filename = "";
        if (so.has("filename")) {
          filename = so.get("filename").toString();
        }
        if (so.has("line")) {
          line = ((Long) so.get("line")).intValue();
        }
        if (so.has("column")) {
          column = ((Double) so.get("column")).intValue();
        }
        if (so.has("extract")) {
          NativeArray extract = (NativeArray) so.get("extract");
          for (int i = 0; i < extract.size(); i++) {
            if (extract.get(i) instanceof String) {
              extractList.add(((String) extract.get(i))
                  .replace("\t", " "));
            }
View Full Code Here

Examples of l2p.extensions.scripts.ScriptObject

  {
    if(l2p.extensions.scripts.ScriptManager.loading)
    {
      return null;
    }
    ScriptObject o;
    try
    {
      o = scriptClass.newInstance();
    }
    catch(Exception e)
    {
      e.printStackTrace();
      return null;
    }
    if(variables != null && variables.size() > 0)
    {
      for(Map.Entry<String, Object> obj : variables.entrySet())
      {
        try
        {
          o.setProperty(obj.getKey(), obj.getValue());
        }
        catch(Exception e)
        {
        }
      }
    }
    try
    {
      o.setProperty("self", null);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    return args == null ? o.invokeMethod(method) : o.invokeMethod(method, args);
  }
View Full Code Here

Examples of l2p.extensions.scripts.ScriptObject

  {
    if(l2p.extensions.scripts.ScriptManager.loading)
    {
      return null;
    }
    ScriptObject o;
    try
    {
      o = scriptClass.newInstance();
    }
    catch(Exception e)
    {
      e.printStackTrace();
      return null;
    }
    if(variables != null && variables.size() > 0)
    {
      for(Map.Entry<String, Object> obj : variables.entrySet())
      {
        try
        {
          o.setProperty(obj.getKey(), obj.getValue());
        }
        catch(Exception e)
        {
        }
      }
    }
    try
    {
      if(o.isFunctions())
      {
        o.setProperty("self", getStoredId());
      }
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    Object ret = args == null ? o.invokeMethod(method) : o.invokeMethod(method, args);
    try
    {
      if(o.isFunctions())
      {
        o.setProperty("self", null);
      }
    }
    catch(Exception e)
    {
      e.printStackTrace();
View Full Code Here

Examples of l2p.extensions.scripts.ScriptObject

  {
    if(l2p.extensions.scripts.ScriptManager.loading)
    {
      return null;
    }
    ScriptObject o;
    Script scriptClass = ScriptManager.getInstance().getClasses().get(_class);
    if(scriptClass == null)
    {
      _log.info("Script class " + _class + " not found");
      return null;
    }
    try
    {
      o = scriptClass.newInstance();
    }
    catch(Exception e)
    {
      e.printStackTrace();
      return null;
    }
    if(variables != null && variables.size() > 0)
    {
      for(Map.Entry<String, Object> obj : variables.entrySet())
      {
        try
        {
          o.setProperty(obj.getKey(), obj.getValue());
        }
        catch(Exception e)
        {
        }
      }
    }
    try
    {
      o.setProperty("self", getStoredId());
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    Object ret = args == null ? o.invokeMethod(method) : o.invokeMethod(method, args);
    try
    {
      o.setProperty("self", null);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.