Package org.mozilla.javascript

Examples of org.mozilla.javascript.NativeObject


                if (map == SourceMap.NONE) {
                    return new CompileResult((String) result, null);
                } else {

                    NativeObject nativeObject = (NativeObject) result;
                    String js = nativeObject.get("js").toString();
                    String sourceMap;
                    try {
                        ObjectMapper objectMapper = new ObjectMapper();
                        sourceMap = objectMapper.writeValueAsString(nativeObject.get("v3SourceMap"));
                    } catch (Exception e) {
                        sourceMap = null;
                    }

                    return new CompileResult(js, sourceMap);
View Full Code Here


     
      Scriptable lint = (Scriptable) scope.get("JSLINT", scope);
      NativeArray errors = (NativeArray) lint.get("errors", null);
      clearMarkers(file);
      for (int i = 0; i < errors.getLength(); i++) {
        NativeObject error = (NativeObject) errors.get(i, null);
        if(error == null) continue;
        Double lineNo = ((Double) error.get("line", null)) - 2;
        Object reason = error.get("reason", null);
        IMarker marker = file.createMarker("org.eclipse.core.resources.problemmarker");
        marker.setAttribute(IMarker.LINE_NUMBER, lineNo.intValue());
        marker.setAttribute(IMarker.MESSAGE, reason);
        marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
        marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
View Full Code Here

            this.content = content;
            this.scope   = scope;
        }

        public Object[] buildArguments() {
            ScriptableObject so = new NativeObject();
            so.put("success", so,
                   (success) ? Boolean.TRUE : Boolean.FALSE);
            if (mime != null) {
                so.put("contentType", so,
                       Context.toObject(mime, scope));
            }
            if (content != null) {
                so.put("content", so,
                       Context.toObject(content, scope));
            }
            return new Object [] { so };
        }
View Full Code Here

            String serviceName = serviceAnnotationParser.getServiceName();

            // Setting Axis Parameters given in serviceParameters annotation
            Object serviceParametersObject = serviceAnnotationParser.getServiceParameters();
            if (serviceParametersObject instanceof NativeObject) {
                NativeObject nativeObject = (NativeObject) serviceParametersObject;
                Object[] propertyNames = nativeObject.getIds();
                for (Object propertyNameObject : propertyNames) {
                    if (propertyNameObject instanceof String) {
                        String propertyName = (String) propertyNameObject;
                        Object propertyValueObject = nativeObject.get(propertyName, nativeObject);
                        if (propertyValueObject instanceof String) {
                            try {
                                OMFactory factory = OMAbstractFactory.getOMFactory();
                                OMElement parameterElement = factory.createOMElement("parameter", null);
                                parameterElement.addAttribute("name", propertyName, null);
View Full Code Here

        // If the output of the function is complex we need to get the parameter names of the
        // complex object into an array so that we can reuse the same function we use to genarate
        // schema for the input message
        if (output instanceof NativeObject) {
            NativeObject nativeObject = (NativeObject) output;
            Object[] objects = ScriptableObject.getPropertyIds(nativeObject);
            int length = objects.length;
            if (length == 0) {
                return null;
            }
View Full Code Here

     *
     * @param params A String array that holds the parameters
     * @return NativeObject that wrapps the parameters
     */
    private NativeObject createNativeObject(String params[]) {
        NativeObject nativeObject = new NativeObject();
        for (int i = 0; i < params.length; i++) {
            NativeObject.putProperty(nativeObject, params[i].trim(), "any");
        }
        return nativeObject;
    }
View Full Code Here

                                           String elementName,
                                           String[] params, String methodName)
            throws AxisFault {
        XmlSchemaElement xmlSchemaElement;
        if (object instanceof NativeObject) {
            NativeObject nativeObject = (NativeObject) object;
            xmlSchemaElement =
                    handleNativeObject(message, nativeObject, elementName, params, methodName);
            if (xmlSchemaElement != null) {
                message.addParameter(MashupConstants.ANNOTATED, Boolean.TRUE);
            } else {
View Full Code Here

            } else if (paramType instanceof String) {
                if ((xmlSchemaElement = createXMLSchemaElement(paramName, paramType)) != null) {
                    xmlSchemaSequence.getItems().add(xmlSchemaElement);
                }
            } else if (paramType instanceof NativeObject) {
                NativeObject nativeObject = (NativeObject) paramType;
                Object[] objects = ScriptableObject.getPropertyIds(nativeObject);
                String[] innerParams = new String[objects.length];
                for (int j = 0; j < objects.length; j++) {
                    Object object = objects[j];
                    if (object instanceof String) {
View Full Code Here

                }
            } else if (jsObject instanceof NativeObject) {
                element.addAttribute("type", "object", namespace);
                element.declareNamespace(xsiNamespace);
                element.declareNamespace(xsNamespace);
                NativeObject nativeObject = (NativeObject) jsObject;
                Object[] objects = NativeObject.getPropertyIds(nativeObject);
                for (Object object : objects) {
                    Object o;
                    if (object instanceof String) {
                        String property = (String) object;
                        o = nativeObject.get(property, nativeObject);
                        OMElement paramElement = createResponseElement(o, property, true);
                        element.addChild(paramElement);
                    }
                }
            } else if (jsObject instanceof Undefined || jsObject instanceof UniqueTag) {
View Full Code Here

      generatedJsExprsAsJsArray.append("]");

      Context context = new ContextFactory().enterContext();
      context.setOptimizationLevel(-1)// Only running once.
      ScriptableObject globalScope = context.initStandardObjects();
      NativeObject navigator = new NativeObject();
      ScriptableObject.putConstProperty(navigator, "userAgent", "testZilla");
      globalScope.defineProperty("navigator", navigator, ScriptableObject.DONTENUM);

      try {
        String soyutilsPath = getSoyUtilsPath();
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.NativeObject

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.