当前位置: 首页>>代码示例>>Java>>正文


Java StringExtensions.toFirstUpper方法代码示例

本文整理汇总了Java中org.eclipse.xtext.xbase.lib.StringExtensions.toFirstUpper方法的典型用法代码示例。如果您正苦于以下问题:Java StringExtensions.toFirstUpper方法的具体用法?Java StringExtensions.toFirstUpper怎么用?Java StringExtensions.toFirstUpper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.xbase.lib.StringExtensions的用法示例。


在下文中一共展示了StringExtensions.toFirstUpper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPossibleGetterNames

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public List<String> getPossibleGetterNames(final FieldDeclaration it) {
  final ArrayList<String> names = CollectionLiterals.<String>newArrayList();
  if ((((this.isBooleanType(this.orObject(it.getType())) && it.getSimpleName().startsWith("is")) && (it.getSimpleName().length() > 2)) && Character.isUpperCase(it.getSimpleName().charAt(2)))) {
    String _simpleName = it.getSimpleName();
    names.add(_simpleName);
  }
  List<String> _xifexpression = null;
  boolean _isBooleanType = this.isBooleanType(this.orObject(it.getType()));
  if (_isBooleanType) {
    _xifexpression = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("is", "get"));
  } else {
    _xifexpression = Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("get"));
  }
  final Function1<String, String> _function = new Function1<String, String>() {
    @Override
    public String apply(final String prefix) {
      String _firstUpper = StringExtensions.toFirstUpper(it.getSimpleName());
      return (prefix + _firstUpper);
    }
  };
  names.addAll(ListExtensions.<String, String>map(_xifexpression, _function));
  return names;
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:24,代码来源:AccessorsProcessor.java

示例2: map

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public static List<Ddl2Rest.Klass> map(final Table table) {
  Column[] _columns = table.getColumns();
  final Function1<Column, Ddl2Rest.Klass> _function = (Column column) -> {
    Ddl2Rest.Klass _xblockexpression = null;
    {
      String _type = column.getType();
      String type = Ddl2Rest.fieldType(_type);
      String columnName = column.getName();
      String _name = column.getName();
      String[] _split = _name.split("_");
      final Function1<String, String> _function_1 = (String it) -> {
        return StringExtensions.toFirstUpper(it);
      };
      List<String> _map = ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_split)), _function_1);
      String _join = IterableExtensions.join(_map);
      String name = StringExtensions.toFirstLower(_join);
      String comment = column.getDescription();
      _xblockexpression = new Ddl2Rest.Klass(type, name, columnName, comment);
    }
    return _xblockexpression;
  };
  return ListExtensions.<Column, Ddl2Rest.Klass>map(((List<Column>)Conversions.doWrapArray(_columns)), _function);
}
 
开发者ID:East196,项目名称:maker,代码行数:24,代码来源:Ddl2Rest.java

示例3: doTransform

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
@Override
public void doTransform(final MutableFieldDeclaration field, @Extension final TransformationContext ctx) {
  MutableTypeDeclaration _declaringType = field.getDeclaringType();
  String _simpleName = field.getSimpleName();
  String _firstUpper = StringExtensions.toFirstUpper(_simpleName);
  String _plus = ("get" + _firstUpper);
  final Procedure1<MutableMethodDeclaration> _function = (MutableMethodDeclaration it) -> {
    TypeReference _type = field.getType();
    it.setReturnType(_type);
    final CompilationStrategy _function_1 = (CompilationStrategy.CompilationContext it_1) -> {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("return this.");
      String _simpleName_1 = field.getSimpleName();
      _builder.append(_simpleName_1, "");
      _builder.append(";");
      _builder.newLineIfNotEmpty();
      return _builder;
    };
    it.setBody(_function_1);
  };
  _declaringType.addMethod(_plus, _function);
}
 
开发者ID:East196,项目名称:maker,代码行数:23,代码来源:GetterCompilationParticipant.java

示例4: klassType

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public static String klassType(final Table table) {
  String _xblockexpression = null;
  {
    String _name = table.getName();
    String _substring = _name.substring(2);
    String[] _split = _substring.split("_");
    final Function1<String, String> _function = (String it) -> {
      return StringExtensions.toFirstUpper(it);
    };
    List<String> _map = ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_split)), _function);
    String name = IterableExtensions.join(_map);
    boolean _equals = Objects.equal(name, "Enum");
    if (_equals) {
      name = "EnumCode";
    }
    _xblockexpression = name;
  }
  return _xblockexpression;
}
 
开发者ID:East196,项目名称:maker,代码行数:20,代码来源:Ddl2Bean.java

