org.eclipse.xtend.lib.annotations.ToString Java Examples
The following examples show how to use
org.eclipse.xtend.lib.annotations.ToString.
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: ToStringProcessor.java From xtext-lib with Eclipse Public License 2.0 | 5 votes |
public ToStringConfiguration getToStringConfig(final ClassDeclaration it) { ToStringConfiguration _xblockexpression = null; { final AnnotationReference anno = it.findAnnotation(this.context.findTypeGlobally(ToString.class)); ToStringConfiguration _xifexpression = null; if ((anno == null)) { _xifexpression = null; } else { _xifexpression = new ToStringConfiguration(anno); } _xblockexpression = _xifexpression; } return _xblockexpression; }
Example #2
Source File: ToStringProcessor.java From xtext-lib with Eclipse Public License 2.0 | 5 votes |
@Override public void doTransform(final MutableClassDeclaration it, @Extension final TransformationContext context) { AnnotationReference _findAnnotation = it.findAnnotation(context.findTypeGlobally(Data.class)); boolean _tripleNotEquals = (_findAnnotation != null); if (_tripleNotEquals) { return; } @Extension final ToStringProcessor.Util util = new ToStringProcessor.Util(context); final AnnotationReference annotation = it.findAnnotation(context.findTypeGlobally(ToString.class)); final ToStringConfiguration configuration = new ToStringConfiguration(annotation); boolean _hasToString = util.hasToString(it); if (_hasToString) { context.addWarning(annotation, "toString is already defined, this annotation has no effect."); } else { TypeReference _extendedClass = it.getExtendedClass(); TypeReference _object = context.getObject(); boolean _notEquals = (!Objects.equal(_extendedClass, _object)); if (_notEquals) { util.addReflectiveToString(it, configuration); } else { final Function1<MutableFieldDeclaration, Boolean> _function = (MutableFieldDeclaration it_1) -> { return Boolean.valueOf(((context.isThePrimaryGeneratedJavaElement(it_1) && (!it_1.isStatic())) && (!it_1.isTransient()))); }; util.addToString(it, IterableExtensions.filter(it.getDeclaredFields(), _function), configuration); } } }
Example #3
Source File: SARLValidator.java From sarl with Apache License 2.0 | 5 votes |
/** Replies if the given annotation is an active annotation for object-oriented elements. * * @param annotation the annotation. * @return {@code true} if the annotation should be used only for OO elements. * @see #isAOActiveAnnotation(XAnnotation) */ @SuppressWarnings("static-method") protected boolean isOOActiveAnnotation(XAnnotation annotation) { final String name = annotation.getAnnotationType().getQualifiedName(); return Strings.equal(Accessors.class.getName(), name) || Strings.equal(Data.class.getName(), name) || Strings.equal(Delegate.class.getName(), name) || Strings.equal(ToString.class.getName(), name); }