コード例 #1
0
ファイル: JjsUtils.java プロジェクト: uddata/gwt
  /** Returns a description for a member suitable for reporting errors to the users. */
  public static String getReadableDescription(JMember member) {
    if (member instanceof JField) {
      return String.format(
          "%s %s.%s",
          getReadableDescription(member.getType()),
          getReadableDescription(member.getEnclosingType()),
          member.getName());
    }

    JMethod method = (JMethod) member;
    String printableDescription = "";
    if (!method.isConstructor()) {
      printableDescription += getReadableDescription(method.getType()) + " ";
    }
    printableDescription +=
        String.format(
            "%s.%s(%s)",
            getReadableDescription(method.getEnclosingType()),
            method.getName(),
            Joiner.on(", ")
                .join(
                    Iterables.transform(
                        method.getOriginalParamTypes(),
                        new Function<JType, String>() {
                          @Override
                          public String apply(JType type) {
                            return getReadableDescription(type);
                          }
                        })));
    return printableDescription;
  }
コード例 #2
0
  private static void setJsInteropProperties(JMember member, Annotation... annotations) {
    String namespace = maybeGetJsNamespace(annotations);
    String exportName = maybeGetJsExportName(annotations, computeExportName(member));
    member.setExportInfo(namespace, exportName);

    /* Apply class wide JsInterop annotations */

    boolean ignore = JdtUtil.getAnnotation(annotations, JSNOEXPORT_CLASS) != null;
    if (ignore || !member.isPublic()) {
      return;
    }

    JDeclaredType enclosingType = member.getEnclosingType();

    if (enclosingType.isJsType() && member.needsVtable()) {
      member.setJsMemberName(member.getName());
    }

    if (enclosingType.isClassWideExport() && !member.needsVtable() && exportName == null) {
      member.setExportInfo(namespace, computeExportName(member));
    }
  }
コード例 #3
0
ファイル: JsInteropUtil.java プロジェクト: wsdflink/gwt
 private static String computeName(JMember member) {
   return member instanceof JConstructor ? "" : member.getName();
 }
コード例 #4
0
ファイル: JjsUtils.java プロジェクト: uddata/gwt
 public static String getIndexedName(JMember member) {
   return member.getEnclosingType().getShortName() + '.' + member.getName();
 }