示例5: applyRuleEClassEClass

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
protected Result<Boolean> applyRuleEClassEClass(final RuleEnvironment G, final RuleApplicationTrace _trace_, final EClass eClass1, final EClass eClass2) throws RuleFailedException {
  String _string = new String();
  String _firstUpper = StringExtensions.toFirstUpper("bar");
  String _plus = (_string + _firstUpper);
  boolean _equals = Objects.equal("foo", _plus);
  /* 'foo' == new String() + 'bar'.toFirstUpper */
  if (!_equals) {
    sneakyThrowRuleFailedException("\'foo\' == new String() + \'bar\'.toFirstUpper");
  }
  final EClass eC = EcoreFactory.eINSTANCE.createEClass();
  eC.setName("MyEClass");
  /* eClass1 == eC */
  if (!Objects.equal(eClass1, eC)) {
    sneakyThrowRuleFailedException("eClass1 == eC");
  }
  return new Result<Boolean>(true);
}
 
开发者ID:eclipse,项目名称:xsemantics,代码行数:18,代码来源:TypeSystem.java

示例6: applyRuleEClassEObject

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
protected Result<Boolean> applyRuleEClassEObject(final RuleEnvironment G, final RuleApplicationTrace _trace_, final EClass eClass, final EObject object) throws RuleFailedException {
  String _string = new String();
  String _firstUpper = StringExtensions.toFirstUpper("bar");
  String _plus = (_string + _firstUpper);
  boolean _equals = Objects.equal("foo", _plus);
  /* 'foo' == new String() + 'bar'.toFirstUpper */
  if (!_equals) {
    sneakyThrowRuleFailedException("\'foo\' == new String() + \'bar\'.toFirstUpper");
  }
  final EClass eC = EcoreFactory.eINSTANCE.createEClass();
  eC.setName("MyEClass");
  /* eClass == eC */
  if (!Objects.equal(eClass, eC)) {
    sneakyThrowRuleFailedException("eClass == eC");
  }
  return new Result<Boolean>(true);
}
 
开发者ID:eclipse,项目名称:xsemantics,代码行数:18,代码来源:TypeSystem.java

示例7: capitalizeEntityNameFirstLetter

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
@Fix(EntitiesValidator.INVALID_ENTITY_NAME)
public void capitalizeEntityNameFirstLetter(final Issue issue, final IssueResolutionAcceptor acceptor) {
  String[] _data = issue.getData();
  String _get = _data[0];
  String _plus = ("Capitalize first letter of \'" + _get);
  String _plus_1 = (_plus + "\'");
  final IModification _function = new IModification() {
    @Override
    public void apply(final IModificationContext context) throws Exception {
      final IXtextDocument xtextDocument = context.getXtextDocument();
      Integer _offset = issue.getOffset();
      final String firstLetter = xtextDocument.get((_offset).intValue(), 1);
      Integer _offset_1 = issue.getOffset();
      String _firstUpper = StringExtensions.toFirstUpper(firstLetter);
      xtextDocument.replace((_offset_1).intValue(), 1, _firstUpper);
    }
  };
  acceptor.accept(issue, 
    "Capitalize first letter", _plus_1, 
    "Entity.gif", _function);
}
 
开发者ID:LorenzoBettini,项目名称:packtpub-xtext-book-examples,代码行数:22,代码来源:EntitiesQuickfixProvider.java

示例8: getGeneratedEPackageName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public String getGeneratedEPackageName(final EPackage pack) {
  StringConcatenation _builder = new StringConcatenation();
  String _basePackageRuntime = this._naming.basePackageRuntime(this.grammar);
  _builder.append(_basePackageRuntime);
  _builder.append(".");
  String _name = pack.getName();
  _builder.append(_name);
  _builder.append(".");
  String _firstUpper = StringExtensions.toFirstUpper(pack.getName());
  _builder.append(_firstUpper);
  _builder.append("Package");
  return _builder.toString();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:14,代码来源:ValidatorNaming.java

示例9: getGeneratedEPackageName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
protected String getGeneratedEPackageName(final EPackage pack) {
  StringConcatenation _builder = new StringConcatenation();
  String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar());
  _builder.append(_runtimeBasePackage);
  _builder.append(".");
  String _name = pack.getName();
  _builder.append(_name);
  _builder.append(".");
  String _firstUpper = StringExtensions.toFirstUpper(pack.getName());
  _builder.append(_firstUpper);
  _builder.append("Package");
  return _builder.toString();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:14,代码来源:ValidatorFragment2.java

示例10: toJavaIdentifierSegment

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
private String toJavaIdentifierSegment(final String text, final boolean isFirst, final boolean uppercaseFirst) {
  final String special = GrammarAccessExtensions.SPECIAL_CHARS.get(text);
  if ((special != null)) {
    String _xifexpression = null;
    if (uppercaseFirst) {
      _xifexpression = StringExtensions.toFirstUpper(special);
    } else {
      _xifexpression = special;
    }
    return _xifexpression;
  }
  final String r = this.toJavaIdentifierSegmentInt(text, isFirst, uppercaseFirst);
  int _length = r.length();
  boolean _greaterThan = (_length > 0);
  if (_greaterThan) {
    return r;
  }
  final StringBuilder builder = new StringBuilder();
  char[] _charArray = text.toCharArray();
  for (final char c : _charArray) {
    {
      final String n = this.getUnicodeName(c);
      if ((n != null)) {
        builder.append((n + " "));
      }
    }
  }
  return this.toJavaIdentifierSegmentInt(builder.toString().toLowerCase().trim(), isFirst, true);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:30,代码来源:GrammarAccessExtensions.java

示例11: klassType

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public static String klassType(final Table table) {
  String _name = table.getName();
  String _substring = _name.substring(2);
  String[] _split = _substring.split("_");
  final Function1<String, String> _function = (String it) -> {
    return StringExtensions.toFirstUpper(it);
  };
  List<String> _map = ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_split)), _function);
  return IterableExtensions.join(_map);
}
 
