com.google.gwt.dev.util.Util.isValidJavaIdent()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(213)

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

Util.isValidJavaIdent介绍

暂无

代码示例

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

  1. private Property checkProperty(Property property) {
  2. String[] tokens = (property.name() + ". ").split("\\.");
  3. for (int i = 0; i < tokens.length - 1; i++) {
  4. if (!Util.isValidJavaIdent(tokens[i])) {
  5. throw new AssertionError(
  6. "Property name invalid: " + property.name());
  7. }
  8. }
  9. if (!Util.isValidJavaIdent(property.value())) {
  10. throw new AssertionError(
  11. "Property value invalid: " + property.value());
  12. }
  13. return property;
  14. }

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

  1. private Property checkProperty(Property property) {
  2. String[] tokens = (property.name() + ". ").split("\\.");
  3. for (int i = 0; i < tokens.length - 1; i++) {
  4. if (!Util.isValidJavaIdent(tokens[i])) {
  5. throw new AssertionError(
  6. "Property name invalid: " + property.name());
  7. }
  8. }
  9. if (!Util.isValidJavaIdent(property.value())) {
  10. throw new AssertionError(
  11. "Property value invalid: " + property.value());
  12. }
  13. return property;
  14. }

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

  1. @Override
  2. public String define(JType type, String name, String initializer,
  3. boolean isStatic, boolean isFinal) {
  4. assert Util.isValidJavaIdent(name) : name
  5. + " is not a valid Java identifier";
  6. String ident = factory.createName(name);
  7. StringBuilder sb = new StringBuilder();
  8. sb.append("private ");
  9. if (isStatic) {
  10. sb.append("static ");
  11. }
  12. if (isFinal) {
  13. sb.append("final ");
  14. }
  15. sb.append(type.getParameterizedQualifiedSourceName());
  16. sb.append(" ");
  17. sb.append(ident);
  18. fieldsToDeclarations.put(ident, sb.toString());
  19. if (initializer != null) {
  20. fieldsToInitializers.put(ident, initializer);
  21. }
  22. return ident;
  23. }

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

  1. @Override
  2. public String define(JType type, String name, String initializer,
  3. boolean isStatic, boolean isFinal) {
  4. assert Util.isValidJavaIdent(name) : name
  5. + " is not a valid Java identifier";
  6. String ident = factory.createName(name);
  7. StringBuilder sb = new StringBuilder();
  8. sb.append("private ");
  9. if (isStatic) {
  10. sb.append("static ");
  11. }
  12. if (isFinal) {
  13. sb.append("final ");
  14. }
  15. sb.append(type.getParameterizedQualifiedSourceName());
  16. sb.append(" ");
  17. sb.append(ident);
  18. fieldsToDeclarations.put(ident, sb.toString());
  19. if (initializer != null) {
  20. fieldsToInitializers.put(ident, initializer);
  21. }
  22. return ident;
  23. }

相关文章