Java Code Examples for org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration#setType()
The following examples show how to use
org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration#setType() .
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: CheckMutableFieldDeclarationProcessor.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void doTransform(final MutableFieldDeclaration annotatedField, @Extension final TransformationContext context) { final Procedure0 _function = () -> { annotatedField.setInitializer(((CompilationStrategy) null)); }; MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "initializer cannot be null", _function); final Procedure0 _function_1 = () -> { annotatedField.setType(null); }; MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "type cannot be null", _function_1); }
Example 2
Source File: _TESTDATA_InternalClassProcessor.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) { String _qualifiedName = annotatedClass.getQualifiedName(); String _plus = (_qualifiedName + ".InternalClass"); MutableClassDeclaration _findClass = context.findClass(_plus); final Procedure1<MutableClassDeclaration> _function = (MutableClassDeclaration it) -> { final Procedure1<MutableFieldDeclaration> _function_1 = (MutableFieldDeclaration it_1) -> { it_1.setType(context.getString()); }; it.addField("myField", _function_1); }; ObjectExtensions.<MutableClassDeclaration>operator_doubleArrow(_findClass, _function); }
Example 3
Source File: FileProcessor.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) { final Path path = annotatedClass.getCompilationUnit().getFilePath(); final String contents = context.getContents(context.getProjectFolder(path).append("res/template.txt")).toString(); final String[] segments = contents.trim().split(","); for (final String segment : segments) { final Procedure1<MutableFieldDeclaration> _function = (MutableFieldDeclaration it) -> { it.setType(context.getString()); }; annotatedClass.addField(segment, _function); } }