%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor |
|
|
1 | /* |
|
2 | * Copyright 2000-2005 The Apache Software Foundation. |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | */ |
|
16 | package org.apache.portals.graffito.jcr.mapper.model; |
|
17 | ||
18 | ||
19 | import java.util.HashMap; |
|
20 | import java.util.Map; |
|
21 | ||
22 | import org.apache.portals.graffito.jcr.mapper.Mapper; |
|
23 | ||
24 | /** |
|
25 | * This class match to the complete xml mapping files. |
|
26 | * it contains mainly a collection of {@link ClassDescriptor} |
|
27 | * |
|
28 | * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a> |
|
29 | * @version $Id: Exp $ |
|
30 | */ |
|
31 | 0 | public class MappingDescriptor { |
32 | 0 | private HashMap classDescriptors = new HashMap(); |
33 | ||
34 | private Mapper mapper; |
|
35 | ||
36 | private String packageName; |
|
37 | ||
38 | public void setPackage(String pckgName) { |
|
39 | 0 | this.packageName = pckgName; |
40 | 0 | } |
41 | ||
42 | /** |
|
43 | * Add a new ClassDescriptor |
|
44 | * |
|
45 | * @param classDescriptor The class descriptor to add |
|
46 | */ |
|
47 | public void addClassDescriptor(ClassDescriptor classDescriptor) { |
|
48 | 0 | if (null != this.packageName && !"".equals(this.packageName)) { |
49 | 0 | classDescriptor.setClassName(this.packageName + "." + classDescriptor.getClassName()); |
50 | ||
51 | 0 | if (null != classDescriptor.getSuperClass() && !"".equals(classDescriptor.getSuperClass())) { |
52 | 0 | classDescriptor.setSuperClass(this.packageName + "." + classDescriptor.getSuperClass()); |
53 | } |
|
54 | } |
|
55 | ||
56 | 0 | classDescriptors.put(classDescriptor.getClassName(), classDescriptor); |
57 | 0 | classDescriptor.setMappingDescriptor(this); |
58 | 0 | } |
59 | ||
60 | /** |
|
61 | * Get the classdescriptor to used for the class |
|
62 | * @param className the class name |
|
63 | * @return the class descriptor found or null |
|
64 | */ |
|
65 | public ClassDescriptor getClassDescriptor(String className) { |
|
66 | 0 | return (ClassDescriptor) classDescriptors.get(className); |
67 | } |
|
68 | ||
69 | /** |
|
70 | * Get all class descriptors |
|
71 | * @return all class descriptors found |
|
72 | */ |
|
73 | public Map getClassDescriptors() { |
|
74 | 0 | return classDescriptors; |
75 | } |
|
76 | ||
77 | public Mapper getMapper() { |
|
78 | 0 | return this.mapper; |
79 | } |
|
80 | ||
81 | public void setMapper(Mapper parentMapper) { |
|
82 | 0 | this.mapper = parentMapper; |
83 | 0 | } |
84 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |