1 /*
2 * Copyright (C) 2003-2012 David E. Berry
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 * A copy of the GNU Lesser General Public License may also be found at
19 * http://www.gnu.org/licenses/lgpl.txt
20 */
21 package org.synchronoss.cpo.meta;
22
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25
26 import java.lang.reflect.Method;
27
28 /**
29 * MethodMapEntry is a class defines the getters and setters for JDBC specific data classes
30 *
31 * @author david berry
32 */
33 public class MethodMapEntry<J,D> implements java.io.Serializable, Cloneable {
34
35 private static final Logger logger = LoggerFactory.getLogger(MethodMapEntry.class);
36 /**
37 * Version Id for this class.
38 */
39 private static final long serialVersionUID = 1L;
40 public static final int METHOD_TYPE_BASIC = 0;
41 private Class<J> javaClass_ = null;
42 private Class<D> datasourceMethodClass = null;
43 private Method rsGetter = null;
44 private Method bsSetter = null;
45 private int methodType = METHOD_TYPE_BASIC;
46
47 @SuppressWarnings("unused")
48 private MethodMapEntry() {
49 }
50
51 public MethodMapEntry(int methodType, Class<J> javaClass, Class<D> datasourceMethodClass, Method rsGetter, Method bsSetter) {
52 this.methodType = methodType;
53 this.javaClass_ = javaClass;
54 this.datasourceMethodClass = datasourceMethodClass;
55 this.bsSetter = bsSetter;
56 this.rsGetter = rsGetter;
57 }
58
59 // public void setBsSetter(String setterName) throws CpoException {
60 // try {
61 // bsSetter = B.class.getMethod(setterName, new Class[]{int.class, getJavaSqlMethodClass()});
62 // } catch (NoSuchMethodException nsme) {
63 // logger.error("Error loading Setter" + setterName, nsme);
64 // throw new CpoException(nsme);
65 // }
66 // }
67 //
68 // public void setRsGetter(String getterName) throws CpoException {
69 // try {
70 // rsGetter = R.class.getMethod(getterName, new Class[]{int.class});
71 // } catch (NoSuchMethodException nsme) {
72 // logger.error("Error loading Getter" + getterName, nsme);
73 // throw new CpoException(nsme);
74 // }
75 // }
76 //
77 public Class<J> getJavaClass() {
78 return javaClass_;
79 }
80
81 public Class<D> getJavaSqlMethodClass() {
82 return datasourceMethodClass;
83 }
84
85 public Method getRsGetter() {
86 return rsGetter;
87 }
88
89 public Method getBsSetter() {
90 return bsSetter;
91 }
92
93 public int getMethodType() {
94 return methodType;
95 }
96 }