KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb > plugins > cmp > jdbc > metadata > JDBCUserTypeMappingMetaData


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.ejb.plugins.cmp.jdbc.metadata;
23
24 import org.jboss.deployment.DeploymentException;
25 import org.jboss.metadata.MetaData;
26 import org.w3c.dom.Element JavaDoc;
27
28
29 /**
30  * Immutable class, instances of which represent user type mappings.
31  *
32  * @author <a HREF="mailto:alex@jboss.org">Alex Loubyansky</a>
33  */

34 public class JDBCUserTypeMappingMetaData
35 {
36    /** Fully qualified Java type name being mapped */
37    private final String JavaDoc javaType;
38    /** Fully qualified Java type name <code>javaType</code> is mapped to */
39    private final String JavaDoc mappedType;
40    /** Fully qualified Java type name of Mapper implementation */
41    private final String JavaDoc mapper;
42    /** Check a field of this type for dirty state after the getter: null, true or false (can be overriden on the field level) */
43    private final byte checkDirtyAfterGet;
44    /** CMP field state factory class that should be used for fields of this type unless overriden on the field level */
45    private final String JavaDoc stateFactory;
46
47    public JDBCUserTypeMappingMetaData(Element JavaDoc userMappingEl)
48       throws DeploymentException
49    {
50       javaType = MetaData.getUniqueChildContent(userMappingEl, "java-type");
51       mappedType = MetaData.getUniqueChildContent(userMappingEl, "mapped-type");
52       mapper = MetaData.getUniqueChildContent(userMappingEl, "mapper");
53       checkDirtyAfterGet = JDBCCMPFieldMetaData.readCheckDirtyAfterGet(userMappingEl);
54       stateFactory = MetaData.getOptionalChildContent(userMappingEl, "state-factory");
55    }
56
57    public String JavaDoc getJavaType()
58    {
59       return javaType;
60    }
61
62    public String JavaDoc getMappedType()
63    {
64       return mappedType;
65    }
66
67    public String JavaDoc getMapper()
68    {
69       return mapper;
70    }
71
72    public byte checkDirtyAfterGet()
73    {
74       return checkDirtyAfterGet;
75    }
76
77    public String JavaDoc getStateFactory()
78    {
79       return stateFactory;
80    }
81 }
82
Popular Tags