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


Java StringExtensions.isNullOrEmpty方法代码示例

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


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

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

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

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

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

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

示例6: join

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public void join() throws BaseException {
  ComponentLookup _instance = ComponentLookup.getInstance();
  ConfigurationComponent _component = _instance.<ConfigurationComponent>getComponent(ConfigurationComponent.class);
  GlobalOptionsData _globalOptions = _component.getGlobalOptions();
  String name = _globalOptions.getName();
  boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(name);
  if (_isNullOrEmpty) {
    name = "Unknown";
  }
  ClientGameEnvironmentImpl _l15remote = Startup.l15remote(name, this.ipAddr);
  this.environment = _l15remote;
  final ErrorMessage error = this.environment.joinGame(this.gameId);
  boolean _isFailed = error.isFailed();
  if (_isFailed) {
    ExceptionCode _errorCode = error.getErrorCode();
    String _errorMessage = error.getErrorMessage();
    throw new BaseException(_errorCode, _errorMessage);
  }
}
 
开发者ID:CymricNPG,项目名称:abattle,代码行数:20,代码来源:LANGameStartup.java

示例7: getGameParameters

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public GameBaseParametersImpl getGameParameters() {
  ComponentLookup _instance = ComponentLookup.getInstance();
  ConfigurationComponent _component = _instance.<ConfigurationComponent>getComponent(ConfigurationComponent.class);
  GlobalOptionsData _globalOptions = _component.getGlobalOptions();
  String name = _globalOptions.getName();
  boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(name);
  if (_isNullOrEmpty) {
    String _get = I18N.get("gp_unknown");
    name = _get;
  }
  if (this.humans) {
    int _playerCount = this.configuration.getPlayerCount();
    int _xsize = this.configuration.getXsize();
    int _ysize = this.configuration.getYsize();
    return new GameBaseParametersImpl(0, _playerCount, _xsize, _ysize, name);
  } else {
    int _playerCount_1 = this.configuration.getPlayerCount();
    int _xsize_1 = this.configuration.getXsize();
    int _ysize_1 = this.configuration.getYsize();
    return new GameBaseParametersImpl(_playerCount_1, 1, _xsize_1, _ysize_1, name);
  }
}
 
开发者ID:CymricNPG,项目名称:abattle,代码行数:23,代码来源:GameParameterPartScreen.java

