KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > weaving > ClassDetails


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 2005, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.weaving;
23
24 // J2SE imports
25
import java.util.*;
26
27 /**
28  * INTERNAL:
29  * Internal helper class that holds details of a persistent class.
30  * Used by {@link TopLinkWeaver}
31  *
32  */

33
34 public class ClassDetails {
35
36     // the name of this class (obviously!)
37
protected String JavaDoc className;
38     // superclass' name
39
protected String JavaDoc superClassName;
40     // superclass' ClassDetails - only populated if superclass
41
// is also persistent
42
protected ClassDetails superClassDetails;
43
44     protected boolean weaveValueHolders = false;
45     // map of this class' persistent attributes
46
protected Map attributesMap; // Map<String, AttributeDetails>
47
// where the key is the Attribute name
48
protected Map getterMethodToAttributeDetails;
49     
50     protected Map setterMethodToAttributeDetails;
51     
52     protected List lazyOneToOneMappings;
53     
54     protected boolean isMappedSuperClass = false;
55     
56     // default constructor
57
public ClassDetails() {
58     }
59     
60     public String JavaDoc getClassName() {
61         return className;
62     }
63     public void setClassName(String JavaDoc className) {
64         this.className = className;
65     }
66
67     public String JavaDoc getSuperClassName() {
68         return superClassName;
69     }
70     public void setSuperClassName(String JavaDoc superClassName) {
71         this.superClassName = superClassName;
72     }
73
74     public ClassDetails getSuperClassDetails() {
75         return superClassDetails;
76     }
77     public void setSuperClassDetails(ClassDetails superClassDetails) {
78         this.superClassDetails = superClassDetails;
79     }
80
81     public boolean weavedValueHolders() {
82         return weaveValueHolders;
83     }
84     public void weaveValueHolders(boolean weaveValueHolders) {
85         this.weaveValueHolders = weaveValueHolders;
86     }
87     
88     public Map getAttributesMap() {
89         return attributesMap;
90     }
91
92     public Map getGetterMethodToAttributeDetails(){
93         return getterMethodToAttributeDetails;
94     }
95     
96     public List getLazyOneToOneMappings(){
97         return lazyOneToOneMappings;
98     }
99     
100     public Map getSetterMethodToAttributeDetails(){
101         return setterMethodToAttributeDetails;
102     }
103     
104     public void setAttributesMap(Map weavedVHAttributes) {
105         this.attributesMap = weavedVHAttributes;
106     }
107     
108     public void setGetterMethodToAttributeDetails(Map map){
109         getterMethodToAttributeDetails = map;
110     }
111     
112     public void setLazyOneToOneMappings(List lazyOneToOneMappings){
113         this.lazyOneToOneMappings = lazyOneToOneMappings;
114     }
115     
116     public boolean isMappedSuperClass(){
117         return isMappedSuperClass;
118     }
119     
120     public void setIsMappedSuperClass(boolean isMappedSuperClass){
121         this.isMappedSuperClass = isMappedSuperClass;
122     }
123     
124     public void setSetterMethodToAttributeDetails(Map map){
125         setterMethodToAttributeDetails = map;
126     }
127     
128     public AttributeDetails getAttributeDetailsFromClassOrSuperClass(String JavaDoc attributeName){
129         AttributeDetails attribute = (AttributeDetails)attributesMap.get(attributeName);
130         if (attribute == null && superClassDetails != null){
131             return superClassDetails.getAttributeDetailsFromClassOrSuperClass(attributeName);
132         }
133        return attribute;
134     }
135     
136     public String JavaDoc toString() {
137         StringBuffer JavaDoc sb = new StringBuffer JavaDoc(className);
138         sb.append(" extends ");
139         sb.append(superClassName);
140         sb.append(" weaveVH: ");
141         if (weavedValueHolders()) {
142             sb.append("true");
143         }
144         else {
145             sb.append("false");
146         }
147         return sb.toString();
148     }
149 }
150
Popular Tags