Java Code Examples for org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration#isFinal()
The following examples show how to use
org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration#isFinal() .
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: PropertyProcessor.java From xtext-lib with Eclipse Public License 2.0 | 6 votes |
@Override public void doTransform(final MutableFieldDeclaration it, @Extension final TransformationContext context) { @Extension final AccessorsProcessor.Util util = new AccessorsProcessor.Util(context); boolean _hasGetter = util.hasGetter(it); boolean _not = (!_hasGetter); if (_not) { util.addGetter(it, Visibility.PUBLIC); } if (((!it.isFinal()) && (!util.hasSetter(it)))) { util.addSetter(it, Visibility.PUBLIC); } String _firstLower = StringExtensions.toFirstLower(it.getSimpleName()); String _plus = ("_" + _firstLower); it.setSimpleName(_plus); }
Example 2
Source File: AccessorsProcessor.java From xtext-lib with Eclipse Public License 2.0 | 5 votes |
public void validateSetter(final MutableFieldDeclaration field) { boolean _isFinal = field.isFinal(); if (_isFinal) { this.context.addError(field, "Cannot set a final field"); } if (((field.getType() == null) || field.getType().isInferred())) { this.context.addError(field, "Type cannot be inferred."); return; } }