Exemple #1
0
 private static String maybeGetJsExportName(Annotation[] annotations, String calculatedName) {
   AnnotationBinding jsExport = JdtUtil.getAnnotation(annotations, JSEXPORT_CLASS);
   if (jsExport == null) {
     return null;
   }
   String value = JdtUtil.getAnnotationParameterString(jsExport, "value");
   return Strings.isNullOrEmpty(value) ? calculatedName : value;
 }
Exemple #2
0
 /** Returns a description for a type suitable for reporting errors to the users. */
 public static String getReadableDescription(JType type) {
   if (type instanceof JArrayType) {
     JArrayType arrayType = (JArrayType) type;
     return getReadableDescription(arrayType.getLeafType())
         + Strings.repeat("[]", arrayType.getDims());
   }
   return Joiner.on(".").join(type.getCompoundName());
 }
Exemple #3
0
  public static String resolveExpression(
      String instance, String path, String prefix, String suffix) {
    String expression = path.replace(".", "().") + "()";

    if (!Strings.isNullOrEmpty(instance)) {
      expression = instance + "." + expression;
    }

    if (!Strings.isNullOrEmpty(prefix)) {
      expression = "\"" + Generator.escape(prefix) + "\" + " + expression;
    }

    if (!Strings.isNullOrEmpty(suffix)) {
      expression += " + \"" + Generator.escape(suffix) + "\"";
    }

    return expression;
  }