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


Java Conversions.unwrapArray方法代码示例

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


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

示例1: _generateArguments

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
private List<ParameterValueMapping> _generateArguments(final TAbstractMessages tMessage, final Operation operation, final Lifeline lifeline) {
  List<ParameterValueMapping> _xblockexpression = null;
  {
    final List<ParameterValueMapping> result = CollectionLiterals.<ParameterValueMapping>newArrayList();
    EList<Parameter> _parameters = operation.getParameters();
    boolean _isEmpty = _parameters.isEmpty();
    boolean _equals = (_isEmpty == false);
    if (_equals) {
      EList<Parameter> _parameters_1 = operation.getParameters();
      int _length = ((Object[])Conversions.unwrapArray(_parameters_1, Object.class)).length;
      int _minus = (_length - 1);
      IntegerRange _upTo = new IntegerRange(0, _minus);
      for (final Integer i : _upTo) {
        EList<Parameter> _parameters_2 = operation.getParameters();
        Parameter _get = _parameters_2.get((i).intValue());
        EList<TParameter> _arguments = tMessage.getArguments();
        TParameter _get_1 = _arguments.get((i).intValue());
        ParameterValueMapping _createParameterValueMapping = this.createParameterValueMapping(_get, _get_1, lifeline);
        result.add(_createParameterValueMapping);
      }
    }
    _xblockexpression = result;
  }
  return _xblockexpression;
}
 
开发者ID:mjorod,项目名称:textram,代码行数:26,代码来源:MessageViewsGenerator.java