开发者ID:East196,项目名称:maker,代码行数:11,代码来源:Ddl2Jsp.java

示例12: doTransform

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
@Override
public void doTransform(final MutableClassDeclaration clazz, @Extension final TransformationContext ctx) {
  final Iterable<? extends MutableFieldDeclaration> fields = clazz.getDeclaredFields();
  final TypeReference preconditions = ctx.newTypeReference(Preconditions.class);
  final Consumer<MutableFieldDeclaration> _function = (MutableFieldDeclaration field) -> {
    MutableTypeDeclaration _declaringType = field.getDeclaringType();
    String _simpleName = field.getSimpleName();
    String _firstUpper = StringExtensions.toFirstUpper(_simpleName);
    String _plus = ("set" + _firstUpper);
    final Procedure1<MutableMethodDeclaration> _function_1 = (MutableMethodDeclaration it) -> {
      TypeReference _primitiveVoid = ctx.getPrimitiveVoid();
      it.setReturnType(_primitiveVoid);
      String _simpleName_1 = field.getSimpleName();
      TypeReference _type = field.getType();
      it.addParameter(_simpleName_1, _type);
      final CompilationStrategy _function_2 = (CompilationStrategy.CompilationContext it_1) -> {
        StringConcatenation _builder = new StringConcatenation();
        String _javaCode = it_1.toJavaCode(preconditions);
        _builder.append(_javaCode, "");
        _builder.append(".checkNotNull(");
        String _simpleName_2 = field.getSimpleName();
        _builder.append(_simpleName_2, "");
        _builder.append(");");
        _builder.newLineIfNotEmpty();
        _builder.append("this.");
        String _simpleName_3 = field.getSimpleName();
        _builder.append(_simpleName_3, "");
        _builder.append(" = ");
        String _simpleName_4 = field.getSimpleName();
        _builder.append(_simpleName_4, "");
        _builder.append(";");
        _builder.newLineIfNotEmpty();
        return _builder;
      };
      it.setBody(_function_2);
    };
    _declaringType.addMethod(_plus, _function_1);
  };
  fields.forEach(_function);
}
 
开发者ID:East196,项目名称:maker,代码行数:41,代码来源:SettersCompilationParticipant.java

示例13: clazzName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public String clazzName() {
  String _trim = this.tableName.trim();
  String _replaceFirst = _trim.replaceFirst("t_", "");
  String _lowerCase = _replaceFirst.toLowerCase();
  String[] _split = _lowerCase.split("_");
  final Function1<String, String> _function = (String it) -> {
    return StringExtensions.toFirstUpper(it);
  };
  List<String> _map = ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_split)), _function);
  String _join = IterableExtensions.join(_map);
  return StringExtensions.toFirstLower(_join);
}
 
开发者ID:East196,项目名称:maker,代码行数:13,代码来源:PoiModule.java

示例14: fieldName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public String fieldName() {
  String _trim = this.columnName.trim();
  String[] _split = _trim.split("_");
  final Function1<String, String> _function = (String it) -> {
    return StringExtensions.toFirstUpper(it);
  };
  List<String> _map = ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_split)), _function);
  String _join = IterableExtensions.join(_map);
  return StringExtensions.toFirstLower(_join);
}
 
开发者ID:East196,项目名称:maker,代码行数:11,代码来源:PoiBlock.java

示例15: klassType

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public static String klassType(final Table table) {
  String _xblockexpression = null;
  {
    String _name = table.getName();
    String _substring = _name.substring(2);
    String[] _split = _substring.split("_");
    final Function1<String, String> _function = (String it) -> {
      return StringExtensions.toFirstUpper(it);
    };
    List<String> _map = ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_split)), _function);
    String name = IterableExtensions.join(_map);
    _xblockexpression = name;
  }
  return _xblockexpression;
}
 
开发者ID:East196,项目名称:maker,代码行数:16,代码来源:ModelSupport.java


注:本文中的org.eclipse.xtext.xbase.lib.StringExtensions.toFirstUpper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。