Examples of JEnumConstant


Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

    resolveAnnotations(logger, field.getAnnotations(), declaredAnnotations);
    String name = field.getName();
    JField jfield;
    if ((field.getAccess() & Opcodes.ACC_ENUM) != 0) {
      assert (type.isEnum() != null);
      jfield = new JEnumConstant(type, name, declaredAnnotations,
          nextEnumOrdinal[0]++);
    } else {
      jfield = new JField(type, name, declaredAnnotations);
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

    }
  }

  public String parse(String value, MortalLogger logger)
      throws UnableToCompleteException {
    JEnumConstant c = values.get(value);
    if (c != null) {
      return String.format("%s.%s", c.getEnclosingType().getQualifiedSourceName(),
          value);
    }
    return super.parse(value, logger);
  }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

    String name = String.valueOf(jfield.name);
    JField field;
    if (jfield.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
      assert (enclosingType.isEnum() != null);
      field = new JEnumConstant(enclosingType, name, declaredAnnotations,
          jfield.binding.original().id);
    } else {
      field = new JField(enclosingType, name, declaredAnnotations);
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

          entry.getKey().getName(), entry.getValue());
    }
    for (Map.Entry<String, List<JEnumConstant>> entry : map.entrySet()) {
      String listExpr;
      if (entry.getValue().size() == 1) {
        JEnumConstant e = entry.getValue().get(0);
        // Collections.singletonList(Enum.FOO)
        listExpr = String.format("%s.<%s<?>> singletonList(%s.%s)",
            Collections.class.getCanonicalName(),
            Enum.class.getCanonicalName(),
            e.getEnclosingType().getQualifiedSourceName(), e.getName());
      } else {
        // Arrays.asList(Enum.FOO, OtherEnum.FOO, ThirdEnum,FOO)
        StringBuilder sb = new StringBuilder();
        boolean needsComma = false;
        sb.append(String.format("%s.<%s<?>> asList(",
            Arrays.class.getCanonicalName(), Enum.class.getCanonicalName()));
        for (JEnumConstant e : entry.getValue()) {
          if (needsComma) {
            sb.append(",");
          }
          needsComma = true;
          sb.append(e.getEnclosingType().getQualifiedSourceName()).append(".").append(
              e.getName());
        }
        sb.append(")");
        listExpr = sb.toString();
      }
      sw.println("stringsToEnumsMap.put(\"%s\", %s);", entry.getKey(), listExpr);
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

    String name = String.valueOf(jfield.name);
    JField field;
    if (jfield.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
      assert (enclosingType.isEnum() != null);
      field = new JEnumConstant(enclosingType, name, declaredAnnotations,
          jfield.binding.original().id);
    } else {
      field = new JField(enclosingType, name, declaredAnnotations);
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

      } else {
        if (AlternateMessageSelector.OTHER_FORM_NAME.equals(value)) {
          out.println("default:  // other");
        } else if (enumType != null) {
          JField field = enumType.findField(value);
          JEnumConstant enumConstant = null;
          if (field != null) {
            enumConstant = field.isEnumConstant();
          }
          if (field == null || enumConstant == null) {
            throw error(logger, "'" + value + "' is not a valid value of "
                + enumType.getQualifiedSourceName() + " or 'other'");
          }
          out.println("case " + enumConstant.getOrdinal() + ":  // " + value);
        } else {
          int intVal;
          try {
            intVal = Integer.parseInt(value);
          } catch (NumberFormatException e) {
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

    String name = String.valueOf(jfield.name);
    JField field;
    if (jfield.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
      assert (enclosingType.isEnum() != null);
      field = new JEnumConstant(enclosingType, name, declaredAnnotations,
          jfield.binding.original().id);
    } else {
      field = new JField(enclosingType, name, declaredAnnotations);
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

          .getQualifiedSourceName(), entry.getKey().getName(), entry.getValue());
    }
    for (Map.Entry<String, List<JEnumConstant>> entry : map.entrySet()) {
      String listExpr;
      if (entry.getValue().size() == 1) {
        JEnumConstant e = entry.getValue().get(0);
        // Collections.singletonList(Enum.FOO)
        listExpr =
            String.format("%s.<%s<?>> singletonList(%s.%s)", Collections.class.getCanonicalName(),
                Enum.class.getCanonicalName(), e.getEnclosingType().getQualifiedSourceName(), e
                    .getName());
      } else {
        // Arrays.asList(Enum.FOO, OtherEnum.FOO, ThirdEnum,FOO)
        StringBuilder sb = new StringBuilder();
        boolean needsComma = false;
        sb.append(String.format("%s.<%s<?>> asList(", Arrays.class.getCanonicalName(), Enum.class
            .getCanonicalName()));
        for (JEnumConstant e : entry.getValue()) {
          if (needsComma) {
            sb.append(",");
          }
          needsComma = true;
          sb.append(e.getEnclosingType().getQualifiedSourceName()).append(".").append(e.getName());
        }
        sb.append(")");
        listExpr = sb.toString();
      }
      sw.println("stringsToEnumsMap.put(\"%s\", %s);", entry.getKey(), listExpr);
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

      values.put(c.getName(), c);
    }
  }

  public String parse(String value) throws UnableToCompleteException {
    JEnumConstant c = values.get(value);
    if (c != null) {
      return String.format("%s.%s",
          c.getEnclosingType().getQualifiedSourceName(), value);
    }
    return super.parse(value);
  }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JEnumConstant

      } else {
        if ("other".equals(value)) {
          out.println("default:  // other");
        } else if (enumType != null) {
          JField field = enumType.findField(value);
          JEnumConstant enumConstant = null;
          if (field != null) {
            enumConstant = field.isEnumConstant();
          }
          if (field == null || enumConstant == null) {
            throw error(logger, "'" + value + "' is not a valid value of "
                + enumType.getQualifiedSourceName() + " or 'other'");
          }
          out.println("case " + enumConstant.getOrdinal() + ":  // " + value);
        } else {
          long longVal;
          try {
            longVal = Long.parseLong(value);
          } catch (NumberFormatException e) {
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.