Package org.mozilla.javascript

Examples of org.mozilla.javascript.Wrapper


            return super.fromScript(o);
        }

        // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost. See Mozilla bugzilla 361722
        Scriptable jsXML = (Scriptable) ScriptableObject.callMethod((Scriptable) o, "copy", new Object[0]);
        Wrapper wrapper = (Wrapper) ScriptableObject.callMethod((XMLObject)jsXML, "getXmlObject", new Object[0]);
        XmlObject xmlObject = (XmlObject)wrapper.unwrap();
        try {

            StAXOMBuilder builder = new StAXOMBuilder(xmlObject.newInputStream());
            OMElement omElement = builder.getDocumentElement();
View Full Code Here


                // if wrong type
                Scriptable s = (Scriptable)jsResp;
                Object out = ScriptableObject.callMethod(s,
                                                         "getXmlObject",
                                                         Context.emptyArgs);
                Wrapper wrapped = (Wrapper)out;
                XmlObject xml = (XmlObject)wrapped.unwrap();
                node = xml.getDomNode();
                response.setNode(node.getOwnerDocument());
            } else {
                if (jsResp instanceof Wrapper) {
                    jsResp = ((Wrapper)jsResp).unwrap();
View Full Code Here

  private String lookup(String key, Scriptable ob) {
    final Object value = ob.get(key, ob);
    if(value instanceof String) {
      return (String) value;
    } else if(value instanceof Wrapper) {
      Wrapper w = (Wrapper) value;
      if(w.unwrap() instanceof String) {
        return (String) w.unwrap();
      }
      return null;
    } else {
      return null;
    }
View Full Code Here

  private String lookup(String key, Scriptable ob) {
    final Object value = ob.get(key, ob);
    if(value instanceof String) {
      return (String) value;
    } else if(value instanceof Wrapper) {
      Wrapper w = (Wrapper) value;
      if(w.unwrap() instanceof String) {
        return (String) w.unwrap();
      }
      return null;
    } else {
      return null;
    }
View Full Code Here

   * @param jsObj the object to unwrap.
   * @return the unwrapped object.
   */
  private Object unwrap(final Object jsObj) {
    if (jsObj instanceof Wrapper) {
      Wrapper njb = (Wrapper) jsObj;

      if (njb instanceof NativeJavaClass) {
        return njb;
      }

      Object obj = njb.unwrap();
      if (obj instanceof Number || obj instanceof String
          || obj instanceof Boolean || obj instanceof Character) {
        // special type wrapped -- we just leave it as is.
        return njb;
      } else {
View Full Code Here

   * @param jsObj the object to unwrap.
   * @return the unwrapped object.
   */
  private Object unwrap(final Object jsObj) {
    if (jsObj instanceof Wrapper) {
      Wrapper njb = (Wrapper) jsObj;

      if (njb instanceof NativeJavaClass) {
        return njb;
      }

      Object obj = njb.unwrap();
      if (obj instanceof Number || obj instanceof String
          || obj instanceof Boolean || obj instanceof Character) {
        // special type wrapped -- we just leave it as is.
        return njb;
      } else {
View Full Code Here

                // if wrong type
                Scriptable s = (Scriptable)jsResp;
                Object out = ScriptableObject.callMethod(s,
                                                         "getXmlObject",
                                                         Context.emptyArgs);
                Wrapper wrapped = (Wrapper)out;
                XmlObject xml = (XmlObject)wrapped.unwrap();
                node = xml.getDomNode();
                response.setNode(node.getOwnerDocument());
            } else {
                if (jsResp instanceof Wrapper) {
                    jsResp = ((Wrapper)jsResp).unwrap();
View Full Code Here

        }

        // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost???
        Scriptable jsXML =
            (Scriptable) ScriptableObject.callMethod((Scriptable) scriptXML, "copy", new Object[0]);
        Wrapper wrapper =
            (Wrapper) ScriptableObject.callMethod((XMLObject)jsXML, "getXmlObject", new Object[0]);

        XmlObject xmlObject = (XmlObject) wrapper.unwrap();

        try {
            StAXOMBuilder builder = new StAXOMBuilder(xmlObject.newInputStream());
            return builder.getDocumentElement();
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.Wrapper

Copyright © 2018 www.massapicom. 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.