Java Code Examples for org.eclipse.xtext.xbase.typesystem.references.FunctionTypeReference#addTypeArgument()
The following examples show how to use
org.eclipse.xtext.xbase.typesystem.references.FunctionTypeReference#addTypeArgument() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LightweightTypeReferenceSerializerTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@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[]>"); }
Example 2
Source File: LightweightTypeReferenceSerializerTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@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[]>"); }
Example 3
Source File: TypeParameterSubstitutor.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void enhanceFunctionType(FunctionTypeReference reference, FunctionTypeReference result, Visiting visiting) { for(LightweightTypeReference parameterType: reference.getParameterTypes()) { result.addParameterType(visitTypeArgument(parameterType, visiting, true)); } for(LightweightTypeReference typeArgument: reference.getTypeArguments()) { result.addTypeArgument(visitTypeArgument(typeArgument, visiting)); } LightweightTypeReference returnType = reference.getReturnType(); if (returnType != null) { result.setReturnType(visitTypeArgument(returnType, visiting)); } }
Example 4
Source File: LightweightTypeReferenceSerializerTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testFunctionType1() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Function0.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.setReturnType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(String.class)); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "()=>java.lang.String"), "org.eclipse.xtext.xbase.lib.Functions$Function0<java.lang.String>"); }
Example 5
Source File: LightweightTypeReferenceSerializerTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testFunctionType2() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Function1.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.addParameterType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(Void.class)); it.addTypeArgument(this.typeRef(String.class)); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String)=>void"), "org.eclipse.xtext.xbase.lib.Functions$Function1<java.lang.Void, java.lang.String>"); }
Example 6
Source File: LightweightTypeReferenceSerializerTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testFunctionType3() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Function1.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)); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String)=>java.lang.Object"), "org.eclipse.xtext.xbase.lib.Functions$Function1<java.lang.Object, java.lang.String>"); }
Example 7
Source File: LightweightTypeReferenceSerializerTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testFunctionType6() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Procedure1.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.addParameterType(this.typeRef(String.class)); it.addTypeArgument(this.typeRef(String.class)); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "(java.lang.String)=>void"), "org.eclipse.xtext.xbase.lib.Procedures$Procedure1<java.lang.String>"); }
Example 8
Source File: LightweightTypeReferenceSerializerTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testFunctionType10() { FunctionTypeReference _newFunctionTypeReference = this.getOwner().newFunctionTypeReference(this.type(Iterable.class)); final Procedure1<FunctionTypeReference> _function = (FunctionTypeReference it) -> { it.addTypeArgument(this.typeRef(String.class)); ParameterizedTypeReference _typeRef = this.typeRef(Iterator.class); final Procedure1<ParameterizedTypeReference> _function_1 = (ParameterizedTypeReference it_1) -> { it_1.addTypeArgument(this.typeRef(String.class)); }; ParameterizedTypeReference _doubleArrow = ObjectExtensions.<ParameterizedTypeReference>operator_doubleArrow(_typeRef, _function_1); it.setReturnType(_doubleArrow); }; this.assertInJava(this.assertInXtend(ObjectExtensions.<FunctionTypeReference>operator_doubleArrow(_newFunctionTypeReference, _function), "()=>java.util.Iterator<java.lang.String>"), "java.lang.Iterable<java.lang.String>"); }