Examples of JStringLiteral


Examples of com.google.gwt.dev.jjs.ast.JStringLiteral

      }
      return jlabel;
    }

    private JStringLiteral getStringLiteral(SourceInfo info, char[] chars) {
      return new JStringLiteral(info, intern(chars), javaLangString);
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JStringLiteral

    private JStringLiteral getStringLiteral(SourceInfo info, char[] chars) {
      return new JStringLiteral(info, intern(chars), javaLangString);
    }

    private JStringLiteral getStringLiteral(SourceInfo info, String string) {
      return new JStringLiteral(info, intern(string), javaLangString);
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JStringLiteral

    }

    assert method != null;

    JMethodCall call = new JMethodCall(info, null, method);
    JStringLiteral packageName = program.getStringLiteral(info, getPackageName(typeName));
    JStringLiteral className = program.getStringLiteral(info, getClassName(typeName));
    call.addArgs(packageName, className);

    if (type instanceof JArrayType || type instanceof JClassType) {
      // Add a runtime type reference.
      call.addArg(new JRuntimeTypeReference(info, program.getTypeJavaLangObject(),
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JStringLiteral

   * Predictably creates String type ids for castable and instantiable types.
   */
  public static class IntoStringLiterals extends ResolveRuntimeTypeReferences {

    private void assignId(JType type) {
      JStringLiteral stringLiteral = program.getStringLiteral(type.getSourceInfo(), type.getName());
      typeIdLiteralsByType.put(type, stringLiteral);
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JStringLiteral

      JExpression arg = x.getArgs().get(0);
      if (!(arg instanceof JStringLiteral)) {
        error(x, "Only string literals may be used as arguments to Impl.getNameOf()");
        return null;
      }
      JStringLiteral stringLiteral = (JStringLiteral) arg;
      String stringValue = stringLiteral.getValue();
      JNode node = null;

      JsniRef ref = JsniRef.parse(stringValue);
      if (ref != null) {
        node = JsniRefLookup.findJsniRefTarget(ref, program, new JsniRefLookup.ErrorReporter() {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JStringLiteral

    super();
  }

  @Override
  protected void adjustMethod(final JMethodCall methodCall, final Context context) {
    final JStringLiteral stringLiteral = (JStringLiteral) methodCall.getArgs().get(0);
    final String name = stringLiteral.getValue();

    final JClassType logger = this.getLevelLogger(name);
    if (null == logger) {
      throw new IllegalStateException("Unable to fetch logger for \"" + name + "\".");
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JStringLiteral

      SourceInfo sourceInfo = type.getSourceInfo().makeChild(
          JavaASTGenerationVisitor.class, "enum value lookup map");
      JsonObject map = new JsonObject(sourceInfo, program.getJavaScriptObject());
      for (JEnumField field : type.getEnumList()) {
        // JSON maps require leading underscores to prevent collisions.
        JStringLiteral key = program.getLiteralString(field.getSourceInfo(),
            "_" + field.getName());
        JFieldRef value = new JFieldRef(sourceInfo, null, field, type);
        map.propInits.add(new JsonObject.JsonPropInit(sourceInfo, key, value));
      }
      JField mapField = program.createField(sourceInfo,
View Full Code Here

Examples of com.sun.codemodel.JStringLiteral

        JExpression cons = coreType.createConstant(outline, lexical);
        Class<? extends XmlAdapter> atype = adapter.getAdapterIfKnown();

        // try to run the adapter now rather than later.
        if(cons instanceof JStringLiteral && atype!=null) {
            JStringLiteral scons = (JStringLiteral) cons;
            XmlAdapter a = ClassFactory.create(atype);
            try {
                Object value = a.unmarshal(scons.str);
                if(value instanceof String) {
                    return JExpr.lit((String)value);
View Full Code Here

Examples of com.sun.codemodel.JStringLiteral

                            valuesArray[i] = anno.getJavaAnnotation();
                        } else {
                            Field valueField = PrivilegedAccessHelper.getDeclaredField(values.get(i).getClass(), "value", true);
                            Object value = PrivilegedAccessHelper.getValueFromField(valueField, values.get(i));
                            if (value instanceof JStringLiteral) {
                                JStringLiteral strvalue = (JStringLiteral) value;
                                valuesArray[i] = strvalue.str;
                            } else {
                                // XmlSeeAlso.value = Array of JDefinedClasses
                                Field valClField = PrivilegedAccessHelper.getDeclaredField(value.getClass(), "val$cl", true);
                                JDefinedClass wrappedValue = (JDefinedClass) PrivilegedAccessHelper.getValueFromField(valClField, value);
                                Class<?> tempDynClass = dynamicClassLoader.createDynamicClass(wrappedValue.fullName());
                                valuesArray[i] = tempDynClass;
                            }
                        }
                    }
                    components.put(key.toString(), valuesArray);
                } else if (xjcValue.getClass().getName().contains("JAnnotationStringValue")) {
                    // JAnnotationStringValue is a package-protected class so need to compare class name.
                    // Cannot cache this field because JAnnotationStringValue is a protected class.
                    Field valueField = PrivilegedAccessHelper.getDeclaredField(xjcValue.getClass(), "value", true);
                    Object objValue = PrivilegedAccessHelper.getValueFromField(valueField, xjcValue);
                    if (objValue instanceof JStringLiteral) {
                        JStringLiteral value = (JStringLiteral) objValue;
                        String stringValue = value == null ? null : value.str;
                        components.put(key.toString(), stringValue);
                    } else if (objValue.getClass().getName().contains("JAtom")) {
                        // e.g. XmlElement.required = JAtom
                        // Cannot cache this field because JAtom is a protected class.
View Full Code Here

Examples of com.sun.codemodel.JStringLiteral

                            valuesArray[i] = anno.getJavaAnnotation();
                        } else {
                            Field valueField = PrivilegedAccessHelper.getDeclaredField(values.get(i).getClass(), "value", true);
                            Object value = PrivilegedAccessHelper.getValueFromField(valueField, values.get(i));
                            if (value instanceof JStringLiteral) {
                                JStringLiteral strvalue = (JStringLiteral) value;
                                valuesArray[i] = strvalue.str;
                            } else {
                                // XmlSeeAlso.value = Array of JDefinedClasses
                                Field valClField = PrivilegedAccessHelper.getDeclaredField(value.getClass(), "val$cl", true);
                                JDefinedClass wrappedValue = (JDefinedClass) PrivilegedAccessHelper.getValueFromField(valClField, value);
                                Class<?> tempDynClass = dynamicClassLoader.createDynamicClass(wrappedValue.fullName());
                                valuesArray[i] = tempDynClass;
                            }
                        }
                    }
                    components.put(key.toString(), valuesArray);
                } else if (xjcValue.getClass().getName().contains("JAnnotationStringValue")) {
                    // JAnnotationStringValue is a package-protected class so need to compare class name.
                    // Cannot cache this field because JAnnotationStringValue is a protected class.
                    Field valueField = PrivilegedAccessHelper.getDeclaredField(xjcValue.getClass(), "value", true);
                    Object objValue = PrivilegedAccessHelper.getValueFromField(valueField, xjcValue);
                    if (objValue instanceof JStringLiteral) {
                        JStringLiteral value = (JStringLiteral) objValue;
                        String stringValue = value == null ? null : value.str;
                        components.put(key.toString(), stringValue);
                    } else if (objValue.getClass().getName().contains("JAtom")) {
                        // e.g. XmlElement.required = JAtom
                        // Cannot cache this field because JAtom is a protected class.
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.