How internal do we consider this to be?

It is currently sitting in SPI, and if that is the right place, is
this something we should document for Extension authors, or should it
be viewed as a Qi4j internal utility. If it is SPI proper (or maybe
even useful at API level), then perhaps we need to 'refine' it before
nailing it down.

Cheers
Niclas

On Sun, Oct 3, 2010 at 6:59 PM, Rickard Öberg <[email protected]> wrote:
> Hi,
>
> In Qi4j we have an Annotations class that provides some utility methods for
> accessing and working with annotations. It used to have quite a few of
> methods, and they were mostly variations of each other. I wanted to remove
> the creation of the ArrayList that most of these had, and at the same time
> make it easier to work with.
>
> So, it is now changed to have two types of methods. One category creates
> AnnotationSpecification's that are used for filtering. Then there's one
> method that takes an Iterable<Annotation> returns an Iterable<Annotation> of
> the ones that pass the spec, and which does the same but only returns the
> first match.
>
> I have then implemented everything else as being variations of using these
> methods, which have cleaned things up quite a bit. Example:
> for( Annotation constraintAnnotation : filter(
> hasAnnotation(org.qi4j.api.constraint.ConstraintDeclaration.class ),
> constraintAnnotations) )
> This example takes a list of annotations and iterates over the ones that
> have a ConstraintDeclaration on them.
>
> Another example:
> boolean optional = first( isType(Optional.class ), annotations) != null;
> Check if a list of annotations contain the @Optional annotation.
>
> And so on. Quite handy utility class.
>
> /Rickard
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>



-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to