You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gu...@apache.org on 2013/07/26 14:33:30 UTC

svn commit: r1507289 [1/3] - in /felix/trunk/ipojo/manipulator: annotations/src/main/java/org/apache/felix/ipojo/annotations/ manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ manipulator-i...

Author: guillaume
Date: Fri Jul 26 12:33:28 2013
New Revision: 1507289

URL: http://svn.apache.org/r1507289
Log:
FELIX-4112 Add meta-annotations for handler description

* @HandlerBinding can be used to declare an annotation as a handler
  annotation (will produce Elements in the metadata structure). The
  supporting annotation type do not have to be in a package containing
  'handler' or 'ipojo'
* @Ignore can be used to ignore an annotation that would be (otherwise)
  mapped to a custom handler annotation (because it contains 'handler'
  or 'ipojo' in its name)
* Unified support for @Stereotype, @HandlerBinding and @Ignore
* Merged BindingRegistry and AnnotationBindingRegistry into 1 entity
** Implementation is split into 3 delegating registries for better
   separation of concerns
* Module DSL improved to support @Stereotype, @HandlerBinding and
  @Ignore registration
* Added annotations javadoc

Added:
    felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java
    felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java
    felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java
    felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/
    felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java
    felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java
    felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java
    felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java
    felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationLiteral.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitAnnotation.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitArray.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnd.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnum.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistry.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistry.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistry.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitorFactory.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullBinding.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullVisitorFactory.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/StereotypeVisitorFactory.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/ChainedAnnotationVisitor.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationLiteralTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlaybackTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/AnnotationAnnotation.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/ArrayAnnotation.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/EnumAnnotation.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/InnerAnnotation.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Mode.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/SimpleTypes.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Support.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorderTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistryTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistryTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistryTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistryTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistryTestCase.java
Removed:
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/AnnotationRegistry.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/StereotypeParser.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/StereotypeVisitor.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/AnnotationRecorder.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/Replay.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/RootAnnotationRecorder.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/Visit.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/VisitAnnotation.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/VisitArray.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/VisitEnd.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/VisitEnum.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/AnnotationRegistryTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/BindingRegistryTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/StereotypeParserTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/stereotype/replay/AnnotationRecorderTestCase.java
Modified:
    felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Binding.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/BindingRegistry.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/FieldStereotypeVisitor.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/MethodStereotypeVisitor.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/ParameterStereotypeVisitor.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/TypeStereotypeVisitor.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Bindings.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Elements.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModule.java
    felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/BindingContext.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProviderTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/SelectionTestCase.java
    felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModuleTestCase.java

Added: felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java (added)
+++ felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A @{@link HandlerBinding} bind its annotated type to a given handler.
+ *
+ * The handler name is specified as parameter using the {@literal 'namespace:name'} format (qualified name).
+ *
+ * <pre>
+ *     // Namespace and name will be inferred from the annotation's package name.
+ *     &#64;HandlerBinding()
+ *     public &#64;interface Foo {}
+ *
+ *     // No namespace declared, default will be used ('org.apache.felix.ipojo')
+ *     &#64;HandlerBinding("foo")
+ *     public &#64;interface Foo {}
+ *
+ *     // Namespace will be 'com.acme' and name: 'foo'
+ *     &#64;HandlerBinding("com.acme:foo")
+ *     public &#64;interface Foo {}
+ *
+ *     // Provided namespace and value (for the name) will be used
+ *     &#64;HandlerBinding(namespace = "com.acme", value = "foo")
+ *     public &#64;interface Foo {}
+ * </pre>
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.CLASS)
+public @interface HandlerBinding {
+    String DEFAULT = "#";
+
+    /**
+     * Defines the handler's namespace. Must be used in correlation with the {@literal value} attribute.
+     * <pre>
+     *     &#64;HandlerBinding(namespace = "com.acme", value = "foo")
+     *     public &#64;interface Foo {}
+     * </pre>
+     */
+    String namespace() default DEFAULT;
+
+    /**
+     * When used <b>without</b> the {@literal namespace} attribute, defines both the namespace + name
+     * of a handler in a short notation (if no namespace can be found in the parameter - no ':' separator - fallback
+     * on iPOJO's default namespace):
+     *
+     * <pre>
+     *     &#64;HandlerBinding("com.acme:foo")
+     *     public &#64;interface Foo {}
+     * </pre>
+     *
+     * When used <b>with</b> the {@literal namespace} attribute, holds the name of the handler (without
+     * its namespace part):
+     *
+     * <pre>
+     *     &#64;HandlerBinding(namesapce = "com.acme", value = "foo")
+     *     public &#64;interface Foo {}
+     * </pre>
+     */
+    String value() default DEFAULT;
+}