示例2: _doEvaluate

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
protected Object _doEvaluate(XListLiteral literal, IEvaluationContext context, CancelIndicator indicator) {
	IResolvedTypes resolveTypes = typeResolver.resolveTypes(literal);
	LightweightTypeReference type = resolveTypes.getActualType(literal);
	List<Object> list = newArrayList();
	for(XExpression element: literal.getElements()) {
		if (indicator.isCanceled())
			throw new InterpreterCanceledException();
		list.add(internalEvaluate(element, context, indicator));
	}
	if(type != null && type.isArray()) {
		try {
			LightweightTypeReference componentType = type.getComponentType();
			return Conversions.unwrapArray(list, getJavaType(componentType.getType()));
		} catch (ClassNotFoundException e) {
		}
	}
	return Collections.unmodifiableList(list);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:XbaseInterpreter.java

示例3: toAnnoString

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
public String[] toAnnoString(final Iterable<HDLAnnotation> annotations) {
  final Function1<HDLAnnotation, String> _function = (HDLAnnotation it) -> {
    String _xifexpression = null;
    String _value = it.getValue();
    boolean _tripleEquals = (_value == null);
    if (_tripleEquals) {
      _xifexpression = it.getName().substring(1);
    } else {
      String _substring = it.getName().substring(1);
      String _plus = (_substring + Character.valueOf(SimulationTransformationExtension.ANNO_VALUE_SEP));
      String _value_1 = it.getValue();
      _xifexpression = (_plus + _value_1);
    }
    return _xifexpression;
  };
  return ((String[])Conversions.unwrapArray(IterableExtensions.<HDLAnnotation, String>map(annotations, _function), String.class));
}
 
开发者ID:pshdl,项目名称:org.pshdl,代码行数:18,代码来源:SimulationTransformationExtension.java

示例4: testStubGenerationWithTypeParamers_01

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
@Test
public void testStubGenerationWithTypeParamers_01() {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package my.pack;");
  _builder.newLine();
  _builder.newLine();
  _builder.append("public class MyTest<T extends CharSequence> {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("interface InnerInterface<A,B> {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("static class DeepNested<X> {}");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  final Procedure1<IResourceDescription> _function = (IResourceDescription it) -> {
    final IEObjectDescription mytest = IterableExtensions.<IEObjectDescription>head(it.getExportedObjects());
    Assert.assertEquals("my.pack.MyTest", mytest.getQualifiedName().toString());
    Assert.assertEquals("<T>", mytest.getUserData(JvmTypesResourceDescriptionStrategy.TYPE_PARAMETERS));
    final IEObjectDescription innerinterface = ((IEObjectDescription[])Conversions.unwrapArray(it.getExportedObjects(), IEObjectDescription.class))[1];
    Assert.assertEquals("my.pack.MyTest.InnerInterface", innerinterface.getQualifiedName().toString());
    Assert.assertEquals("<A,B>", innerinterface.getUserData(JvmTypesResourceDescriptionStrategy.TYPE_PARAMETERS));
    Assert.assertEquals(Boolean.TRUE.toString(), innerinterface.getUserData(JvmTypesResourceDescriptionStrategy.IS_INTERFACE));
    final IEObjectDescription deepNested = ((IEObjectDescription[])Conversions.unwrapArray(it.getExportedObjects(), IEObjectDescription.class))[2];
    Assert.assertEquals("my.pack.MyTest.InnerInterface.DeepNested", deepNested.getQualifiedName().toString());
    Assert.assertEquals("<X>", deepNested.getUserData(JvmTypesResourceDescriptionStrategy.TYPE_PARAMETERS));
  };
  this.resultsIn(_builder, _function);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:34,代码来源:ResourceDescriptionProviderTest.java

示例5: wrapOrUnwrapArray

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
protected Object wrapOrUnwrapArray(Object result, LightweightTypeReference expectedType) {
	if (expectedType.isArray() && !(result instanceof Object[])) {
		Class<?> arrayType;
		try {
			arrayType = getJavaType(expectedType.getComponentType().getType());
			return Conversions.unwrapArray(result, arrayType);
		} catch (ClassNotFoundException e) {
			return result;
		}
	} else if (!expectedType.isArray() && expectedType.isSubtypeOf(Iterable.class)) {
		return Conversions.doWrapArray(result);
	}
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:15,代码来源:XbaseInterpreter.java

示例6: createURLClassLoader

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
private URLClassLoader createURLClassLoader(final Iterable<String> classPathEntries) {
  final Function1<String, URL> _function = (String str) -> {
    try {
      return new File(str).toURI().toURL();
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  };
  final Iterable<URL> classPathUrls = IterableExtensions.<String, URL>map(classPathEntries, _function);
  return new URLClassLoader(((URL[])Conversions.unwrapArray(classPathUrls, URL.class)));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:StandaloneBuilder.java

示例7: getRequiredBundlesRt

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
@Override
public String[] getRequiredBundlesRt(final Grammar grammar) {
  List<String> _xifexpression = null;
  if (this.generateXtendStub) {
    _xifexpression = Collections.<String>singletonList("org.eclipse.xtext.xbase.lib");
  } else {
    _xifexpression = null;
  }
  return ((String[])Conversions.unwrapArray(_xifexpression, String.class));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:SerializerFragment.java

示例8: getRequiredBundlesUi

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
@Override
public String[] getRequiredBundlesUi(final Grammar grammar) {
  List<String> _xifexpression = null;
  if (this.generateStub) {
    _xifexpression = CollectionLiterals.<String>newArrayList("org.eclipse.xtext.ui", "org.eclipse.xtext.xbase.lib");
  } else {
    _xifexpression = Collections.<String>singletonList("org.eclipse.xtext.ui");
  }
  return ((String[])Conversions.unwrapArray(_xifexpression, String.class));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:ContentAssistFragment.java

示例9: getAntlrParams

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
public String[] getAntlrParams() {
  ArrayList<String> params = Lists.<String>newArrayList(this.antlrParams);
  boolean _contains = params.contains("-Xconversiontimeout");
  boolean _not = (!_contains);
  if (_not) {
    params.add(0, "-Xconversiontimeout");
    params.add(1, "100000");
  }
  return ((String[])Conversions.unwrapArray(params, String.class));
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:11,代码来源:AbstractAntlrGeneratorFragment2.java

示例10: getPackageName

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
private static String getPackageName(final String qualifiedName, final boolean strict) {
  final List<String> segments = IterableExtensions.<String>toList(Splitter.on(".").split(qualifiedName));
  int _size = segments.size();
  boolean _equals = (_size == 1);
  if (_equals) {
    return "";
  }
  if (strict) {
    int _length = ((Object[])Conversions.unwrapArray(segments, Object.class)).length;
    int _minus = (_length - 1);
    final List<String> packageSegments = segments.subList(0, _minus);
    final Function1<String, Boolean> _function = (String it) -> {
      return Boolean.valueOf(Character.isUpperCase(it.charAt(0)));
    };
    boolean _isEmpty = IterableExtensions.isEmpty(IterableExtensions.<String>filter(packageSegments, _function));
    boolean _not = (!_isEmpty);
    if (_not) {
      throw new IllegalArgumentException((("Cannot determine the package name of \'" + qualifiedName) + "\'. Please use the TypeReference(packageName, className) constructor"));
    }
    return IterableExtensions.join(packageSegments, ".");
  } else {
    int _length_1 = ((Object[])Conversions.unwrapArray(segments, Object.class)).length;
    int _minus_1 = (_length_1 - 1);
    List<String> packageSegments_1 = segments.subList(0, _minus_1);
    while ((!packageSegments_1.isEmpty())) {
      boolean _isUpperCase = Character.isUpperCase(IterableExtensions.<String>last(packageSegments_1).charAt(0));
      if (_isUpperCase) {
        final List<String> _converted_packageSegments_1 = (List<String>)packageSegments_1;
        int _length_2 = ((Object[])Conversions.unwrapArray(_converted_packageSegments_1, Object.class)).length;
        int _minus_2 = (_length_2 - 1);
        packageSegments_1 = packageSegments_1.subList(0, _minus_2);
      } else {
        return IterableExtensions.join(packageSegments_1, ".");
      }
    }
    return "";
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:39,代码来源:TypeReference.java

示例11: JavaFileAccess

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
protected JavaFileAccess(final TypeReference typeRef, final CodeConfig codeConfig) {
  int _length = ((Object[])Conversions.unwrapArray(typeRef.getSimpleNames(), Object.class)).length;
  boolean _greaterThan = (_length > 1);
  if (_greaterThan) {
    throw new IllegalArgumentException(("Nested type cannot be serialized: " + typeRef));
  }
  this.javaType = typeRef;
  this.codeConfig = codeConfig;
  String _path = typeRef.getPath();
  String _plus = (_path + ".");
  String _fileExtension = this.getFileExtension();
  String _plus_1 = (_plus + _fileExtension);
  this.setPath(_plus_1);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:15,代码来源:JavaFileAccess.java

示例12: AlternateJdkLoader

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
public AlternateJdkLoader(final Iterable<File> files) {
  super(((URL[])Conversions.unwrapArray(IterableExtensions.<File, URL>map(files, ((Function1<File, URL>) (File it) -> {
    try {
      return it.toURI().toURL();
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  })), URL.class)));
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:10,代码来源:AlternateJdkLoader.java

示例13: firstName

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
public static String firstName() {
  String _xblockexpression = null;
  {
    double _random = Math.random();
    Iterable<String> _firstNames = Names.firstNames();
    int _size = IterableExtensions.size(_firstNames);
    double _multiply = (_random * _size);
    final int index = ((int) _multiply);
    Iterable<String> _firstNames_1 = Names.firstNames();
    _xblockexpression = ((String[])Conversions.unwrapArray(_firstNames_1, String.class))[index];
  }
  return _xblockexpression;
}
 
开发者ID:East196,项目名称:maker,代码行数:14,代码来源:Names.java

示例14: lastName

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
public static String lastName() {
  String _xblockexpression = null;
  {
    double _random = Math.random();
    Iterable<String> _firstNames = Names.firstNames();
    int _size = IterableExtensions.size(_firstNames);
    double _multiply = (_random * _size);
    final int index = ((int) _multiply);
    Iterable<String> _lastNames = Names.lastNames();
    _xblockexpression = ((String[])Conversions.unwrapArray(_lastNames, String.class))[index];
  }
  return _xblockexpression;
}
 
开发者ID:East196,项目名称:maker,代码行数:14,代码来源:Names.java

示例15: nickname

import org.eclipse.xtext.xbase.lib.Conversions; //导入方法依赖的package包/类
public static CharSequence nickname(final String fullName) {
  StringConcatenation _builder = new StringConcatenation();
  int _nextInt = RandomUtils.nextInt(0, 4);
  String _get = ((String[])Conversions.unwrapArray(Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("勇敢的", "美丽的", "坚强的", "淘气的")), String.class))[_nextInt];
  _builder.append(_get, "");
  _builder.append(fullName, "");
  return _builder;
}
 
开发者ID:East196,项目名称:maker,代码行数:9,代码来源:Randoms.java


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