/** * Returns the collection of annotations of a pattern by a name. For getting the first annotations by name, see * {@link #getAnnotationByName(Pattern, String)} * * @param pattern * the pattern instance * @param name * the name of the annotation to return * @returns a non-null, but possibly empty collection of annotations * @since 0.7.0 */ public static Collection<Annotation> getAnnotationsByName(Pattern pattern, String name) { return Collections2.filter(pattern.getAnnotations(), new AnnotationNameFilter(name)); }
/** * Returns the first annotation of a given name from a pattern. This method ignores multiple defined annotations by * the same name. For getting a filtered collections of annotations, see * {@link #getAnnotationsByName(Pattern, String)} * * @param pattern * the pattern instance * @param name * the name of the annotation to return * @returns the first annotation or null if no such annotation exists * @since 0.7.0 */ public static Annotation getFirstAnnotationByName(Pattern pattern, String name) { return Iterables.find(pattern.getAnnotations(), new AnnotationNameFilter(name), null); }
protected void buildAnnotations(Pattern pattern, InitializablePQuery query) throws IncQueryException { for (Annotation annotation : pattern.getAnnotations()) { PAnnotation pAnnotation = new PAnnotation(annotation.getName()); for (Entry<String, Object> attribute : CorePatternLanguageHelper.evaluateAnnotationParameters(annotation).entrySet()) { pAnnotation.addAttribute(attribute.getKey(), attribute.getValue()); } query.addAnnotation(pAnnotation); } }
@Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { EList<Annotation> _annotations = pattern.getAnnotations(); for(final Annotation annotation : _annotations) { _builder.append(" ");