1 package org.apache.commons.digester3.annotations.handlers;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.commons.digester3.annotations.AnnotationHandler;
23 import org.apache.commons.digester3.annotations.rules.FactoryCreate;
24 import org.apache.commons.digester3.binder.FactoryCreateBuilder;
25 import org.apache.commons.digester3.binder.RulesBinder;
26
27
28
29
30
31
32 public final class FactoryCreateHandler
33 implements AnnotationHandler<FactoryCreate, Class<?>>
34 {
35
36
37
38
39 public void handle( FactoryCreate annotation, Class<?> element, RulesBinder rulesBinder )
40 {
41 FactoryCreateBuilder builder = rulesBinder.forPattern( annotation.pattern() )
42 .withNamespaceURI( annotation.namespaceURI() )
43 .factoryCreate()
44 .overriddenByAttribute( annotation.attributeName().length() > 0 ? annotation.attributeName() : null )
45 .ignoreCreateExceptions( annotation.ignoreCreateExceptions() );
46
47 if ( FactoryCreate.DefaultObjectCreationFactory.class != annotation.factoryClass() )
48 {
49 builder.ofType( annotation.factoryClass() );
50 }
51 }
52
53 }