Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AnnotationsConfigurationBuilder |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
3 | * The software in this package is published under the terms of the CPAL v1.0 | |
4 | * license, a copy of which has been included with this distribution in the | |
5 | * LICENSE.txt file. | |
6 | */ | |
7 | package org.mule.config; | |
8 | ||
9 | import org.mule.api.MuleContext; | |
10 | import org.mule.config.builders.AbstractConfigurationBuilder; | |
11 | import org.mule.config.endpoint.RegistryBackedAnnotationsParserFactory; | |
12 | ||
13 | /** | |
14 | * Enables Mule annotation processing so that annotated objects registered with the | |
15 | * Mule registry will automatically be configured. This helper also enables JSR-330 | |
16 | * injection annotations <code>javax.inject.Inject</code> and | |
17 | * <code>javax.inject.Named</code>. | |
18 | * <p/> | |
19 | * Internal Implementation note: We could have used a 'registry-bootstrap.properties' | |
20 | * file to load the objects necessary to enable annotations however, that method | |
21 | * would not allow the annotation processors to be easily overridden when using other | |
22 | * platforms such as Google App Engine. | |
23 | * | |
24 | * @since 3.0 | |
25 | */ | |
26 | 0 | public class AnnotationsConfigurationBuilder extends AbstractConfigurationBuilder |
27 | { | |
28 | @Override | |
29 | protected void doConfigure(MuleContext muleContext) throws Exception | |
30 | { | |
31 | // Make the annotation parsers available | |
32 | 0 | AnnotationsParserFactory factory = createAnnotationsParserFactory(); |
33 | 0 | muleContext.getRegistry().registerObject("_" + factory.getClass().getSimpleName(), factory); |
34 | 0 | } |
35 | ||
36 | protected AnnotationsParserFactory createAnnotationsParserFactory() | |
37 | { | |
38 | 0 | return new RegistryBackedAnnotationsParserFactory(); |
39 | } | |
40 | } |