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


Java StringExtensions类代码示例

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


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

示例1: map

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
public static List<Ddl2Bean.Klass> map(final Table table) {
  Column[] _columns = table.getColumns();
  final Function1<Column, Ddl2Bean.Klass> _function = (Column column) -> {
    Ddl2Bean.Klass _xblockexpression = null;
    {
      String _type = column.getType();
      String type = Ddl2Bean.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 Ddl2Bean.Klass(type, name, columnName, comment);
    }
    return _xblockexpression;
  };
  return ListExtensions.<Column, Ddl2Bean.Klass>map(((List<Column>)Conversions.doWrapArray(_columns)), _function);
}
 
开发者ID:East196,项目名称:maker,代码行数:24,代码来源:Ddl2Bean.java

示例2: getExtensionClasses

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
protected List<Class<?>> getExtensionClasses() {
	return Lists.<Class<?>> newArrayList(
		ArrayExtensions.class,
		BigDecimalExtensions.class,
		BigIntegerExtensions.class,
		BooleanExtensions.class,
		ByteExtensions.class,
		CharacterExtensions.class,
		CollectionExtensions.class,
		ComparableExtensions.class,
		DoubleExtensions.class,
		FloatExtensions.class,
		FunctionExtensions.class,
		IntegerExtensions.class,
		IterableExtensions.class,
		IteratorExtensions.class,
		ListExtensions.class,
		LongExtensions.class,
		MapExtensions.class,
		ObjectExtensions.class,
		ProcedureExtensions.class,
		ShortExtensions.class,
		StringExtensions.class);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:25,代码来源:ImplicitlyImportedFeatures.java

示例3: generateJavaDoc

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
public void generateJavaDoc(final EObject it, final ITreeAppendable appendable, final GeneratorConfig config) {
  final DocumentationAdapter adapter = IterableExtensions.<DocumentationAdapter>head(Iterables.<DocumentationAdapter>filter(it.eAdapters(), DocumentationAdapter.class));
  String _documentation = null;
  if (adapter!=null) {
    _documentation=adapter.getDocumentation();
  }
  boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_documentation);
  boolean _not = (!_isNullOrEmpty);
  if (_not) {
    final Set<EObject> sourceElements = this.getSourceElements(it);
    if (((sourceElements.size() == 1) && (this.documentationProvider instanceof IEObjectDocumentationProviderExtension))) {
      final List<INode> documentationNodes = ((IEObjectDocumentationProviderExtension) this.documentationProvider).getDocumentationNodes(IterableExtensions.<EObject>head(sourceElements));
      this.addJavaDocImports(it, appendable, documentationNodes);
      this.generateDocumentation(adapter.getDocumentation(), documentationNodes, appendable, config);
    } else {
      this.generateDocumentation(adapter.getDocumentation(), CollectionLiterals.<INode>emptyList(), appendable, config);
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:JvmModelGenerator.java

示例4: getEcoreFilePath

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
@Override
protected String getEcoreFilePath(final Grammar grammar) {
  String _xifexpression = null;
  boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(this.ecoreModel);
  boolean _not = (!_isNullOrEmpty);
  if (_not) {
    _xifexpression = this.ecoreModel;
  } else {
    String _javaModelDirectory = this.getJavaModelDirectory();
    String _plus = (_javaModelDirectory + "/");
    String _replace = grammar.getName().substring(0, grammar.getName().lastIndexOf(".")).replace(".", "/");
    String _plus_1 = (_plus + _replace);
    String _plus_2 = (_plus_1 + "/");
    String _modelName = this.getModelName(grammar);
    String _plus_3 = (_plus_2 + _modelName);
    _xifexpression = (_plus_3 + ".ecore");
  }
  return _xifexpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:TestsEMFGeneratorFragment.java

示例5: getGenModelPath

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
@Override
protected String getGenModelPath(final Grammar grammar) {
  String _xifexpression = null;
  boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(this.genModel);
  boolean _not = (!_isNullOrEmpty);
  if (_not) {
    _xifexpression = this.genModel;
  } else {
    String _javaModelDirectory = this.getJavaModelDirectory();
    String _plus = (_javaModelDirectory + "/");
    String _replace = grammar.getName().substring(0, grammar.getName().lastIndexOf(".")).replace(".", "/");
    String _plus_1 = (_plus + _replace);
    String _plus_2 = (_plus_1 + "/");
    String _modelName = this.getModelName(grammar);
    String _plus_3 = (_plus_2 + _modelName);
    _xifexpression = (_plus_3 + ".genmodel");
  }
  return _xifexpression;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:TestsEMFGeneratorFragment.java

示例6: doTransform

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
@Override
public void doTransform(final MutableFieldDeclaration it, @Extension final TransformationContext context) {
  @Extension
  final AccessorsProcessor.Util util = new AccessorsProcessor.Util(context);
  boolean _hasGetter = util.hasGetter(it);
  boolean _not = (!_hasGetter);
  if (_not) {
    util.addGetter(it, Visibility.PUBLIC);
  }
  if (((!it.isFinal()) && (!util.hasSetter(it)))) {
    util.addSetter(it, Visibility.PUBLIC);
  }
  String _firstLower = StringExtensions.toFirstLower(it.getSimpleName());
  String _plus = ("_" + _firstLower);
  it.setSimpleName(_plus);
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:17,代码来源:PropertyProcessor.java

示例7: 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

示例8: featureName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
public String featureName(final ResolvedMethod m) {
  String _xblockexpression = null;
  {
    final String n = m.getDeclaration().getSimpleName();
    int _xifexpression = (int) 0;
    boolean _startsWith = n.startsWith("get");
    if (_startsWith) {
      _xifexpression = 3;
    } else {
      _xifexpression = 2;
    }
    final int skip = _xifexpression;
    _xblockexpression = StringExtensions.toFirstLower(m.getDeclaration().getSimpleName().substring(skip));
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:TracedAccessorsProcessor.java

示例9: toVarName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
protected String toVarName(final ENamedElement element, final String... reservedNames) {
  String _xblockexpression = null;
  {
    if ((element instanceof EReference)) {
      return this.toVarName(((EReference)element).getEReferenceType(), reservedNames);
    }
    String name = StringExtensions.toFirstLower(element.getName());
    boolean _contains = XtendFileAccess.XTEND_KEYWORDS.contains(name);
    if (_contains) {
      name = ("_" + name);
    }
    boolean _contains_1 = ((List<String>)Conversions.doWrapArray(reservedNames)).contains(name);
    if (_contains_1) {
      name = ("_" + name);
    }
    _xblockexpression = name;
  }
  return _xblockexpression;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:Formatter2Fragment2.java

示例10: validate

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
@Override
public IStatus validate(final IValidationContext ctx) {
  IStatus _xifexpression = null;
  EObject _target = ctx.getTarget();
  if ((_target instanceof State)) {
    IStatus _xblockexpression = null;
    {
      EObject _target_1 = ctx.getTarget();
      final State state = ((State) _target_1);
      IStatus _xifexpression_1 = null;
      String _name = state.getName();
      boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_name);
      if (_isNullOrEmpty) {
        _xifexpression_1 = ctx.createFailureStatus();
      }
      _xblockexpression = _xifexpression_1;
    }
    _xifexpression = _xblockexpression;
  }
  return _xifexpression;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:22,代码来源:StateConstraint.java

示例11: setDefaultValue

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
@Override
protected void setDefaultValue(FeatureType featureType, FeatureParameterValue parameterValue,
		EObject contextElement) {

	GeneratorEntry entry = (GeneratorEntry) contextElement;
	Statechart statechart = (Statechart) entry.getElementRef();
	String parameterName = parameterValue.getParameter().getName();

	if (ICFeatureConstants.PARAMETER_NAMING_MODULE_NAME.equals(parameterName)) {
		parameterValue.setValue(asIdentifier(statechart.getName(), "_"));
	} else if (ICFeatureConstants.PARAMETER_NAMING_STATEMACHINE_PREFIX.equals(parameterName)) {
		parameterValue.setValue(StringExtensions.toFirstLower(asIdentifier(statechart.getName(), "_")));
	} else if (ICFeatureConstants.PARAMETER_NAMING_MAX_IDENTIFIER_LENGTH.equals(parameterName)) {
		parameterValue.setValue(31);
	} else if (ICFeatureConstants.PARAMETER_NAMING_SEPARATOR.equals(parameterName)) {
		parameterValue.setValue("_");
	} else if (ICFeatureConstants.PARAMETER_TRACING_ENTER_STATE.equals(parameterName)) {
		parameterValue.setValue(true);
	} else if (ICFeatureConstants.PARAMETER_TRACING_EXIT_STATE.equals(parameterName)) {
		parameterValue.setValue(true);
	} else if (ICFeatureConstants.PARAMETER_INCLUDES_USE_RELATIVE_PATHS.equals(parameterName)) {
		parameterValue.setValue(true);
	} else {
		throw new IllegalArgumentException("Unsupported parameter '" + parameterName + "'.");
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:27,代码来源:CDefaultFeatureValueProvider.java

示例12: webFullName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
public static String webFullName(final String firstName, final String href) {
  String _xblockexpression = null;
  {
    Jerry _parts = TungParser.parts(href, ".listbox1 .listbox1_text");
    String _text = _parts.text();
    String[] _split = _text.split(firstName);
    final Function1<String, Boolean> _function = (String it) -> {
      boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(it);
      return Boolean.valueOf((!_isNullOrEmpty));
    };
    Iterable<String> _filter = IterableExtensions.<String>filter(((Iterable<String>)Conversions.doWrapArray(_split)), _function);
    final List<String> lastNames = IterableExtensions.<String>toList(_filter);
    double _random = Math.random();
    int _size = lastNames.size();
    double _multiply = (_random * _size);
    final int lastNameIndex = ((int) _multiply);
    final String lastName = lastNames.get(lastNameIndex);
    _xblockexpression = (firstName + lastName);
  }
  return _xblockexpression;
}
 
开发者ID:East196,项目名称:maker,代码行数:22,代码来源:Names.java

示例13: list

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
public static List<String> list(final String words) {
  List<String> _xblockexpression = null;
  {
    String newWords = words;
    int _countIn = CharMatcher.JAVA_UPPER_CASE.countIn(words);
    boolean _greaterThan = (_countIn > 0);
    if (_greaterThan) {
      String _firstUpper = StringExtensions.toFirstUpper(words);
      String _to = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, _firstUpper);
      newWords = _to;
    }
    boolean _contains = newWords.contains("-");
    if (_contains) {
      newWords.replace("-", "_");
    }
    String[] _split = newWords.split("_");
    _xblockexpression = IterableExtensions.<String>toList(((Iterable<String>)Conversions.doWrapArray(_split)));
  }
  return _xblockexpression;
}
 
开发者ID:East196,项目名称:maker,代码行数:21,代码来源:Words.java

示例14: fkClazzIdName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
public String fkClazzIdName() {
  boolean _contains = this.keyInfo.contains("F-");
  boolean _not = (!_contains);
  if (_not) {
    return "";
  }
  if ((this.keyInfo.contains("F-J") || this.keyInfo.contains("F-M"))) {
    return "";
  }
  String _fkClazzType = this.fkClazzType();
  String _firstLower = StringExtensions.toFirstLower(_fkClazzType);
  Module _moduleByClass = Modules.moduleByClass(_firstLower);
  final List<Block> blocks = _moduleByClass.getBlocks();
  final Function1<Block, Boolean> _function = (Block it) -> {
    String _keyInfo = it.getKeyInfo();
    return Boolean.valueOf(_keyInfo.startsWith("P"));
  };
  Block _findFirst = IterableExtensions.<Block>findFirst(blocks, _function);
  String _fieldName = null;
  if (_findFirst!=null) {
    _fieldName=_findFirst.getFieldName();
  }
  final String result = _fieldName;
  return result;
}
 
开发者ID:East196,项目名称:maker,代码行数:26,代码来源:PoiBlock.java

示例15: fkClazzShowName

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入依赖的package包/类
public String fkClazzShowName() {
  boolean _contains = this.keyInfo.contains("F-");
  boolean _not = (!_contains);
  if (_not) {
    return "";
  }
  if ((this.keyInfo.contains("F-J") || this.keyInfo.contains("F-M"))) {
    return "";
  }
  String _fkClazzType = this.fkClazzType();
  String _firstLower = StringExtensions.toFirstLower(_fkClazzType);
  Module _moduleByClass = Modules.moduleByClass(_firstLower);
  List<Block> _blocks = _moduleByClass.getBlocks();
  final Function1<Block, Boolean> _function = (Block it) -> {
    return Boolean.valueOf(((Objects.equal(it.getFieldName(), "name") || Objects.equal(it.getFieldName(), "realname")) || Objects.equal(it.getFieldName(), "nickname")));
  };
  Block _findFirst = IterableExtensions.<Block>findFirst(_blocks, _function);
  return _findFirst.getFieldName();
}
 
开发者ID:East196,项目名称:maker,代码行数:20,代码来源:PoiBlock.java


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