Added: felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java (added)
+++ felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A @{@link Ignore} annotation mark its annotated type to be ignored by the iPOJO manipulator.
+ * This is handy when the annotation could be recognized as a "custom annotation handler" (contains {@literal ".ipojo."}
+ * or {@literal ".handler."} in its package name) but in fact is not a handler annotation at all.
+ *
+ * <pre>
+ *     package com.acme.ipojo.handler;
+ *     &#64;Ignore
+ *     public &#64;interface Foo {}
+ * </pre>
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Target(ElementType.ANNOTATION_TYPE)
+@Retention(RetentionPolicy.CLASS)
+public @interface Ignore {}

Modified: felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java?rev=1507289&r1=1507288&r2=1507289&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java (original)
+++ felix/trunk/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java Fri Jul 26 12:33:28 2013
@@ -24,7 +24,46 @@ import java.lang.annotation.RetentionPol
 import java.lang.annotation.Target;
 
 /**
- * Mark the annotated annotation type to be a marker annotation dedicated to an iPOJO handler.
+ * In many systems, use of architectural patterns produces a set of recurring roles. A stereotype allows a
+ * framework developer to identify such a role and declare some common metadata for objects with that role
+ * in a central place.
+ *
+ * A stereotype is an annotation, annotated with {@literal @Stereotype}, that captures several other annotations.
+ *
+ * For example, the following stereotype defines a @PseudoSingletonComponent annotation, that will act,
+ * when applied on a component, just like if @Component and @Instantiate where directly applied on the target component.
+ * <pre>
+ *
+ *     &#64;Component
+ *     &#64;Instantiate
+ *     &#64;Stereotype
+ *     &#64;Target(TYPE)
+ *     &#64;Retention(CLASS)
+ *     public &#64;interface PseudoSingletonComponent {}
+ *
+ * </pre>
+ *
+ * Usage:
+ * <pre>
+ *
+ *     &#64;PseudoSingletonComponent
+ *     public class HelloWorldComponent {
+ *       // ...
+ *     }
+ *
+ * </pre>
+ *
+ * Equivalent to:
+ * <pre>
+ *
+ *     &#64;Component
+ *     &#64;Instantiate
+ *     public class HelloWorldComponent {
+ *       // ...
+ *     }
+ *
+ * </pre>
+ *
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 @Target(ElementType.ANNOTATION_TYPE)

Added: felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.runtime.core.components;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Instantiate;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.runtime.core.handlers.Foo;
+import org.apache.felix.ipojo.runtime.core.handlers.IgnoredFoo;
+import org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService;
+
+/**
+ * User: guillaume
+ * Date: 24/07/13
+ * Time: 12:31
+ */
+@Component
+@Provides
+@Instantiate
+public class HandlerBindingTestComponent implements HandlerBindingTestService {
+
+    @Foo("Bonjour")
+    private String greeting;
+
+    @Foo("Welcome")
+    private String welcome;
+
+    @IgnoredFoo("Ignored")
+    private String ignored;
+
+    @Override
+    public String get(final String name) {
+        if ("greeting".equals(name)) {
+            return greeting;
+        }
+        if ("welcome".equals(name)) {
+            return welcome;
+        }
+        if ("ignored".equals(name)) {
+            return ignored;
+        }
+        throw new IllegalArgumentException(name + " is not valid");
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.runtime.core.handlers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.felix.ipojo.annotations.HandlerBinding;
+
+/**
+ * User: guillaume
+ * Date: 24/07/13
+ * Time: 12:10
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.CLASS)
+@HandlerBinding("com.acme:foo")
+public @interface Foo {
+    String value();
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.runtime.core.handlers;
+
+import java.util.Dictionary;
+
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.FieldInterceptor;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.annotations.Handler;
+import org.apache.felix.ipojo.metadata.Element;
+
+/**
+ * User: guillaume
+ * Date: 24/07/13
+ * Time: 12:08
+ */
+@Handler(namespace = "com.acme", name = "foo")
+public class FooHandler extends PrimitiveHandler {
+
+    @Override
+    public void configure(final Element metadata, final Dictionary configuration) throws ConfigurationException {
+        Element[] elements = metadata.getElements("foo", "com.acme");
+        for (Element foo : elements) {
+            String value = foo.getAttribute("value");
+            String field = foo.getAttribute("field");
+
+            this.getInstanceManager().register(getPojoMetadata().getField(field, "java.lang.String"),
+                                               new FixedValueFieldInterceptor(value));
+
+        }
+
+    }
+
+    @Override
+    public Object onGet(final Object pojo, final String fieldName, final Object value) {
+        return value;
+    }
+
+    @Override
+    public void stop() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void start() {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    private static class FixedValueFieldInterceptor implements FieldInterceptor {
+        private final String m_value;
+
+        public FixedValueFieldInterceptor(final String value) {
+            m_value = value;
+        }
+
+        @Override
+        public void onSet(final Object pojo, final String fieldName, final Object value) {
+            //To change body of implemented methods use File | Settings | File Templates.
+        }
+
+        @Override
+        public Object onGet(final Object pojo, final String fieldName, final Object value) {
+            return m_value;
+        }
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.runtime.core.handlers;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.felix.ipojo.annotations.HandlerBinding;
+import org.apache.felix.ipojo.annotations.Ignore;
+
+/**
+ * User: guillaume
+ * Date: 24/07/13
+ * Time: 12:10
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.CLASS)
+@Ignore
+public @interface IgnoredFoo {
+    String value();
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.runtime.core.services;
+
+/**
+ * User: guillaume
+ * Date: 24/07/13
+ * Time: 12:36
+ */
+public interface HandlerBindingTestService {
+    String get(String name);
+}

Added: felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.runtime.core;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.runtime.core.services.BazService;
+import org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService;
+import org.junit.Test;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.OptionUtils;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+
+import junit.framework.Assert;
+
+public class TestHandlerBindingAndIgnoreAnnotation extends BaseTest {
+
+    public static final String FACTORY_NAME = "org.apache.felix.ipojo.runtime.core.components.HandlerBindingTestComponent";
+
+    @Test
+    public void testFooHandlerBinding() {
+
+/*
+        HandlerFactory handlerFactory = ipojoHelper.getHandlerFactory("com.acme:foo");
+        assertNotNull(handlerFactory);
+        assertEquals(Factory.VALID, handlerFactory.getState());
+*/
+
+        // verify component's factory is here
+        // verify BazService has been published
+        // --> verify instance has been created
+
+        Factory factory = ipojoHelper.getFactory(FACTORY_NAME);
+        assertNotNull(factory);
+        assertEquals(Factory.VALID, factory.getState());
+
+
+        List<HandlerBindingTestService> services = osgiHelper.getServiceObjects(HandlerBindingTestService.class);
+        assertEquals(1, services.size());
+
+        HandlerBindingTestService baz = services.get(0);
+        assertEquals("Bonjour", baz.get("greeting"));
+        assertEquals("Welcome", baz.get("welcome"));
+        assertNull(baz.get("ignored"));
+        ipojoHelper.dispose();
+    }
+    @Override
+    protected List<String> getExtraExports() {
+        return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
+    }
+
+    @Override
+    protected Option[] getCustomOptions() {
+        return new Option[] {CoreOptions.vmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000")};
+        //return new Option[] {CoreOptions.vmOptions("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000")};
+    }
+}

Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java?rev=1507289&r1=1507288&r2=1507289&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java Fri Jul 26 12:33:28 2013
@@ -99,15 +99,6 @@ public class ClassMetadataCollector exte
      */
     public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
 
-    	/*
-    	 * Visible annotations are mostly destined to be read by reflection
-    	 * at runtime. We retain runtime visible annotations on component
-    	 * as they are and left them out in meta-data calculation.
-    	 */
-    	if (visible) {
-    		return null;
-    	}
-    	
         // Return the visitor to be executed (may be null)
         return registry.selection(workbench)
                 .type(this, node)

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model;
+
+import org.objectweb.asm.AnnotationVisitor;
+
+/**
+ * User: guillaume
+ * Date: 09/07/13
+ * Time: 14:42
+ */
+public interface AnnotationDiscovery {
+    AnnotationVisitor visitAnnotation(String desc);
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.objectweb.asm.Type;
+
+/**
+ * User: guillaume
+ * Date: 27/06/13
+ * Time: 13:37
+ */
+public class AnnotationType {
+    private final Type type;
+    private final List<Playback> m_playbacks = new ArrayList<Playback>();
+
+    public AnnotationType(final Type type) {
+        this.type = type;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public List<Playback> getPlaybacks() {
+        return m_playbacks;
+    }
+
+    public void traverse(AnnotationDiscovery visitor) {
+        for (Playback playback : m_playbacks) {
+            playback.accept(visitor);
+        }
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model;
+
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * User: guillaume
+ * Date: 08/07/13
+ * Time: 16:30
+ */
+public interface Playback {
+    void accept(FieldVisitor visitor);
+
+    void accept(ClassVisitor visitor);
+
+    void accept(MethodVisitor visitor);
+
+    void accept(MethodVisitor visitor, int index);
+
+    void accept(AnnotationDiscovery visitor);
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.discovery;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery;
+import org.apache.felix.ipojo.manipulator.util.ChainedAnnotationVisitor;
+import org.objectweb.asm.AnnotationVisitor;
+
+/**
+ * User: guillaume
+ * Date: 10/07/13
+ * Time: 10:48
+ */
+public class ChainedAnnotationDiscovery implements AnnotationDiscovery {
+
+    private List<AnnotationDiscovery> m_discoveries = new ArrayList<AnnotationDiscovery>();
+
+    public List<AnnotationDiscovery> getDiscoveries() {
+        return m_discoveries;
+    }
+
+    public AnnotationVisitor visitAnnotation(final String desc) {
+        ChainedAnnotationVisitor chain = null;
+        for (AnnotationDiscovery discovery : m_discoveries) {
+            AnnotationVisitor visitor = discovery.visitAnnotation(desc);
+            if (visitor != null) {
+                if (chain == null) {
+                    chain = new ChainedAnnotationVisitor();
+                }
+                chain.getVisitors().add(visitor);
+            }
+        }
+        return chain;
+    }
+
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.discovery;
+
+import org.apache.felix.ipojo.annotations.HandlerBinding;
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.EmptyVisitor;
+
+/**
+ * User: guillaume
+ * Date: 09/07/13
+ * Time: 14:52
+ */
+public class HandlerBindingDiscovery extends EmptyVisitor implements AnnotationDiscovery {
+
+    public static final String HANDLER_BINDING_DESCRIPTOR = Type.getType(HandlerBinding.class).getDescriptor();
+
+    private boolean m_handlerBinding = false;
+    private String m_value = null;
+    private String m_namespace = null;
+
+    public AnnotationVisitor visitAnnotation(final String desc) {
+        if (HANDLER_BINDING_DESCRIPTOR.equals(desc)) {
+            m_handlerBinding = true;
+            return this;
+        }
+        return null;
+    }
+
+    @Override
+    public void visit(final String name, final Object value) {
+        if ("value".equals(name)) {
+            m_value = (String) value;
+        }
+        if ("namespace".equals(name)) {
+            m_namespace = (String) value;
+        }
+    }
+
+    public boolean isHandlerBinding() {
+        return m_handlerBinding;
+    }
+
+    public String getValue() {
+        return m_value;
+    }
+
+    public String getNamespace() {
+        return m_namespace;
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.discovery;
+
+import org.apache.felix.ipojo.annotations.Ignore;
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Type;
+
+/**
+ * User: guillaume
+ * Date: 09/07/13
+ * Time: 14:52
+ */
+public class IgnoredDiscovery implements AnnotationDiscovery {
+
+    public static final String IGNORE_DESCRIPTOR = Type.getType(Ignore.class).getDescriptor();
+
+    private boolean m_ignore = false;
+
+    public AnnotationVisitor visitAnnotation(final String desc) {
+        if (IGNORE_DESCRIPTOR.equals(desc)) {
+            m_ignore = true;
+        }
+        return null;
+    }
+
+    public boolean isIgnore() {
+        return m_ignore;
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.discovery;
+
+import org.apache.felix.ipojo.annotations.Stereotype;
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Type;
+
+/**
+ * User: guillaume
+ * Date: 09/07/13
+ * Time: 14:52
+ */
+public class StereotypeDiscovery implements AnnotationDiscovery {
+
+    public static final String STEREOTYPE_DESCRIPTOR = Type.getType(Stereotype.class).getDescriptor();
+
+    private boolean m_stereotype = false;
+
+    public AnnotationVisitor visitAnnotation(final String desc) {
+        if (STEREOTYPE_DESCRIPTOR.equals(desc)) {
+            m_stereotype = true;
+        }
+        return null;
+    }
+
+    public boolean isStereotype() {
+        return m_stereotype;
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationLiteral.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationLiteral.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationLiteral.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationLiteral.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal;
+
+import static java.lang.String.format;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+/**
+ * User: guillaume
+ * Date: 28/06/13
+ * Time: 11:39
+ */
+public abstract class AnnotationLiteral<T extends Annotation> implements Annotation {
+
+    private Class<? extends Annotation> annotationType;
+
+    public Class<? extends Annotation> annotationType() {
+        if (annotationType == null) {
+            annotationType = findAnnotationType(getClass());
+            if (annotationType == null) {
+                throw new IllegalStateException(
+                        format("Annotation %s does not specify its annotation type (T) in AnnotationLiteral<T>",
+                               getClass().getName())
+                );
+            }
+        }
+        return annotationType;
+    }
+
+    public org.objectweb.asm.Type getType() {
+        return org.objectweb.asm.Type.getType(annotationType());
+    }
+
+    private static Class<Annotation> findAnnotationType(final Class<? extends AnnotationLiteral> type) {
+        Class<?> implementer = findImplementer(type);
+        return findTypeParameter(implementer);
+    }
+
+    private static Class<Annotation> findTypeParameter(final Class<?> clazz) {
+        // Get the T of AnnotationLiteral<T>
+        Type type = clazz.getGenericSuperclass();
+        if (type instanceof ParameterizedType) {
+            ParameterizedType pType = (ParameterizedType) type;
+            return (Class<Annotation>) pType.getActualTypeArguments()[0];
+        }
+        return null;
+    }
+
+    private static Class<? extends AnnotationLiteral> findImplementer(final Class<? extends AnnotationLiteral> type) {
+        Class<? extends AnnotationLiteral> superClass = type.getSuperclass().asSubclass(AnnotationLiteral.class);
+        if (AnnotationLiteral.class.equals(superClass)) {
+            return type;
+        } else {
+            return findImplementer(superClass);
+        }
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,264 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal;
+
+import static java.lang.String.format;
+import static org.objectweb.asm.Type.getType;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery;
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.Playback;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Type;
+
+/**
+ * User: guillaume
+ * Date: 08/07/13
+ * Time: 17:15
+ */
+public class AnnotationPlayback implements Playback {
+
+    public static final List<? extends Class<? extends Serializable>> BOXED_TYPES = Arrays.asList(Byte.class, Long.class, Character.class, Boolean.class, Double.class, Float.class, Integer.class, Short.class);
+    private final Annotation m_annotation;
+    private final Type m_annotationType;
+
+    public AnnotationPlayback(final Annotation annotation) {
+        m_annotation = annotation;
+        m_annotationType = Type.getType(annotation.annotationType());
+    }
+
+    private Map<String, Object> getValues() {
+        Map<String, Object> values = new HashMap<String, Object>();
+        for (Method method : m_annotation.annotationType().getDeclaredMethods()) {
+            try {
+                values.put(method.getName(), method.invoke(m_annotation));
+            } catch (Throwable t) {
+                throw new IllegalStateException(
+                        format("Cannot get value of the %s.%s attribute",
+                               m_annotation.annotationType().getSimpleName(),
+                               method.getName()),
+                        t
+                );
+            }
+        }
+        return values;
+    }
+    public void accept(final FieldVisitor visitor) {
+        AnnotationVisitor av = visitor.visitAnnotation(m_annotationType.getDescriptor(),
+                                                       true);
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    public void accept(final ClassVisitor visitor) {
+        AnnotationVisitor av = visitor.visitAnnotation(m_annotationType.getDescriptor(),
+                                                       true);
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    public void accept(final MethodVisitor visitor) {
+        AnnotationVisitor av = visitor.visitAnnotation(m_annotationType.getDescriptor(),
+                                                       true);
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    public void accept(final MethodVisitor visitor, final int index) {
+        AnnotationVisitor av = visitor.visitParameterAnnotation(index,
+                                                                m_annotationType.getDescriptor(),
+                                                                true);
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    public void accept(final AnnotationDiscovery visitor) {
+        AnnotationVisitor av = visitor.visitAnnotation(m_annotationType.getDescriptor());
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    private void accept(final AnnotationVisitor visitor) {
+        // As per the ASM doc, visit methods must be called in a given order:
+        // 1. visit()
+        // 2. visitEnum()
+        // 3. visitAnnotation()
+        // 4. visitArray()
+
+        // So values must be sorted
+        Map<String, Object> values = getValues();
+        accept(values, visitor);
+        acceptEnum(values, visitor);
+        acceptAnnotation(values, visitor);
+        acceptArray(values, visitor);
+
+        // Do not forget to visitEnd()
+        visitor.visitEnd();
+
+        // TODO This should disappear, only useful for testing
+        if (!values.isEmpty()) {
+            // We missed something during serialization
+            throw new IllegalStateException(
+                    format("Attributes of @%s could not be serialized: %s",
+                           m_annotation.annotationType().getSimpleName(),
+                           values.keySet())
+            );
+        }
+    }
+
+    private void acceptAnnotation(final Map<String, Object> values, final AnnotationVisitor visitor) {
+        Map<String, Object> copy = new HashMap<String, Object>(values);
+        for (Map.Entry<String, Object> entry : copy.entrySet()) {
+
+            Class<?> type = entry.getValue().getClass();
+            if (Annotation.class.isAssignableFrom(type)) {
+
+                Annotation annotation = (Annotation) entry.getValue();
+                AnnotationVisitor annotationVisitor = visitor.visitAnnotation(entry.getKey(),
+                                                                              getType(annotation.annotationType()).getDescriptor());
+                if (annotationVisitor != null) {
+                    AnnotationPlayback playback = new AnnotationPlayback(annotation);
+                    playback.accept(annotationVisitor);
+                }
+
+                values.remove(entry.getKey());
+            }
+        }
+    }
+
+    private void acceptEnum(final Map<String, Object> values, final AnnotationVisitor visitor) {
+
+        Map<String, Object> copy = new HashMap<String, Object>(values);
+        for (Map.Entry<String, Object> entry : copy.entrySet()) {
+
+            Class<?> type = entry.getValue().getClass();
+            if (type.isEnum()) {
+                Enum<?> enumValue = (Enum<?>) entry.getValue();
+                visitor.visitEnum(entry.getKey(),
+                                  getType(type).getDescriptor(),
+                                  enumValue.name());
+
+                values.remove(entry.getKey());
+            }
+        }
+    }
+
+    private void accept(final Map<String, Object> values, final AnnotationVisitor visitor) {
+
+        Map<String, Object> copy = new HashMap<String, Object>(values);
+        for (Map.Entry<String, Object> entry : copy.entrySet()) {
+
+            Class<?> type = entry.getValue().getClass();
+            if (isSimpleType(type)) {
+
+                // Accept Byte, Boolean, Character, Short, Integer, Long, Float, Double
+                // Accept String
+                // Accept Array of byte, boolean, char, short, int, long, float, double
+                visitor.visit(entry.getKey(), transform(entry.getValue()));
+
+                values.remove(entry.getKey());
+            }
+        }
+    }
+
+    private boolean isSimpleType(final Class<?> type) {
+        return isPrimitive(type) ||
+                String.class.equals(type) ||
+                Class.class.equals(type) ||
+                (type.isArray() && isPrimitive(type.getComponentType()));
+    }
+
+    private boolean isPrimitive(final Class<?> type) {
+        if (type.isPrimitive()) {
+            return true;
+        }
+
+        if (BOXED_TYPES.contains(type)) {
+            return true;
+        }
+
+        return false;
+    }
+
+    private void acceptArray(final Map<String, Object> values, final AnnotationVisitor visitor) {
+        Map<String, Object> copy = new HashMap<String, Object>(values);
+        for (Map.Entry<String, Object> entry : copy.entrySet()) {
+
+            Class<?> type = entry.getValue().getClass();
+            if (type.isArray()) {
+
+                // Simple arrays have been visited using AnnotationVisitor.visit(String, Object)
+
+                AnnotationVisitor arrayVisitor = visitor.visitArray(entry.getKey());
+                if (arrayVisitor != null) {
+                    Object[] array = (Object[]) entry.getValue();
+                    Class<?> componentType = array.getClass().getComponentType();
+                    Type asmType = Type.getType(componentType);
+
+                    if (componentType.isEnum()) {
+                        for (Object o : array) {
+                            Enum eValue = (Enum) o;
+                            arrayVisitor.visitEnum(null, asmType.getDescriptor(), eValue.name());
+                        }
+                    } else if (componentType.isAnnotation()) {
+                        for (Object o : array) {
+                            Annotation annotation = (Annotation) o;
+                            AnnotationVisitor annotationVisitor = arrayVisitor.visitAnnotation(null, asmType.getDescriptor());
+                            if (annotationVisitor != null) {
+                                AnnotationPlayback playback = new AnnotationPlayback(annotation);
+                                playback.accept(annotationVisitor);
+                            }
+                        }
+                    } else {
+                        for (Object o : array) {
+                            arrayVisitor.visit(null, transform(o));
+                        }
+                    }
+
+                    arrayVisitor.visitEnd();
+                }
+
+                values.remove(entry.getKey());
+            }
+        }
+    }
+
+    private Object transform(final Object value) {
+        if (value instanceof Class) {
+            return getType((Class) value);
+        }
+        return value;
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser;
+
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType;
+import org.objectweb.asm.ClassReader;
+
+/**
+ * User: guillaume
+ * Date: 01/07/13
+ * Time: 15:49
+ */
+public class AnnotationParser {
+    public AnnotationType read(byte[] resource) {
+        ClassReader reader = new ClassReader(resource);
+        AnnotationTypeVisitor visitor = new AnnotationTypeVisitor();
+        reader.accept(visitor, ClassReader.SKIP_CODE);
+        return visitor.getAnnotationType();
+    }
+
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser;
+
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType;
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.replay.AnnotationVisitorPlayback;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.EmptyVisitor;
+
+/**
+ * User: guillaume
+ * Date: 01/07/13
+ * Time: 15:59
+ */
+public class AnnotationTypeVisitor extends EmptyVisitor implements ClassVisitor {
+
+    private AnnotationType annotationType;
+
+    @Override
+    public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
+        annotationType = new AnnotationType(Type.getObjectType(name));
+    }
+
+    @Override
+    public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
+        // Build annotations of this annotation type
+        AnnotationVisitorPlayback playback = new AnnotationVisitorPlayback(desc, visible);
+        annotationType.getPlaybacks().add(playback);
+        return playback;
+    }
+
+    public AnnotationType getAnnotationType() {
+        return annotationType;
+    }
+
+    // Note: if we override visitMethod here, we could get the annotation's default values.
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.replay;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.objectweb.asm.AnnotationVisitor;
+
+/**
+* User: guillaume
+* Date: 30/05/13
+* Time: 17:22
+*/
+public class AnnotationRecorder implements AnnotationVisitor, Replay {
+
+    private List<Replay> m_replays = new ArrayList<Replay>();
+
+    public void visit(final String name, final Object value) {
+        m_replays.add(new Visit(name, value));
+    }
+
+    public void visitEnum(final String name, final String desc, final String value) {
+        m_replays.add(new VisitEnum(name, desc, value));
+    }
+
+    public AnnotationVisitor visitAnnotation(final String name, final String desc) {
+        AnnotationRecorder sub = new AnnotationRecorder();
+        m_replays.add(new VisitAnnotation(name, desc, sub));
+        return sub;
+    }
+
+    public AnnotationVisitor visitArray(final String name) {
+        AnnotationRecorder sub = new AnnotationRecorder();
+        m_replays.add(new VisitArray(name, sub));
+        return sub;
+    }
+
+    public void visitEnd() {
+        m_replays.add(new VisitEnd());
+    }
+
+    public void accept(final AnnotationVisitor visitor) {
+        for (Replay replay : m_replays) {
+            replay.accept(visitor);
+        }
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.replay;
+
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery;
+import org.apache.felix.ipojo.manipulator.metadata.annotation.model.Playback;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+
+/**
+ * User: guillaume
+ * Date: 08/07/13
+ * Time: 16:07
+ */
+public class AnnotationVisitorPlayback extends AnnotationRecorder implements Playback {
+    private final String m_desc;
+    private final boolean m_visible;
+
+    public AnnotationVisitorPlayback(final String desc, final boolean visible) {
+        m_desc = desc;
+        m_visible = visible;
+    }
+
+    public void accept(final FieldVisitor visitor) {
+        AnnotationVisitor av = visitor.visitAnnotation(m_desc, m_visible);
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    public void accept(final ClassVisitor visitor) {
+        AnnotationVisitor av = visitor.visitAnnotation(m_desc, m_visible);
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    public void accept(final MethodVisitor visitor) {
+        AnnotationVisitor av = visitor.visitAnnotation(m_desc, m_visible);
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    public void accept(final MethodVisitor visitor, int index) {
+        AnnotationVisitor av = visitor.visitParameterAnnotation(index, m_desc, m_visible);
+        if (av != null) {
+            accept(av);
+        }
+    }
+
+    public void accept(final AnnotationDiscovery visitor) {
+        AnnotationVisitor av = visitor.visitAnnotation(m_desc);
+        if (av != null) {
+            accept(av);
+        }
+    }
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.replay;
+
+import org.objectweb.asm.AnnotationVisitor;
+
+/**
+* User: guillaume
+* Date: 30/05/13
+* Time: 17:23
+*/
+public interface Replay {
+    void accept(AnnotationVisitor visitor);
+}

Added: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java?rev=1507289&view=auto
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java (added)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java Fri Jul 26 12:33:28 2013
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.replay;
+
+import org.objectweb.asm.AnnotationVisitor;
+
+/**
+* User: guillaume
+* Date: 30/05/13
+* Time: 17:23
+*/
+public class Visit implements Replay {
+    private final String m_name;
+    private final Object m_value;
+
+    public Visit(final String name, final Object value) {
+        m_name = name;
+        m_value = value;
+    }
+
+    public void accept(AnnotationVisitor visitor) {
+        visitor.visit(m_name, m_value);
+    }
+}