com.google.gwt.core.ext.Generator类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中com.google.gwt.core.ext.Generator类的一些代码示例,展示了Generator类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Generator类的具体详情如下:
包路径:com.google.gwt.core.ext.Generator
类名称:Generator

Generator介绍

暂无

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public String toCss() {
 return Generator.escape(value);
}

代码示例来源:origin: sk.seges.acris/acris-client-core

superClass = gen.generate(logger, context, actualTypeName);

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public String getExpression() {
 return '"' + Generator.escape(ident) + '"';
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public String getExpression() {
 StringBuilder toReturn = new StringBuilder();
 toReturn.append(path.replace(".", "()."));
 toReturn.append("()");
 if (suffix != null) {
  toReturn.append(" + \"");
  toReturn.append(Generator.escape(suffix));
  toReturn.append("\"");
 }
 return toReturn.toString();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

public NumberValue(float value, String units) {
 this.value = value;
 this.units = units;
 String s;
 int i = (int) value;
 if (i == value) {
  s = String.valueOf(i);
 } else {
  s = String.valueOf(value);
 }
 if (units != null && value != 0) {
  css = s + units;
  expression = '"' + s + Generator.escape(units) + '"';
 } else if (value == 0) {
  css = "0";
  expression = "\"0\"";
 } else {
  css = s;
  expression = '"' + s + '"';
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public String getExpression() {
 // The escaped CSS content has to be escaped to be a valid Java literal
 return "\"" + Generator.escape(toCss()) + "\"";
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public String getExpression() {
 // "{name}(" + {valuesExpr} + ")"
 return String.format("\"%s(\" + %s + \")\"",
   Generator.escape(name), values.getExpression());
}

代码示例来源:origin: com.google.gwt/gwt-servlet

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;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
  * Read what the internal StringBuilder used by the CompactPrinter has already built. Escape it.
  * and reset the internal StringBuilder
  *
  * @return
  */
 private String flushInternalStringBuilder() {
  // NOTE(flan): Note that you have to be careful where you do this. Internally,
  // the compact printer sometimes deletes characters from the end of the stringBuilder to save
  // space. I believe that you'll be safe because, if there's nothing in the buffer, there is
  // nothing to delete, but you may have some unnecessary characters in the output. you may
  // want to call that out explicitly in the code.
  String content = DOUBLE_QUOTE + Generator.escape(getOutputBuffer()) + DOUBLE_QUOTE;
  resetBuffer();

  return content;
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public void prepare(TreeLogger logger, ResourceContext context,
  ClientBundleRequirements requirements, JMethod method)
  throws UnableToCompleteException {
 URL[] urls = ResourceGeneratorUtil.findResources(logger, context, method);
 if (urls.length != 1) {
  logger.log(TreeLogger.ERROR, "Exactly one resource must be specified",
    null);
  throw new UnableToCompleteException();
 }
 URL resource = urls[0];
 String toWrite = Util.readURLAsString(resource);
 // This de-duplicates strings in the bundle.
 if (!hashes.containsKey(toWrite)) {
  hashes.put(toWrite, currentIndex++);
  if (!first) {
   data.append(",\n");
  } else {
   first = false;
  }
  data.append('"');
  data.append(Generator.escape(toWrite));
  data.append('"');
 }
 // Store the (possibly n:1) mapping of resource function to bundle index.
 offsets.put(method.getName(), hashes.get(toWrite));
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
  * A single constant that is too long will crash the compiler with an out of
  * memory error. Break up the constant and generate code that appends using a
  * buffer.
  */
 private void writeLongString(SourceWriter sw, String toWrite) {
  sw.println("StringBuilder builder = new StringBuilder();");
  int offset = 0;
  int length = toWrite.length();
  while (offset < length - 1) {
   int subLength = Math.min(MAX_STRING_CHUNK, length - offset);
   sw.print("builder.append(\"");
   sw.print(Generator.escape(toWrite.substring(offset, offset + subLength)));
   sw.println("\");");
   offset += subLength;
  }
  sw.println("return builder.toString();");
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

b.append(Generator.escape(template.substring(start, entry.getKey())));
 b.append('\"');
 numExpressions = concatOp(numExpressions, b);
b.append(Generator.escape(template.substring(start)));
b.append('"');
b.append(')');

代码示例来源:origin: com.google.gwt/gwt-servlet

sw.println("@ClassName(\"" + Generator.escape(className) + "\")");

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
  * Helper method used to wrap a string constant with quotes. Must use to
  * enable string escaping.
  * 
  * @param wrapMe String to wrap
  * @return wrapped String
  */
 protected static String wrap(String wrapMe) {
  return "\"" + Generator.escape(wrapMe) + "\"";
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
  * Helper method used to wrap a string constant with quotes. Must use to
  * enable string escaping.
  * 
  * @param wrapMe String to wrap
  * @return wrapped String
  */
 protected static String wrap(String wrapMe) {
  return "\"" + Generator.escape(wrapMe) + "\"";
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

List<String> returnValues = new ArrayList<String>();
for (CssValueNode valueNode : params) {
 returnValues.add(Generator.escape(valueNode.toString()));

代码示例来源:origin: net.wetheinter/gwt-user

@Override
public String toCss() {
 return Generator.escape(value);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
public String toCss() {
 return Generator.escape(value);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
public String getExpression() {
 return '"' + Generator.escape(ident) + '"';
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
public String getExpression() {
 return '"' + Generator.escape(ident) + '"';
}

相关文章

微信公众号

最新文章

更多

Generator类方法