本文整理汇总了Java中org.eclipse.xtext.xbase.lib.ObjectExtensions类的典型用法代码示例。如果您正苦于以下问题:Java ObjectExtensions类的具体用法?Java ObjectExtensions怎么用?Java ObjectExtensions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectExtensions类属于org.eclipse.xtext.xbase.lib包,在下文中一共展示了ObjectExtensions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: change
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
private TextEdit change(final Position startPos, final Position endPos, final String newText) {
TextEdit _textEdit = new TextEdit();
final Procedure1<TextEdit> _function = (TextEdit it) -> {
if ((startPos != null)) {
Range _range = new Range();
final Procedure1<Range> _function_1 = (Range it_1) -> {
it_1.setStart(startPos);
it_1.setEnd(endPos);
};
Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1);
it.setRange(_doubleArrow);
}
it.setNewText(newText);
};
return ObjectExtensions.<TextEdit>operator_doubleArrow(_textEdit, _function);
}
示例2: testRangeFormattingService
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
@Test
public void testRangeFormattingService() {
final Procedure1<RangeFormattingConfiguration> _function = (RangeFormattingConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("type Foo{int bar} type Bar{Foo foo}");
it.setModel(_builder.toString());
Range _range = new Range();
final Procedure1<Range> _function_1 = (Range it_1) -> {
Position _position = new Position(0, 0);
it_1.setStart(_position);
Position _position_1 = new Position(0, 17);
it_1.setEnd(_position_1);
};
Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1);
it.setRange(_doubleArrow);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("type Foo{");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("int bar");
_builder_1.newLine();
_builder_1.append("} type Bar{Foo foo}");
it.setExpectedText(_builder_1.toString());
};
this.testRangeFormatting(_function);
}
示例3: getExtensionClasses
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的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);
}
示例4: install
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
public GeneratorConfig install(final ResourceSet resourceSet, final GeneratorConfig config) {
GeneratorConfigProvider.GeneratorConfigAdapter _elvis = null;
GeneratorConfigProvider.GeneratorConfigAdapter _findInEmfObject = GeneratorConfigProvider.GeneratorConfigAdapter.findInEmfObject(resourceSet);
if (_findInEmfObject != null) {
_elvis = _findInEmfObject;
} else {
GeneratorConfigProvider.GeneratorConfigAdapter _generatorConfigAdapter = new GeneratorConfigProvider.GeneratorConfigAdapter();
final Procedure1<GeneratorConfigProvider.GeneratorConfigAdapter> _function = (GeneratorConfigProvider.GeneratorConfigAdapter it) -> {
it.attachToEmfObject(resourceSet);
};
GeneratorConfigProvider.GeneratorConfigAdapter _doubleArrow = ObjectExtensions.<GeneratorConfigProvider.GeneratorConfigAdapter>operator_doubleArrow(_generatorConfigAdapter, _function);
_elvis = _doubleArrow;
}
final GeneratorConfigProvider.GeneratorConfigAdapter adapter = _elvis;
return adapter.language2GeneratorConfig.put(this.languageId, config);
}
示例5: newBuildRequest
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
protected BuildRequest newBuildRequest(final List<URI> changedFiles, final List<URI> deletedFiles, final List<IResourceDescription.Delta> externalDeltas, final CancelIndicator cancelIndicator) {
BuildRequest _buildRequest = new BuildRequest();
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
it.setBaseDir(this.baseDir);
ResourceDescriptionsData _copy = this.indexState.getResourceDescriptions().copy();
Source2GeneratedMapping _copy_1 = this.indexState.getFileMappings().copy();
IndexState _indexState = new IndexState(_copy, _copy_1);
it.setState(_indexState);
it.setResourceSet(this.createFreshResourceSet(it.getState().getResourceDescriptions()));
it.setDirtyFiles(changedFiles);
it.setDeletedFiles(deletedFiles);
it.setExternalDeltas(externalDeltas);
final BuildRequest.IPostValidationCallback _function_1 = (URI uri, Iterable<Issue> issues) -> {
this.issueAcceptor.apply(uri, issues);
return true;
};
it.setAfterValidate(_function_1);
it.setCancelIndicator(cancelIndicator);
};
return ObjectExtensions.<BuildRequest>operator_doubleArrow(_buildRequest, _function);
}
示例6: forEachWithShortcut
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
/**
* Uses curly braces and comma as delimiters. Doesn't use them for single valued iterables.
*/
public <T extends Object> void forEachWithShortcut(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super T> procedure) {
int _size = IterableExtensions.size(elements);
boolean _equals = (_size == 1);
if (_equals) {
T _head = IterableExtensions.<T>head(elements);
ObjectExtensions.<T>operator_doubleArrow(_head, procedure);
} else {
appendable.append("{");
final Procedure1<LoopParams> _function = (LoopParams it) -> {
it.setPrefix(" ");
it.setSeparator(", ");
it.setSuffix(" ");
};
this.<T>forEach(appendable, elements, _function, procedure);
appendable.append("}");
}
}
示例7: toTypeReference
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
protected JvmTypeReference toTypeReference(final JvmType type, final int arrayDimensions) {
if ((type == null)) {
return null;
}
JvmParameterizedTypeReference _createJvmParameterizedTypeReference = TypesFactory.eINSTANCE.createJvmParameterizedTypeReference();
final Procedure1<JvmParameterizedTypeReference> _function = (JvmParameterizedTypeReference it) -> {
it.setType(type);
};
JvmTypeReference resultTypeRef = ObjectExtensions.<JvmParameterizedTypeReference>operator_doubleArrow(_createJvmParameterizedTypeReference, _function);
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, arrayDimensions, true);
for (final Integer i : _doubleDotLessThan) {
{
final JvmGenericArrayTypeReference arrayRef = TypesFactory.eINSTANCE.createJvmGenericArrayTypeReference();
arrayRef.setComponentType(resultTypeRef);
resultTypeRef = arrayRef;
}
}
return resultTypeRef;
}
示例8: testDuplicateCases_typeLiteral_2
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
@Test
public void testDuplicateCases_typeLiteral_2() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("switch x : String {");
_builder.newLine();
_builder.append("\t");
_builder.append("case String: 1");
_builder.newLine();
_builder.append("\t");
_builder.append("case typeof(String): 1");
_builder.newLine();
_builder.append("}");
_builder.newLine();
XExpression _expression = this.expression(_builder);
final Procedure1<XExpression> _function = (XExpression it) -> {
this._validationTestHelper.assertError(it, XbasePackage.Literals.XTYPE_LITERAL, IssueCodes.DUPLICATE_CASE);
this._validationTestHelper.assertError(it, XbasePackage.Literals.XFEATURE_CALL, IssueCodes.DUPLICATE_CASE);
};
ObjectExtensions.<XExpression>operator_doubleArrow(_expression, _function);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例9: testFunctionType4
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
@Test
public void testFunctionType4() {
FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Function3.class));
final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> {
it.setReturnType(this.typeRef(Object.class));
it.addTypeArgument(this.typeRef(Object.class));
it.addParameterType(this.typeRef(String.class));
it.addTypeArgument(this.typeRef(String.class));
ParameterizedTypeReference _typeRef = this.typeRef(List.class);
final Procedure1<ParameterizedTypeReference> _function_1 = (ParameterizedTypeReference it_1) -> {
WildcardTypeReference _newWildcardTypeReference = it_1.getOwner().newWildcardTypeReference();
final Procedure1<WildcardTypeReference> _function_2 = (WildcardTypeReference it_2) -> {
it_2.setLowerBound(this.typeRef(CharSequence.class));
};
WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_2);
it_1.addTypeArgument(_doubleArrow);
};
final ParameterizedTypeReference listOfCharSequence = ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function_1);
it.addParameterType(listOfCharSequence);
it.addTypeArgument(listOfCharSequence);
final ArrayTypeReference arrayOfObject = it.getOwner().newArrayTypeReference(this.typeRef(Object.class));
it.addParameterType(arrayOfObject);
it.addTypeArgument(arrayOfObject);
};
this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[])=>java.lang.Object"), "org.eclipse.xtext.xbase.lib.Functions$Function3<java.lang.Object, java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[]>");
}
示例10: testFunctionType7
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
@Test
public void testFunctionType7() {
FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Procedure3.class));
final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> {
it.addParameterType(this.typeRef(String.class));
it.addTypeArgument(this.typeRef(String.class));
ParameterizedTypeReference _typeRef = this.typeRef(List.class);
final Procedure1<ParameterizedTypeReference> _function_1 = (ParameterizedTypeReference it_1) -> {
WildcardTypeReference _newWildcardTypeReference = it_1.getOwner().newWildcardTypeReference();
final Procedure1<WildcardTypeReference> _function_2 = (WildcardTypeReference it_2) -> {
it_2.setLowerBound(this.typeRef(CharSequence.class));
};
WildcardTypeReference _doubleArrow = ObjectExtensions.<WildcardTypeReference>operator_doubleArrow(_newWildcardTypeReference, _function_2);
it_1.addTypeArgument(_doubleArrow);
};
final ParameterizedTypeReference listOfCharSequence = ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function_1);
it.addParameterType(listOfCharSequence);
it.addTypeArgument(listOfCharSequence);
final ArrayTypeReference arrayOfObject = it.getOwner().newArrayTypeReference(this.typeRef(Object.class));
it.addParameterType(arrayOfObject);
it.addTypeArgument(arrayOfObject);
};
this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[])=>void"), "org.eclipse.xtext.xbase.lib.Procedures$Procedure3<java.lang.String, java.util.List<? super java.lang.CharSequence>, java.lang.Object[]>");
}
示例11: toTextEdit
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
protected TextEdit toTextEdit(final Document document, final String formattedText, final int startOffset, final int length) {
TextEdit _textEdit = new TextEdit();
final Procedure1<TextEdit> _function = (TextEdit it) -> {
it.setNewText(formattedText);
Range _range = new Range();
final Procedure1<Range> _function_1 = (Range it_1) -> {
it_1.setStart(document.getPosition(startOffset));
it_1.setEnd(document.getPosition((startOffset + length)));
};
Range _doubleArrow = ObjectExtensions.<Range>operator_doubleArrow(_range, _function_1);
it.setRange(_doubleArrow);
};
return ObjectExtensions.<TextEdit>operator_doubleArrow(_textEdit, _function);
}
示例12: getTaskTags
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
@Override
public TaskTags getTaskTags(final Resource resource) {
TaskTags _xblockexpression = null;
{
final IPreferenceValues prefs = this.preferenceValuesProvider.getPreferenceValues(resource);
final String names = prefs.getPreference(PreferenceTaskTagProvider.TAGS_KEY);
final String priorities = prefs.getPreference(PreferenceTaskTagProvider.PRIORITIES_KEY);
TaskTags _taskTags = new TaskTags();
final Procedure1<TaskTags> _function = (TaskTags it) -> {
it.setCaseSensitive((Boolean.valueOf(prefs.getPreference(PreferenceTaskTagProvider.CASE_SENSITIVE_KEY))).booleanValue());
List<TaskTag> _taskTags_1 = it.getTaskTags();
List<TaskTag> _parseTags = PreferenceTaskTagProvider.parseTags(names, priorities);
Iterables.<TaskTag>addAll(_taskTags_1, _parseTags);
};
_xblockexpression = ObjectExtensions.<TaskTags>operator_doubleArrow(_taskTags, _function);
}
return _xblockexpression;
}
示例13: setSourceLevelUris
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
public static void setSourceLevelUris(final ResourceSet resourceSet, final Collection<URI> uris) {
SourceLevelURIsAdapter _elvis = null;
SourceLevelURIsAdapter _findInstalledAdapter = SourceLevelURIsAdapter.findInstalledAdapter(resourceSet);
if (_findInstalledAdapter != null) {
_elvis = _findInstalledAdapter;
} else {
SourceLevelURIsAdapter _sourceLevelURIsAdapter = new SourceLevelURIsAdapter();
final Procedure1<SourceLevelURIsAdapter> _function = (SourceLevelURIsAdapter it) -> {
EList<Adapter> _eAdapters = resourceSet.eAdapters();
_eAdapters.add(it);
};
SourceLevelURIsAdapter _doubleArrow = ObjectExtensions.<SourceLevelURIsAdapter>operator_doubleArrow(_sourceLevelURIsAdapter, _function);
_elvis = _doubleArrow;
}
final SourceLevelURIsAdapter adapter = _elvis;
adapter.sourceLevelURIs = ImmutableSet.<URI>copyOf(uris);
}
示例14: createCopy
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
private static SerializableEObjectDescription createCopy(final IEObjectDescription desc) {
if ((desc instanceof SerializableEObjectDescriptionProvider)) {
return ((SerializableEObjectDescriptionProvider)desc).toSerializableEObjectDescription();
}
SerializableEObjectDescription _serializableEObjectDescription = new SerializableEObjectDescription();
final Procedure1<SerializableEObjectDescription> _function = (SerializableEObjectDescription it) -> {
it.setEClass(desc.getEClass());
it.setEObjectURI(desc.getEObjectURI());
it.qualifiedName = desc.getQualifiedName();
int _size = ((List<String>)Conversions.doWrapArray(desc.getUserDataKeys())).size();
HashMap<String, String> _hashMap = new HashMap<String, String>(_size);
it.userData = _hashMap;
String[] _userDataKeys = desc.getUserDataKeys();
for (final String key : _userDataKeys) {
it.userData.put(key, desc.getUserData(key));
}
};
return ObjectExtensions.<SerializableEObjectDescription>operator_doubleArrow(_serializableEObjectDescription, _function);
}
示例15: setContext
import org.eclipse.xtext.xbase.lib.ObjectExtensions; //导入依赖的package包/类
@Override
public void setContext(final Notifier ctx) {
IResourceDescriptions _localDescriptions = this.getLocalDescriptions();
final Procedure1<ResourceSetBasedResourceDescriptions> _function = (ResourceSetBasedResourceDescriptions it) -> {
it.setContext(ctx);
it.setData(null);
};
ObjectExtensions.<ResourceSetBasedResourceDescriptions>operator_doubleArrow(((ResourceSetBasedResourceDescriptions) _localDescriptions), _function);
final ResourceSet resourceSet = EcoreUtil2.getResourceSet(ctx);
this.setGlobalDescriptions(ChunkedResourceDescriptions.findInEmfObject(resourceSet));
IProjectConfig _projectConfig = null;
if (this.projectConfigProvider!=null) {
_projectConfig=this.projectConfigProvider.getProjectConfig(resourceSet);
}
IWorkspaceConfig _workspaceConfig = null;
if (_projectConfig!=null) {
_workspaceConfig=_projectConfig.getWorkspaceConfig();
}
this.workspaceConfig = _workspaceConfig;
}