KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > ipanema > store > MapEntryMetaData


1 /*
2  * Created on 18.10.2004
3  */

4 package com.nightlabs.ipanema.store;
5
6 import java.io.Serializable JavaDoc;
7
8 import com.nightlabs.inheritance.FieldMetaData;
9 import com.nightlabs.inheritance.NotWritableException;
10
11 /**
12  * @author Marco Schulze - marco at nightlabs dot de
13  *
14  * @jdo.persistence-capable
15  * identity-type = "datastore"
16  * detachable = "true"
17  *
18  * @jdo.inheritance strategy = "new-table"
19  */

20 public class MapEntryMetaData
21     implements com.nightlabs.inheritance.MapEntryMetaData, Serializable JavaDoc
22 {
23     /**
24      * @jdo.field persistence-modifier="persistent"
25      * @jdo.column length="100"
26      */

27     private String JavaDoc fieldName;
28
29     /**
30      * @jdo.field persistence-modifier="persistent"
31      * @jdo.column length="100"
32      */

33     private String JavaDoc key;
34
35     /**
36      * Whether or not the field may be changed by children.
37      *
38      * @jdo.field persistence-modifier="persistent"
39      */

40     private byte writableByChildren = FieldMetaData.WRITABLEBYCHILDREN_YES;
41
42     /**
43      * writable is set to false if the mother has writableByChildren
44      * set to false.
45      *
46      * @jdo.field persistence-modifier="persistent"
47      */

48     private boolean writable = true;
49
50     /**
51      * If true, the value of the child is automatically updated if the
52      * mother's field is changed.
53      *
54      * @jdo.field persistence-modifier="persistent"
55      */

56     private boolean valueInherited = true;
57
58     /**
59      * @jdo.field persistence-modifier="persistent"
60      */

61     private MapFieldMetaData mapFieldMetaData;
62
63     protected MapEntryMetaData() { }
64     public MapEntryMetaData(MapFieldMetaData mapFieldMetaData, String JavaDoc key)
65     {
66         this.mapFieldMetaData = mapFieldMetaData;
67         this.fieldName = mapFieldMetaData.getFieldName();
68         this.key = key;
69     }
70
71     /**
72      * @return Returns the fieldName.
73      */

74     public String JavaDoc getFieldName()
75     {
76         return fieldName;
77     }
78
79     /**
80      * @return Returns the key.
81      */

82     public Object JavaDoc getKey()
83     {
84         return key;
85     }
86
87     /**
88      * @see com.nightlabs.inheritance.ProductInfoFieldMetaData#getWritableByChildren()
89      */

90     public byte getWritableByChildren()
91     {
92         return writableByChildren;
93     }
94
95     /**
96      * @see com.nightlabs.inheritance.ProductInfoFieldMetaData#setWritableByChildren(byte)
97      */

98     public void setWritableByChildren(byte writableByChildren)
99     {
100         this.writableByChildren = writableByChildren;
101     }
102
103     /**
104      * @see com.nightlabs.inheritance.ProductInfoFieldMetaData#isWritable()
105      */

106     public boolean isWritable()
107     {
108         return writable;
109     }
110
111     /**
112      * @see com.nightlabs.inheritance.ProductInfoFieldMetaData#assertWritable()
113      */

114     public void assertWritable() throws NotWritableException
115     {
116         if (!isWritable())
117             throw new NotWritableException("Field \""+getFieldName()+"\" is not writeable!");
118     }
119
120     /**
121      * @see com.nightlabs.inheritance.ProductInfoFieldMetaData#setWritable(boolean)
122      */

123     public void setWritable(boolean writable)
124     {
125         this.writable = writable;
126     }
127
128     /**
129      * @see com.nightlabs.inheritance.ProductInfoFieldMetaData#isValueInherited()
130      */

131     public boolean isValueInherited()
132     {
133         return valueInherited;
134     }
135
136     /**
137      * @see com.nightlabs.inheritance.ProductInfoFieldMetaData#setValueInherited(boolean)
138      */

139     public void setValueInherited(boolean valueInherited)
140     {
141         this.valueInherited = valueInherited;
142     }
143
144 }
145
Popular Tags