View Javadoc
1   package org.synchronoss.cpo.jdbc.transform;
2   
3   /*-
4    * [[
5    * jdbc
6    * ==
7    * Copyright (C) 2003 - 2026 Exaxis LLC, Synchronoss Technologies Inc
8    * ==
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   *
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * ]]
23   */
24  
25  import org.synchronoss.cpo.core.CpoException;
26  import org.synchronoss.cpo.core.transform.CpoTransform;
27  import org.synchronoss.cpo.jdbc.JdbcCallableStatementFactory;
28  import org.synchronoss.cpo.jdbc.JdbcPreparedStatementFactory;
29  
30  /**
31   * Transforms are used when standard java types to data types do not work.
32   *
33   * @param <D> The datasource type
34   * @param <J> The java type
35   * @author Michael Bellomo
36   * @since 9/19/10
37   */
38  public interface JdbcCpoTransform<D, J> extends CpoTransform<D, J> {
39  
40    /**
41     * Transforms a java object to a data source object for the preparedstatement
42     *
43     * @param jpsf the prepared statement factory that will be receiving the object
44     * @param attributeObject the java object to be transformed
45     * @return The datasource object
46     * @throws CpoException an error transforming the java object to the data object
47     */
48    D transformOut(JdbcPreparedStatementFactory jpsf, J attributeObject) throws CpoException;
49  
50    /**
51     * Transforms a java object to a data source object for the preparedstatement
52     *
53     * @param jcsf the callable statement factory that will be receiving the object
54     * @param attributeObject the java object to be transformed
55     * @return The datasource object
56     * @throws CpoException an error transforming the java object to the data object
57     */
58    D transformOut(JdbcCallableStatementFactory jcsf, J attributeObject) throws CpoException;
59  
60    // TODO - add some transform in statements here.
61  }