EMMA Coverage Report (generated Sat Nov 03 21:53:04 GMT 2007)
[all classes][sf.qof.customizer]

COVERAGE SUMMARY FOR SOURCE FILE [DefaultCustomizer.java]

nameclass, %method, %block, %line, %
DefaultCustomizer.java100% (1/1)100% (6/6)100% (31/31)100% (8/8)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DefaultCustomizer100% (1/1)100% (6/6)100% (31/31)100% (8/8)
DefaultCustomizer (): void 100% (1/1)100% (3/3)100% (1/1)
getClassName (Class): String 100% (1/1)100% (10/10)100% (1/1)
getConnectionFactoryCustomizer (Class): ConnectionFactoryCustomizer 100% (1/1)100% (12/12)100% (3/3)
getListType (): Type 100% (1/1)100% (2/2)100% (1/1)
getMapType (): Type 100% (1/1)100% (2/2)100% (1/1)
getSetType (): Type 100% (1/1)100% (2/2)100% (1/1)

1/*
2 * Copyright 2007 brunella ltd
3 *
4 * Licensed under the LGPL Version 3 (the "License");
5 * you may not use this file except in compliance with the License.
6 *
7 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
8 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
10 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
11 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
12 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
13 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
14 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
15 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
16 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
17 * THE POSSIBILITY OF SUCH DAMAGE.
18 */
19package sf.qof.customizer;
20 
21import static sf.qof.codegen.Constants.TYPE_ArrayList;
22import static sf.qof.codegen.Constants.TYPE_HashMap;
23import static sf.qof.codegen.Constants.TYPE_HashSet;
24 
25import org.objectweb.asm.Type;
26 
27import sf.qof.session.UseSessionContext;
28 
29/**
30 * Provides the default implementation to customize the generation process.
31 * 
32 * @see Customizer
33 */
34public class DefaultCustomizer implements Customizer {
35  /**
36   * Customizes the type of <code>List</code> implementations.
37   * 
38   * @return <code>ArrayList</code> type
39   * 
40   * @see java.util.List
41   */
42  public Type getListType() {
43    return TYPE_ArrayList;
44  }
45 
46  /**
47   * Customizes the type of <code>Map</code> implementations.
48   * 
49   * @return <code>HashMap</code> type
50   * 
51   * @see java.util.Map
52   */
53  public Type getMapType() {
54    return TYPE_HashMap;
55  }
56 
57  /**
58   * Customizes the type of <code>Set</code> implementations.
59   * 
60   * @return <code>HashSet</code> type
61   * 
62   * @see java.util.Set
63   */
64  public Type getSetType() {
65    return TYPE_HashSet;
66  }
67 
68  /**
69   * Customizes the class name of the generated query object. 
70   * 
71   * @param queryDefinitionClass query definition class or interface
72   * @return class name of the query definition class with "$Impl" appended
73   * @see Customizer#getClassName(Class)
74   */
75  public String getClassName(Class<?> queryDefinitionClass) {
76    return queryDefinitionClass.getName() + "$Impl";
77  }
78 
79  /**
80   * Customizes the implementation of getConnection() and setConnection()
81   * methods.
82   * 
83   * @param queryDefinitionClass query definition class or interface
84   * @return a ConnectionFactoryCustomizer
85   * @see Customizer#getConnectionFactoryCustomizer(Class)
86   * @see ConnectionFactoryCustomizer
87   */
88  public ConnectionFactoryCustomizer getConnectionFactoryCustomizer(Class<?> queryDefinitionClass) {
89        if (queryDefinitionClass.isAnnotationPresent(UseSessionContext.class)) {
90          return new SessionContextConnectionFactoryCustomizer();
91        } else {
92          return new DefaultConnectionFactoryCustomizer();
93        }
94  }
95 
96}

[all classes][sf.qof.customizer]
EMMA 2.0.5312 (C) Vladimir Roubtsov