示例8: waitForClientId

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
@Override
public void waitForClientId() {
  try {
    boolean _tryAcquire = this.waitForId.tryAcquire(3, TimeUnit.SECONDS);
    boolean _not = (!_tryAcquire);
    if (_not) {
      throw new BaseException(ModelExceptionCode.LOGIN_TIMEOUT);
    }
    boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(this.errorMessage);
    boolean _not_1 = (!_isNullOrEmpty);
    if (_not_1) {
      throw new BaseException(ModelExceptionCode.LOGIN_FAILED, this.errorMessage);
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:CymricNPG,项目名称:abattle,代码行数:18,代码来源:ClientModelComponentImpl.java

示例9: isValid

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public boolean isValid() {
  boolean _and = false;
  boolean _and_1 = false;
  String _clazz = this.getClazz();
  boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_clazz);
  boolean _not = (!_isNullOrEmpty);
  if (!_not) {
    _and_1 = false;
  } else {
    String _project = this.getProject();
    boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(_project);
    boolean _not_1 = (!_isNullOrEmpty_1);
    _and_1 = _not_1;
  }
  if (!_and_1) {
    _and = false;
  } else {
    String _task = this.getTask();
    boolean _isNullOrEmpty_2 = StringExtensions.isNullOrEmpty(_task);
    boolean _not_2 = (!_isNullOrEmpty_2);
    _and = _not_2;
  }
  return _and;
}
 
开发者ID:oehme,项目名称:xtext-maven-example,代码行数:25,代码来源:LaunchConfigurationInfo.java

示例10: widgetSelected

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
@Override
public void widgetSelected(final SelectionEvent e) {
	final MultiStatus multistatus = statusHelper.createMultiStatus("Status of installing npm dependencies.");

	InstallNpmDependencyDialog dialog = new InstallNpmDependencyDialog(getShell(),
			packageNameValidator.get(), packageVersionValidator.get());
	dialog.open();
	final String packageName = dialog.getPackageName();
	if (!StringExtensions.isNullOrEmpty(packageName) && dialog.getReturnCode() == Window.OK) {
		try {
			final String packageVersion = dialog.getVersionConstraint();
			new ProgressMonitorDialog(getShell()).run(true, false, monitor -> {
				multistatus
						.merge(installAction.apply(Collections.singletonMap(packageName, packageVersion), monitor));
			});
		} catch (final InvocationTargetException | InterruptedException exc) {
			multistatus.merge(
					statusHelper.createError("Error while installing npm dependency: '" + packageName + "'.",
							exc));
		} finally {
			if (!multistatus.isOK()) {
				N4JSActivator.getInstance().getLog().log(multistatus);
				getDisplay().asyncExec(() -> openError(
						UIUtils.getShell(),
						"npm Install Failed",
						"Error while installing '" + packageName
								+ "' npm package.\nPlease check your Error Log view for the detailed npm log about the failure."));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:32,代码来源:InstallNpmDependencyButtonListener.java

示例11: widgetSelected

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
@Override
public void widgetSelected(final SelectionEvent e) {
	final MultiStatus multistatus = statusHelper.createMultiStatus("Status of uninstalling npm dependencies.");

	final InputDialog dialog = new InputDialog(UIUtils.getShell(), "npm Uninstall",
			"Specify an npm package name to uninstall:", initalValue.get(), validator.get());

	dialog.open();
	final String packageName = dialog.getValue();
	if (!StringExtensions.isNullOrEmpty(packageName) && dialog.getReturnCode() == Window.OK) {
		try {
			new ProgressMonitorDialog(UIUtils.getShell()).run(true, false, monitor -> {
				multistatus.merge(uninstallAction.apply(Arrays.asList(packageName), monitor));
			});
		} catch (final InvocationTargetException | InterruptedException exc) {
			multistatus.merge(
					statusHelper.createError("Error while uninstalling npm dependency: '" + packageName + "'.",
							exc));
		} finally {
			if (!multistatus.isOK()) {
				N4JSActivator.getInstance().getLog().log(multistatus);
				getDisplay().asyncExec(() -> openError(
						UIUtils.getShell(),
						"npm Uninstall Failed",
						"Error while uninstalling '" + packageName
								+ "' npm package.\nPlease check your Error Log view for the detailed npm log about the failure."));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:31,代码来源:UninstallNpmDependencyButtonListener.java

示例12: generateFileHeader

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
public void generateFileHeader(final JvmDeclaredType it, final ITreeAppendable appendable, final GeneratorConfig config) {
  final FileHeaderAdapter fileHeaderAdapter = IterableExtensions.<FileHeaderAdapter>head(Iterables.<FileHeaderAdapter>filter(it.eAdapters(), FileHeaderAdapter.class));
  String _headerText = null;
  if (fileHeaderAdapter!=null) {
    _headerText=fileHeaderAdapter.getHeaderText();
  }
  boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_headerText);
  boolean _not = (!_isNullOrEmpty);
  if (_not) {
    this.generateDocumentation(fileHeaderAdapter.getHeaderText(), this.fileHeaderProvider.getFileHeaderNodes(it.eResource()), appendable, config);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:13,代码来源:JvmModelGenerator.java

示例13: getSignatureHelp

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
@Override
public SignatureHelp getSignatureHelp(final XtextResource resource, final int offset) {
  Preconditions.<XtextResource>checkNotNull(resource, "resource");
  Preconditions.checkArgument((offset >= 0), ("offset >= 0. Was: " + Integer.valueOf(offset)));
  final EObject object = this.offsetHelper.resolveContainedElementAt(resource, offset);
  if ((object instanceof OperationCall)) {
    final String operationName = this.getOperationName(((OperationCall)object));
    boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(operationName);
    boolean _not = (!_isNullOrEmpty);
    if (_not) {
      return this.getSignatureHelp(((OperationCall)object), operationName, offset);
    }
  }
  return ISignatureHelpService.EMPTY;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:16,代码来源:SignatureHelpServiceImpl.java

示例14: initialize

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
@Override
public void initialize(final Injector injector) {
  injector.injectMembers(this);
  boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(this.rootPath);
  boolean _not = (!_isNullOrEmpty);
  if (_not) {
    this.root = this.owner.newFileSystemAccess(this.rootPath, true);
    this.root.initialize(injector);
  }
  boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(this.metaInfPath);
  boolean _not_1 = (!_isNullOrEmpty_1);
  if (_not_1) {
    this.metaInf = this.owner.newFileSystemAccess(this.metaInfPath, true);
    this.metaInf.initialize(injector);
  }
  boolean _isNullOrEmpty_2 = StringExtensions.isNullOrEmpty(this.srcPath);
  boolean _not_2 = (!_isNullOrEmpty_2);
  if (_not_2) {
    this.src = this.owner.newFileSystemAccess(this.srcPath, this.overwriteSrc);
    this.src.initialize(injector);
  }
  boolean _isNullOrEmpty_3 = StringExtensions.isNullOrEmpty(this.srcGenPath);
  boolean _not_3 = (!_isNullOrEmpty_3);
  if (_not_3) {
    this.srcGen = this.owner.newFileSystemAccess(this.srcGenPath, true);
    this.srcGen.initialize(injector);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:29,代码来源:SubProjectConfig.java

示例15: mergeManifest

import org.eclipse.xtext.xbase.lib.StringExtensions; //导入方法依赖的package包/类
protected void mergeManifest(final ManifestAccess manifest, final IXtextGeneratorFileSystemAccess metaInf) throws IOException {
  InputStream in = null;
  try {
    in = metaInf.readBinaryFile(manifest.getPath());
    String _bundleName = manifest.getBundleName();
    final MergeableManifest merge = new MergeableManifest(in, _bundleName);
    merge.setLineDelimiter(this.codeConfig.getLineDelimiter());
    merge.addExportedPackages(manifest.getExportedPackages());
    merge.addRequiredBundles(manifest.getRequiredBundles());
    merge.addImportedPackages(manifest.getImportedPackages());
    if (((manifest.getActivator() != null) && StringExtensions.isNullOrEmpty(merge.getBundleActivator()))) {
      merge.setBundleActivator(manifest.getActivator().getName());
    }
    boolean _isModified = merge.isModified();
    if (_isModified) {
      final ByteArrayOutputStream out = new ByteArrayOutputStream();
      merge.write(out);
      byte[] _byteArray = out.toByteArray();
      ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray);
      metaInf.generateFile(manifest.getPath(), _byteArrayInputStream);
    }
  } finally {
    if ((in != null)) {
      in.close();
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:28,代码来源:XtextGenerator.java


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