KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > ejb > cmp3 > metadata > columns > MetadataDiscriminatorColumn


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) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns;
23
24 import javax.persistence.DiscriminatorType;
25 import javax.persistence.DiscriminatorColumn;
26
27 /**
28  * Object to hold onto discriminator column metadata.
29  *
30  * @author Guy Pelletier
31  * @since TopLink EJB 3.0 Reference Implementation
32  */

33 public class MetadataDiscriminatorColumn {
34     public static final int DEFAULT_LENGTH = 31;
35     public static final String JavaDoc DEFAULT_NAME = "DTYPE";
36     public static final String JavaDoc DEFAULT_COLUMN_DEFINITION = "";
37     public static final String JavaDoc DEFAULT_DISCRIMINATOR_TYPE = DiscriminatorType.STRING.name();
38     
39     protected DiscriminatorColumn m_discriminatorColumn;
40     
41     /**
42      * INTERNAL:
43      */

44     protected MetadataDiscriminatorColumn() {}
45     
46     /**
47      * INTERNAL:
48      */

49     public MetadataDiscriminatorColumn(DiscriminatorColumn discriminatorColumn) {
50         m_discriminatorColumn = discriminatorColumn;
51     }
52
53     /**
54      * INTERNAL:
55      */

56     public String JavaDoc getColumnDefinition() {
57         return (m_discriminatorColumn == null) ? DEFAULT_COLUMN_DEFINITION : m_discriminatorColumn.columnDefinition();
58     }
59     
60     /**
61      * INTERNAL:
62      */

63     public String JavaDoc getDiscriminatorType() {
64         return (m_discriminatorColumn == null) ? DEFAULT_DISCRIMINATOR_TYPE : m_discriminatorColumn.discriminatorType().name();
65     }
66     
67     /**
68      * INTERNAL:
69      */

70     public int getLength() {
71         return (m_discriminatorColumn == null) ? DEFAULT_LENGTH : m_discriminatorColumn.length();
72     }
73     
74     /**
75      * INTERNAL:
76      */

77     public String JavaDoc getName() {
78         return (m_discriminatorColumn == null) ? null : m_discriminatorColumn.name();
79     }
80 }
81
Popular Tags