You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2013/02/20 22:06:37 UTC
svn commit: r1448414 [5/14] - in
/db/torque/torque4/trunk/torque-runtime/src: main/java/org/apache/torque/
main/java/org/apache/torque/adapter/ main/java/org/apache/torque/criteria/
main/java/org/apache/torque/map/ main/java/org/apache/torque/oid/ main...
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/DateMapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/DateMapper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/DateMapper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/DateMapper.java Wed Feb 20 21:06:35 2013
@@ -1,89 +1,89 @@
-package org.apache.torque.om.mapper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Date;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Maps a database record to a java.util.Date.
- *
- * @version $Id$
- */
-public class DateMapper implements RecordMapper<Date>
-{
- /** Serial Version UID. */
- private static final long serialVersionUID = 1L;
-
- /** The internal offset for the mapper. */
- private final int internalOffset;
-
- /**
- * Constructs a DateMapper with an offset of 0.
- */
- public DateMapper()
- {
- this.internalOffset = 0;
- }
-
- /**
- * Constructs a DateMapper with the given offset.
- *
- * @param offset
- * the additional offset (0 based).
- */
- public DateMapper(int offset)
- {
- this.internalOffset = offset;
- }
-
- /**
- * Maps the current row in the result set to a java.util.Date.
- *
- * @param resultSet the result set to map, not null.
- * @param rowOffset a possible offset in the columns to be considered
- * (if previous columns contain other objects), or 0 for no offset.
- * @param criteria The criteria which created the result set,
- * or null if not known. This parameter is not used
- * by this record mapper.
- *
- * @return the date retrieved from the result set.
- */
- public Date processRow(
- ResultSet resultSet,
- int rowOffset,
- CriteriaInterface<?> criteria)
- throws TorqueException
- {
- try
- {
- java.util.Date value = resultSet.getTimestamp(
- rowOffset + internalOffset + 1);
- return value;
- } catch (SQLException e)
- {
- throw new TorqueException("Result could not be mapped to a Date", e);
- }
- }
-}
+package org.apache.torque.om.mapper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Date;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Maps a database record to a java.util.Date.
+ *
+ * @version $Id$
+ */
+public class DateMapper implements RecordMapper<Date>
+{
+ /** Serial Version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** The internal offset for the mapper. */
+ private final int internalOffset;
+
+ /**
+ * Constructs a DateMapper with an offset of 0.
+ */
+ public DateMapper()
+ {
+ this.internalOffset = 0;
+ }
+
+ /**
+ * Constructs a DateMapper with the given offset.
+ *
+ * @param offset
+ * the additional offset (0 based).
+ */
+ public DateMapper(int offset)
+ {
+ this.internalOffset = offset;
+ }
+
+ /**
+ * Maps the current row in the result set to a java.util.Date.
+ *
+ * @param resultSet the result set to map, not null.
+ * @param rowOffset a possible offset in the columns to be considered
+ * (if previous columns contain other objects), or 0 for no offset.
+ * @param criteria The criteria which created the result set,
+ * or null if not known. This parameter is not used
+ * by this record mapper.
+ *
+ * @return the date retrieved from the result set.
+ */
+ public Date processRow(
+ ResultSet resultSet,
+ int rowOffset,
+ CriteriaInterface<?> criteria)
+ throws TorqueException
+ {
+ try
+ {
+ java.util.Date value = resultSet.getTimestamp(
+ rowOffset + internalOffset + 1);
+ return value;
+ } catch (SQLException e)
+ {
+ throw new TorqueException("Result could not be mapped to a Date", e);
+ }
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/DateMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/IntegerMapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/IntegerMapper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/IntegerMapper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/IntegerMapper.java Wed Feb 20 21:06:35 2013
@@ -1,92 +1,92 @@
-package org.apache.torque.om.mapper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Maps a database record to a Integer.
- *
- * @version $Id$
- */
-public class IntegerMapper implements RecordMapper<Integer>
-{
- /** Serial Version UID. */
- private static final long serialVersionUID = 1L;
-
- /** The internal offset for the mapper. */
- private final int internalOffset;
-
- /**
- * Constructs a IntegerMapper with an offset of 0.
- */
- public IntegerMapper()
- {
- internalOffset = 0;
- }
-
- /**
- * Constructs a IntegerMapper with the given offset.
- *
- * @param offset the additional offset (0 based).
- */
- public IntegerMapper(int offset)
- {
- this.internalOffset = offset;
- }
-
- /**
- * Maps the current row in the result set to a Integer.
- *
- * @param resultSet the result set to map, not null.
- * @param rowOffset a possible offset in the columns to be considered
- * (if previous columns contain other objects), or 0 for no offset.
- * @param criteria The criteria which created the result set, or null
- * if not known. This parameter is not used by this record mapper.
- *
- * @return the Integer retrieved from the result set.
- */
- public Integer processRow(
- ResultSet resultSet,
- int rowOffset,
- CriteriaInterface<?> criteria)
- throws TorqueException
- {
- try
- {
- Integer result = Integer.valueOf(
- resultSet.getInt(rowOffset + internalOffset + 1));
- if (result == 0 && resultSet.wasNull())
- {
- return null;
- }
- return result;
- }
- catch (SQLException e)
- {
- throw new TorqueException("Result could not be mapped to a Integer",
- e);
- }
- }
-}
+package org.apache.torque.om.mapper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Maps a database record to a Integer.
+ *
+ * @version $Id$
+ */
+public class IntegerMapper implements RecordMapper<Integer>
+{
+ /** Serial Version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** The internal offset for the mapper. */
+ private final int internalOffset;
+
+ /**
+ * Constructs a IntegerMapper with an offset of 0.
+ */
+ public IntegerMapper()
+ {
+ internalOffset = 0;
+ }
+
+ /**
+ * Constructs a IntegerMapper with the given offset.
+ *
+ * @param offset the additional offset (0 based).
+ */
+ public IntegerMapper(int offset)
+ {
+ this.internalOffset = offset;
+ }
+
+ /**
+ * Maps the current row in the result set to a Integer.
+ *
+ * @param resultSet the result set to map, not null.
+ * @param rowOffset a possible offset in the columns to be considered
+ * (if previous columns contain other objects), or 0 for no offset.
+ * @param criteria The criteria which created the result set, or null
+ * if not known. This parameter is not used by this record mapper.
+ *
+ * @return the Integer retrieved from the result set.
+ */
+ public Integer processRow(
+ ResultSet resultSet,
+ int rowOffset,
+ CriteriaInterface<?> criteria)
+ throws TorqueException
+ {
+ try
+ {
+ Integer result = Integer.valueOf(
+ resultSet.getInt(rowOffset + internalOffset + 1));
+ if (result == 0 && resultSet.wasNull())
+ {
+ return null;
+ }
+ return result;
+ }
+ catch (SQLException e)
+ {
+ throw new TorqueException("Result could not be mapped to a Integer",
+ e);
+ }
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/IntegerMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/LongMapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/LongMapper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/LongMapper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/LongMapper.java Wed Feb 20 21:06:35 2013
@@ -1,92 +1,92 @@
-package org.apache.torque.om.mapper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Maps a database record to a Long.
- *
- * @version $Id$
- */
-public class LongMapper implements RecordMapper<Long>
-{
- /** Serial Version UID. */
- private static final long serialVersionUID = 1L;
-
- /** The internal offset for the mapper. */
- private final int internalOffset;
-
- /**
- * Constructs a LongMapper with an offset of 0.
- */
- public LongMapper()
- {
- internalOffset = 0;
- }
-
- /**
- * Constructs a LongMapper with the given offset.
- *
- * @param offset the additional offset (0 based).
- */
- public LongMapper(int offset)
- {
- this.internalOffset = offset;
- }
-
- /**
- * Maps the current row in the result set to a Long.
- *
- * @param resultSet the result set to map, not null.
- * @param rowOffset a possible offset in the columns to be considered
- * (if previous columns contain other objects), or 0 for no offset.
- * @param criteria The criteria which created the result set, or null
- * if not known. This parameter is not used by this record mapper.
- *
- * @return the Long retrieved from the result set.
- */
- public Long processRow(
- ResultSet resultSet,
- int rowOffset,
- CriteriaInterface<?> criteria)
- throws TorqueException
- {
- try
- {
- Long result = Long.valueOf(
- resultSet.getLong(rowOffset + internalOffset + 1));
- if (result == 0 && resultSet.wasNull())
- {
- return null;
- }
- return result;
- }
- catch (SQLException e)
- {
- throw new TorqueException("Result could not be mapped to a Long",
- e);
- }
- }
-}
+package org.apache.torque.om.mapper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Maps a database record to a Long.
+ *
+ * @version $Id$
+ */
+public class LongMapper implements RecordMapper<Long>
+{
+ /** Serial Version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** The internal offset for the mapper. */
+ private final int internalOffset;
+
+ /**
+ * Constructs a LongMapper with an offset of 0.
+ */
+ public LongMapper()
+ {
+ internalOffset = 0;
+ }
+
+ /**
+ * Constructs a LongMapper with the given offset.
+ *
+ * @param offset the additional offset (0 based).
+ */
+ public LongMapper(int offset)
+ {
+ this.internalOffset = offset;
+ }
+
+ /**
+ * Maps the current row in the result set to a Long.
+ *
+ * @param resultSet the result set to map, not null.
+ * @param rowOffset a possible offset in the columns to be considered
+ * (if previous columns contain other objects), or 0 for no offset.
+ * @param criteria The criteria which created the result set, or null
+ * if not known. This parameter is not used by this record mapper.
+ *
+ * @return the Long retrieved from the result set.
+ */
+ public Long processRow(
+ ResultSet resultSet,
+ int rowOffset,
+ CriteriaInterface<?> criteria)
+ throws TorqueException
+ {
+ try
+ {
+ Long result = Long.valueOf(
+ resultSet.getLong(rowOffset + internalOffset + 1));
+ if (result == 0 && resultSet.wasNull())
+ {
+ return null;
+ }
+ return result;
+ }
+ catch (SQLException e)
+ {
+ throw new TorqueException("Result could not be mapped to a Long",
+ e);
+ }
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/LongMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/ObjectListMapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/ObjectListMapper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/ObjectListMapper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/ObjectListMapper.java Wed Feb 20 21:06:35 2013
@@ -1,302 +1,302 @@
-package org.apache.torque.om.mapper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Maps a record to a list of objects.
- * Either the database driver decides which object type is appropriate
- * for each column, or a list of classes can be defined.
- *
- * @version $Id$
- */
-public class ObjectListMapper implements RecordMapper<List<Object>>
-{
- /** Serial Version UID. */
- private static final long serialVersionUID = 1L;
-
- /** Zero value for byte. */
- private static final byte ZERO_BYTE = 0;
-
- /** Zero value for short. */
- private static final short ZERO_SHORT = 0;
-
- /**
- * Contains the classes to which the columns are mapped.
- * The size of the list determines how many columns are read.
- */
- private List<Class<?>> convertClasses = null;
-
- /**
- * Constructor. Determines the number of columns to map from the
- * result set's metadata (this may issue additional database queries).
- * The classes the result columns are mapped to are determined by the
- * database driver.
- */
- public ObjectListMapper()
- {
- // empty
- }
-
- /**
- * Constructor which sets the number of columns to map.
- * The classes the result columns are mapped to are determined by the
- * database driver.
- *
- * @param numberOfColumnsToMap how many columns should be mapped,
- * or -1 to determine the number of columns to map from the
- * result set's metadata (this may issue
- * additional database queries).
- */
- public ObjectListMapper(int numberOfColumnsToMap)
- {
- this.convertClasses = new ArrayList<Class<?>>(numberOfColumnsToMap);
- if (numberOfColumnsToMap != -1)
- {
- for (int i = 0; i < numberOfColumnsToMap; ++i)
- {
- convertClasses.add(Object.class);
- }
- }
- }
-
- /**
- * Constructor which determines the number of columns to map
- * and the classes the result columns are mapped to.
- *
- * @param convertClasses the classes to which the columns should be mapped.
- * The first column is mapped to the first class in the list and
- * so on. May be null, in which case the number of columns to map
- * and the mapped to classes are determined by the database driver.
- * Known classes are: java.lang.reflect.Array, java.math.BigDecimal,
- * java.io.InputStream, java.sql. Blob, Boolean, Byte, byte[],
- * java.io.Reader, java.sql.Clob, java.sql.Date, Double, Float,
- * Integer, Long, Object (i.e. let the database driver decide
- * which class is returned), java.sql.Ref, Short, String,
- * java.sql.Time, java.sql.Timestamp and java.net.URL.
- */
- public ObjectListMapper(List<Class<?>> convertClasses)
- {
- if (convertClasses != null)
- {
- this.convertClasses = new ArrayList<Class<?>>(convertClasses);
- }
- }
-
- /**
- * Maps the current row in the result set by reading all columns from
- * offset on to the end of the row and store an object for each column
- * in the result.
- *
- * @param resultSet the result set to map, not null.
- * @param offset the offset of this mapper within the result set.
- * @param criteria The criteria which created the result set, or null
- * if not known. This parameter is not used by this record mapper.
- *
- * @return a list of mapped objects in the same order as the mappers
- * were ordered, not null.
- *
- * @throws TorqueException if retrieving column values from the result set
- * fails or if the number of available columns cannot be determined
- * from the result set.
- */
- public List<Object> processRow(
- ResultSet resultSet,
- int offset,
- CriteriaInterface<?> criteria)
- throws TorqueException
- {
- try
- {
- int currentNumberOfColumnsToMap;
- if (convertClasses != null)
- {
- currentNumberOfColumnsToMap = convertClasses.size();
- }
- else
- {
- int resultSetLength = resultSet.getMetaData().getColumnCount();
- currentNumberOfColumnsToMap = resultSetLength - offset;
- }
-
- List<Object> result
- = new ArrayList<Object>(currentNumberOfColumnsToMap);
- for (int i = 0; i < currentNumberOfColumnsToMap; ++i)
- {
- Class<?> mapClass;
- if (convertClasses != null)
- {
- mapClass = convertClasses.get(i);
- }
- else
- {
- mapClass = Object.class;
- }
- Object columnValue;
- int columnIndex = i + offset + 1;
- if (mapClass.equals(Array.class))
- {
- columnValue = resultSet.getArray(columnIndex);
- }
- else if (mapClass.equals(BigDecimal.class))
- {
- columnValue = resultSet.getBigDecimal(columnIndex);
- }
- else if (mapClass.equals(InputStream.class))
- {
- columnValue = resultSet.getBinaryStream(columnIndex);
- }
- else if (mapClass.equals(Blob.class))
- {
- columnValue = resultSet.getBlob(columnIndex);
- }
- else if (mapClass.equals(Boolean.class))
- {
- columnValue = resultSet.getBoolean(columnIndex);
- }
- else if (mapClass.equals(Byte.class))
- {
- columnValue = resultSet.getByte(columnIndex);
- if (Byte.valueOf(ZERO_BYTE).equals(columnValue)
- && resultSet.wasNull())
- {
- columnValue = null;
- }
- }
- else if (mapClass.equals(byte[].class))
- {
- columnValue = resultSet.getBytes(columnIndex);
- }
- else if (mapClass.equals(Reader.class))
- {
- columnValue = resultSet.getCharacterStream(columnIndex);
- }
- else if (mapClass.equals(Clob.class))
- {
- columnValue = resultSet.getClob(columnIndex);
- }
- else if (mapClass.equals(Date.class))
- {
- columnValue = resultSet.getDate(columnIndex);
- }
- else if (mapClass.equals(Double.class))
- {
- columnValue = resultSet.getDouble(columnIndex);
- if (Double.valueOf(0d).equals(columnValue)
- && resultSet.wasNull())
- {
- columnValue = null;
- }
- }
- else if (mapClass.equals(Float.class))
- {
- columnValue = resultSet.getFloat(columnIndex);
- if (Float.valueOf(0f).equals(columnValue)
- && resultSet.wasNull())
- {
- columnValue = null;
- }
- }
- else if (mapClass.equals(Integer.class))
- {
- columnValue = resultSet.getInt(columnIndex);
- if (Integer.valueOf(0).equals(columnValue)
- && resultSet.wasNull())
- {
- columnValue = null;
- }
- }
- else if (mapClass.equals(Long.class))
- {
- columnValue = resultSet.getLong(columnIndex);
- if (Long.valueOf(0L).equals(columnValue)
- && resultSet.wasNull())
- {
- columnValue = null;
- }
- }
- else if (mapClass.equals(Object.class))
- {
- columnValue = resultSet.getObject(columnIndex);
- }
- else if (mapClass.equals(Ref.class))
- {
- columnValue = resultSet.getRef(columnIndex);
- }
- else if (mapClass.equals(Short.class))
- {
- columnValue = resultSet.getShort(columnIndex);
- if (Short.valueOf(ZERO_SHORT).equals(columnValue)
- && resultSet.wasNull())
- {
- columnValue = null;
- }
- }
- else if (mapClass.equals(String.class))
- {
- columnValue = resultSet.getString(columnIndex);
- }
- else if (mapClass.equals(Time.class))
- {
- columnValue = resultSet.getTime(columnIndex);
- }
- else if (mapClass.equals(Timestamp.class))
- {
- columnValue = resultSet.getTimestamp(columnIndex);
- }
- else if (mapClass.equals(URL.class))
- {
- columnValue = resultSet.getURL(columnIndex);
- }
- else
- {
- throw new IllegalArgumentException(
- "Unknown convertClass " + mapClass.getName()
- + " at position " + i);
- }
- result.add(columnValue);
- }
- return result;
- }
- catch (SQLException e)
- {
- throw new TorqueException(e);
- }
- }
-}
-
+package org.apache.torque.om.mapper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Maps a record to a list of objects.
+ * Either the database driver decides which object type is appropriate
+ * for each column, or a list of classes can be defined.
+ *
+ * @version $Id$
+ */
+public class ObjectListMapper implements RecordMapper<List<Object>>
+{
+ /** Serial Version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** Zero value for byte. */
+ private static final byte ZERO_BYTE = 0;
+
+ /** Zero value for short. */
+ private static final short ZERO_SHORT = 0;
+
+ /**
+ * Contains the classes to which the columns are mapped.
+ * The size of the list determines how many columns are read.
+ */
+ private List<Class<?>> convertClasses = null;
+
+ /**
+ * Constructor. Determines the number of columns to map from the
+ * result set's metadata (this may issue additional database queries).
+ * The classes the result columns are mapped to are determined by the
+ * database driver.
+ */
+ public ObjectListMapper()
+ {
+ // empty
+ }
+
+ /**
+ * Constructor which sets the number of columns to map.
+ * The classes the result columns are mapped to are determined by the
+ * database driver.
+ *
+ * @param numberOfColumnsToMap how many columns should be mapped,
+ * or -1 to determine the number of columns to map from the
+ * result set's metadata (this may issue
+ * additional database queries).
+ */
+ public ObjectListMapper(int numberOfColumnsToMap)
+ {
+ this.convertClasses = new ArrayList<Class<?>>(numberOfColumnsToMap);
+ if (numberOfColumnsToMap != -1)
+ {
+ for (int i = 0; i < numberOfColumnsToMap; ++i)
+ {
+ convertClasses.add(Object.class);
+ }
+ }
+ }
+
+ /**
+ * Constructor which determines the number of columns to map
+ * and the classes the result columns are mapped to.
+ *
+ * @param convertClasses the classes to which the columns should be mapped.
+ * The first column is mapped to the first class in the list and
+ * so on. May be null, in which case the number of columns to map
+ * and the mapped to classes are determined by the database driver.
+ * Known classes are: java.lang.reflect.Array, java.math.BigDecimal,
+ * java.io.InputStream, java.sql. Blob, Boolean, Byte, byte[],
+ * java.io.Reader, java.sql.Clob, java.sql.Date, Double, Float,
+ * Integer, Long, Object (i.e. let the database driver decide
+ * which class is returned), java.sql.Ref, Short, String,
+ * java.sql.Time, java.sql.Timestamp and java.net.URL.
+ */
+ public ObjectListMapper(List<Class<?>> convertClasses)
+ {
+ if (convertClasses != null)
+ {
+ this.convertClasses = new ArrayList<Class<?>>(convertClasses);
+ }
+ }
+
+ /**
+ * Maps the current row in the result set by reading all columns from
+ * offset on to the end of the row and store an object for each column
+ * in the result.
+ *
+ * @param resultSet the result set to map, not null.
+ * @param offset the offset of this mapper within the result set.
+ * @param criteria The criteria which created the result set, or null
+ * if not known. This parameter is not used by this record mapper.
+ *
+ * @return a list of mapped objects in the same order as the mappers
+ * were ordered, not null.
+ *
+ * @throws TorqueException if retrieving column values from the result set
+ * fails or if the number of available columns cannot be determined
+ * from the result set.
+ */
+ public List<Object> processRow(
+ ResultSet resultSet,
+ int offset,
+ CriteriaInterface<?> criteria)
+ throws TorqueException
+ {
+ try
+ {
+ int currentNumberOfColumnsToMap;
+ if (convertClasses != null)
+ {
+ currentNumberOfColumnsToMap = convertClasses.size();
+ }
+ else
+ {
+ int resultSetLength = resultSet.getMetaData().getColumnCount();
+ currentNumberOfColumnsToMap = resultSetLength - offset;
+ }
+
+ List<Object> result
+ = new ArrayList<Object>(currentNumberOfColumnsToMap);
+ for (int i = 0; i < currentNumberOfColumnsToMap; ++i)
+ {
+ Class<?> mapClass;
+ if (convertClasses != null)
+ {
+ mapClass = convertClasses.get(i);
+ }
+ else
+ {
+ mapClass = Object.class;
+ }
+ Object columnValue;
+ int columnIndex = i + offset + 1;
+ if (mapClass.equals(Array.class))
+ {
+ columnValue = resultSet.getArray(columnIndex);
+ }
+ else if (mapClass.equals(BigDecimal.class))
+ {
+ columnValue = resultSet.getBigDecimal(columnIndex);
+ }
+ else if (mapClass.equals(InputStream.class))
+ {
+ columnValue = resultSet.getBinaryStream(columnIndex);
+ }
+ else if (mapClass.equals(Blob.class))
+ {
+ columnValue = resultSet.getBlob(columnIndex);
+ }
+ else if (mapClass.equals(Boolean.class))
+ {
+ columnValue = resultSet.getBoolean(columnIndex);
+ }
+ else if (mapClass.equals(Byte.class))
+ {
+ columnValue = resultSet.getByte(columnIndex);
+ if (Byte.valueOf(ZERO_BYTE).equals(columnValue)
+ && resultSet.wasNull())
+ {
+ columnValue = null;
+ }
+ }
+ else if (mapClass.equals(byte[].class))
+ {
+ columnValue = resultSet.getBytes(columnIndex);
+ }
+ else if (mapClass.equals(Reader.class))
+ {
+ columnValue = resultSet.getCharacterStream(columnIndex);
+ }
+ else if (mapClass.equals(Clob.class))
+ {
+ columnValue = resultSet.getClob(columnIndex);
+ }
+ else if (mapClass.equals(Date.class))
+ {
+ columnValue = resultSet.getDate(columnIndex);
+ }
+ else if (mapClass.equals(Double.class))
+ {
+ columnValue = resultSet.getDouble(columnIndex);
+ if (Double.valueOf(0d).equals(columnValue)
+ && resultSet.wasNull())
+ {
+ columnValue = null;
+ }
+ }
+ else if (mapClass.equals(Float.class))
+ {
+ columnValue = resultSet.getFloat(columnIndex);
+ if (Float.valueOf(0f).equals(columnValue)
+ && resultSet.wasNull())
+ {
+ columnValue = null;
+ }
+ }
+ else if (mapClass.equals(Integer.class))
+ {
+ columnValue = resultSet.getInt(columnIndex);
+ if (Integer.valueOf(0).equals(columnValue)
+ && resultSet.wasNull())
+ {
+ columnValue = null;
+ }
+ }
+ else if (mapClass.equals(Long.class))
+ {
+ columnValue = resultSet.getLong(columnIndex);
+ if (Long.valueOf(0L).equals(columnValue)
+ && resultSet.wasNull())
+ {
+ columnValue = null;
+ }
+ }
+ else if (mapClass.equals(Object.class))
+ {
+ columnValue = resultSet.getObject(columnIndex);
+ }
+ else if (mapClass.equals(Ref.class))
+ {
+ columnValue = resultSet.getRef(columnIndex);
+ }
+ else if (mapClass.equals(Short.class))
+ {
+ columnValue = resultSet.getShort(columnIndex);
+ if (Short.valueOf(ZERO_SHORT).equals(columnValue)
+ && resultSet.wasNull())
+ {
+ columnValue = null;
+ }
+ }
+ else if (mapClass.equals(String.class))
+ {
+ columnValue = resultSet.getString(columnIndex);
+ }
+ else if (mapClass.equals(Time.class))
+ {
+ columnValue = resultSet.getTime(columnIndex);
+ }
+ else if (mapClass.equals(Timestamp.class))
+ {
+ columnValue = resultSet.getTimestamp(columnIndex);
+ }
+ else if (mapClass.equals(URL.class))
+ {
+ columnValue = resultSet.getURL(columnIndex);
+ }
+ else
+ {
+ throw new IllegalArgumentException(
+ "Unknown convertClass " + mapClass.getName()
+ + " at position " + i);
+ }
+ result.add(columnValue);
+ }
+ return result;
+ }
+ catch (SQLException e)
+ {
+ throw new TorqueException(e);
+ }
+ }
+}
+
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/ObjectListMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/RecordMapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/RecordMapper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/RecordMapper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/RecordMapper.java Wed Feb 20 21:06:35 2013
@@ -1,64 +1,64 @@
-package org.apache.torque.om.mapper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-import java.sql.ResultSet;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Maps an object to a database record and back.
- * This means that the object can be read from a database resultSet
- * and that it can produce PreparedStatements which insert or update
- * the record in the the database.
- *
- * @param <T> the class to map from and to a database record
- *
- * @version $Id$
- */
-public interface RecordMapper<T> extends Serializable
-{
- /**
- * Constructs the object from the current row in the resultSet.
- * Implementing methods can be sure that the resultSet contains a row,
- * but they must only operate on the current row, i.e they must not call
- * resultSet.next().
- *
- * @param resultSet the resultSet to operate on, already pointing
- * to the correct row. Not null.
- * @param rowOffset a possible offset in the columns to be considered
- * (if previous columns contain other objects), or 0 for no offset.
- * @param criteria the Criteria which contains the query to process,
- * or null if not known or the query was not produced by a Criteria.
- * Can be used by the RecordMapper to determine the columns
- * contained in the result set.
- *
- * @return the mapped object, not null.
- *
- * @throws TorqueException when the mapping fails.
- */
- T processRow(
- ResultSet resultSet,
- int rowOffset,
- CriteriaInterface<?> criteria)
- throws TorqueException;
-}
+package org.apache.torque.om.mapper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+import java.sql.ResultSet;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Maps an object to a database record and back.
+ * This means that the object can be read from a database resultSet
+ * and that it can produce PreparedStatements which insert or update
+ * the record in the the database.
+ *
+ * @param <T> the class to map from and to a database record
+ *
+ * @version $Id$
+ */
+public interface RecordMapper<T> extends Serializable
+{
+ /**
+ * Constructs the object from the current row in the resultSet.
+ * Implementing methods can be sure that the resultSet contains a row,
+ * but they must only operate on the current row, i.e they must not call
+ * resultSet.next().
+ *
+ * @param resultSet the resultSet to operate on, already pointing
+ * to the correct row. Not null.
+ * @param rowOffset a possible offset in the columns to be considered
+ * (if previous columns contain other objects), or 0 for no offset.
+ * @param criteria the Criteria which contains the query to process,
+ * or null if not known or the query was not produced by a Criteria.
+ * Can be used by the RecordMapper to determine the columns
+ * contained in the result set.
+ *
+ * @return the mapped object, not null.
+ *
+ * @throws TorqueException when the mapping fails.
+ */
+ T processRow(
+ ResultSet resultSet,
+ int rowOffset,
+ CriteriaInterface<?> criteria)
+ throws TorqueException;
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/RecordMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/StringMapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/StringMapper.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/StringMapper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/StringMapper.java Wed Feb 20 21:06:35 2013
@@ -1,86 +1,86 @@
-package org.apache.torque.om.mapper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-
-/**
- * Maps a database record to a String.
- *
- * @version $Id$
- */
-public class StringMapper implements RecordMapper<String>
-{
- /** Serial Version UID. */
- private static final long serialVersionUID = 1L;
-
- /** The internal offset for the mapper. */
- private final int internalOffset;
-
- /**
- * Constructs a StringMapper with an offset of 0.
- */
- public StringMapper()
- {
- internalOffset = 0;
- }
-
- /**
- * Constructs a StringMapper with the given offset.
- *
- * @param offset the additional offset (0 based).
- */
- public StringMapper(int offset)
- {
- this.internalOffset = offset;
- }
-
- /**
- * Maps the current row in the result set to a String.
- *
- * @param resultSet the result set to map, not null.
- * @param rowOffset a possible offset in the columns to be considered
- * (if previous columns contain other objects), or 0 for no offset.
- * @param criteria The criteria which created the result set, or null
- * if not known. This parameter is not used by this record mapper.
- *
- * @return the String retrieved from the result set.
- */
- public String processRow(
- ResultSet resultSet,
- int rowOffset,
- CriteriaInterface<?> criteria)
- throws TorqueException
- {
- try
- {
- return resultSet.getString(rowOffset + internalOffset + 1);
- }
- catch (SQLException e)
- {
- throw new TorqueException("Result could not be mapped to a String",
- e);
- }
- }
-}
+package org.apache.torque.om.mapper;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
+
+/**
+ * Maps a database record to a String.
+ *
+ * @version $Id$
+ */
+public class StringMapper implements RecordMapper<String>
+{
+ /** Serial Version UID. */
+ private static final long serialVersionUID = 1L;
+
+ /** The internal offset for the mapper. */
+ private final int internalOffset;
+
+ /**
+ * Constructs a StringMapper with an offset of 0.
+ */
+ public StringMapper()
+ {
+ internalOffset = 0;
+ }
+
+ /**
+ * Constructs a StringMapper with the given offset.
+ *
+ * @param offset the additional offset (0 based).
+ */
+ public StringMapper(int offset)
+ {
+ this.internalOffset = offset;
+ }
+
+ /**
+ * Maps the current row in the result set to a String.
+ *
+ * @param resultSet the result set to map, not null.
+ * @param rowOffset a possible offset in the columns to be considered
+ * (if previous columns contain other objects), or 0 for no offset.
+ * @param criteria The criteria which created the result set, or null
+ * if not known. This parameter is not used by this record mapper.
+ *
+ * @return the String retrieved from the result set.
+ */
+ public String processRow(
+ ResultSet resultSet,
+ int rowOffset,
+ CriteriaInterface<?> criteria)
+ throws TorqueException
+ {
+ try
+ {
+ return resultSet.getString(rowOffset + internalOffset + 1);
+ }
+ catch (SQLException e)
+ {
+ throw new TorqueException("Result could not be mapped to a String",
+ e);
+ }
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/StringMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/package.html
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/package.html?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/package.html (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/package.html Wed Feb 20 21:06:35 2013
@@ -1,26 +1,26 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<html>
- <head>
- </head>
- <body>
- Contains the Mapper interface which defines how to map from
- a ResultSet to an object, and simple implementations of this interface.
- </body>
-</html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html>
+ <head>
+ </head>
+ <body>
+ Contains the Mapper interface which defines how to map from
+ a ResultSet to an object, and simple implementations of this interface.
+ </body>
+</html>
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/mapper/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/package.html
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/package.html?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/package.html (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/package.html Wed Feb 20 21:06:35 2013
@@ -1,31 +1,31 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<html>
- <head>
- </head>
- <body>
-Torque is an object-relational mapper for Java. In other words, Torque lets you access and
-manipulate data in a relational database using java objects. Unlike most other
-object-relational mappers, Torque does not use reflection to access user-provided classes,
-but it generates the necessary classes (including the Data Objects) from an XML schema
-describing the database layout (which can either be written by hand or generated from an
-existing database). The XML schema can also be used to generate and execute a SQL script
-which creates all the tables in the database.
- </body>
-</html>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html>
+ <head>
+ </head>
+ <body>
+Torque is an object-relational mapper for Java. In other words, Torque lets you access and
+manipulate data in a relational database using java objects. Unlike most other
+object-relational mappers, Torque does not use reflection to access user-provided classes,
+but it generates the necessary classes (including the Data Objects) from an XML schema
+describing the database layout (which can either be written by hand or generated from an
+existing database). The XML schema can also be used to generate and execute a SQL script
+which creates all the tables in the database.
+ </body>
+</html>
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/OrderBy.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/OrderBy.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/OrderBy.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/OrderBy.java Wed Feb 20 21:06:35 2013
@@ -1,160 +1,160 @@
-package org.apache.torque.sql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Serializable;
-
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.torque.Column;
-import org.apache.torque.criteria.SqlEnum;
-
-/**
- * An order by clause.
- * @version $Id$
- *
- */
-public class OrderBy implements Serializable
-{
- /** SerialVersionUID. */
- private static final long serialVersionUID = 1L;
-
- /** The column to order by. */
- private Column column;
-
- /** The order to order by (ascending or descending). */
- private SqlEnum order;
-
- /** Whether case should be ignored for String columns. */
- private boolean ignoreCase = true;
-
- /**
- * Constructor.
- *
- * @param column the column to order by, not null.
- * @param order the order, either SqlEnum.DESC or SqlEnum.ASC, not null.
- * @param ignoreCase whether case should be ignored for String columns
- *
- * @throws NullPointerException if null is passed.
- * @throws IllegalArgumentException if an unknown order is passed.
- */
- public OrderBy(Column column, SqlEnum order, boolean ignoreCase)
- {
- if (column == null)
- {
- throw new NullPointerException("column is null");
- }
- if (order == null)
- {
- throw new NullPointerException("order is null");
- }
- if (SqlEnum.DESC != order && SqlEnum.ASC != order)
- {
- throw new IllegalArgumentException("unknown order: " + order);
- }
- this.column = column;
- this.order = order;
- this.ignoreCase = ignoreCase;
- }
-
- /**
- * Returns the column to order by.
- *
- * @return the column to order by, not null.
- */
- public Column getColumn()
- {
- return column;
- }
-
- /**
- * Returns the order to order by (ASC or DESC).
- *
- * @return the order, either SqlEnum.DESC or SqlEnum.ASC, not null.
- */
- public SqlEnum getOrder()
- {
- return order;
- }
-
- /**
- * Returns whether case should be ignored for String columns.
- *
- * @return true if case should be ignored for String columns,
- * false otherwise.
- */
- public boolean isIgnoreCase()
- {
- return ignoreCase;
- }
-
- @Override
- public int hashCode()
- {
- return new HashCodeBuilder()
- .append(this.column.getSqlExpression())
- .append(this.column.getSchemaName())
- .append(this.column.getTableName())
- .append(this.column.getColumnName())
- .append(this.order)
- .append(this.ignoreCase)
- .toHashCode();
- }
-
- /**
- * Checks whether two orderBy are equal.
- * This is true if and only if the orders are equal and if the contained
- * columns have the same schema name, table name, column name
- * and sql expression.
- *
- * @param obj the object to compare to.
- *
- * @return true if this object is equal to obj, false otherwise.
- */
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- {
- return true;
- }
- if (obj == null)
- {
- return false;
- }
- if (getClass() != obj.getClass())
- {
- return false;
- }
- OrderBy other = (OrderBy) obj;
- return new EqualsBuilder()
- .append(this.column.getSqlExpression(),
- other.column.getSqlExpression())
- .append(this.column.getSchemaName(),
- other.column.getSchemaName())
- .append(this.column.getTableName(),
- other.column.getTableName())
- .append(this.column.getColumnName(),
- other.column.getColumnName())
- .append(this.order, other.order)
- .append(this.ignoreCase, other.ignoreCase)
- .isEquals();
- }
-}
+package org.apache.torque.sql;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.torque.Column;
+import org.apache.torque.criteria.SqlEnum;
+
+/**
+ * An order by clause.
+ * @version $Id$
+ *
+ */
+public class OrderBy implements Serializable
+{
+ /** SerialVersionUID. */
+ private static final long serialVersionUID = 1L;
+
+ /** The column to order by. */
+ private Column column;
+
+ /** The order to order by (ascending or descending). */
+ private SqlEnum order;
+
+ /** Whether case should be ignored for String columns. */
+ private boolean ignoreCase = true;
+
+ /**
+ * Constructor.
+ *
+ * @param column the column to order by, not null.
+ * @param order the order, either SqlEnum.DESC or SqlEnum.ASC, not null.
+ * @param ignoreCase whether case should be ignored for String columns
+ *
+ * @throws NullPointerException if null is passed.
+ * @throws IllegalArgumentException if an unknown order is passed.
+ */
+ public OrderBy(Column column, SqlEnum order, boolean ignoreCase)
+ {
+ if (column == null)
+ {
+ throw new NullPointerException("column is null");
+ }
+ if (order == null)
+ {
+ throw new NullPointerException("order is null");
+ }
+ if (SqlEnum.DESC != order && SqlEnum.ASC != order)
+ {
+ throw new IllegalArgumentException("unknown order: " + order);
+ }
+ this.column = column;
+ this.order = order;
+ this.ignoreCase = ignoreCase;
+ }
+
+ /**
+ * Returns the column to order by.
+ *
+ * @return the column to order by, not null.
+ */
+ public Column getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * Returns the order to order by (ASC or DESC).
+ *
+ * @return the order, either SqlEnum.DESC or SqlEnum.ASC, not null.
+ */
+ public SqlEnum getOrder()
+ {
+ return order;
+ }
+
+ /**
+ * Returns whether case should be ignored for String columns.
+ *
+ * @return true if case should be ignored for String columns,
+ * false otherwise.
+ */
+ public boolean isIgnoreCase()
+ {
+ return ignoreCase;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return new HashCodeBuilder()
+ .append(this.column.getSqlExpression())
+ .append(this.column.getSchemaName())
+ .append(this.column.getTableName())
+ .append(this.column.getColumnName())
+ .append(this.order)
+ .append(this.ignoreCase)
+ .toHashCode();
+ }
+
+ /**
+ * Checks whether two orderBy are equal.
+ * This is true if and only if the orders are equal and if the contained
+ * columns have the same schema name, table name, column name
+ * and sql expression.
+ *
+ * @param obj the object to compare to.
+ *
+ * @return true if this object is equal to obj, false otherwise.
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ OrderBy other = (OrderBy) obj;
+ return new EqualsBuilder()
+ .append(this.column.getSqlExpression(),
+ other.column.getSqlExpression())
+ .append(this.column.getSchemaName(),
+ other.column.getSchemaName())
+ .append(this.column.getTableName(),
+ other.column.getTableName())
+ .append(this.column.getColumnName(),
+ other.column.getColumnName())
+ .append(this.order, other.order)
+ .append(this.ignoreCase, other.ignoreCase)
+ .isEquals();
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/OrderBy.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/WhereClauseExpression.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/WhereClauseExpression.java?rev=1448414&r1=1448413&r2=1448414&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/WhereClauseExpression.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/WhereClauseExpression.java Wed Feb 20 21:06:35 2013
@@ -1,249 +1,249 @@
-package org.apache.torque.sql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.torque.criteria.SqlEnum;
-
-/**
- * The raw values for a part of the where clause of a SQL statement,
- * either of the form lValue operator rValue, e.g. author.author_id = 1,
- * or in form of a custom sql query with sql and replacement values.
- *
- * @version $Id$
- */
-public class WhereClauseExpression
-{
- /**
- * The value on the left hand side of the operator, not null.
- */
- private Object lValue;
-
- /**
- * The operator.
- */
- private SqlEnum operator;
-
- /**
- * The value on the right hand side of the operator.
- */
- private Object rValue;
-
- /** A verbatim SQL for this Criterion. */
- private String sql;
-
- /**
- * Replacements for the placeholders in the verbatim SQL.
- * Is only used if sql is not null.
- */
- private Object[] preparedStatementReplacements;
-
- /**
- * Constructor.
- *
- * @param lValue The value on the left hand side of the operator of the
- * expression. The value represents the name of a database column.
- * @param operator the operator. Either this parameter or sql must be
- * not null.
- * @param rValue The value on the right hand side of the operator of the
- * expression. The value represents the name of a database column.
- * @param sql a verbatim sql condition. Either this parameter or
- * operator must be not null.
- * @param preparedStatementReplacements Values for the placeholders
- * in the verbatim sql condition.
- */
- public WhereClauseExpression(
- Object lValue,
- SqlEnum operator,
- Object rValue,
- String sql,
- Object[] preparedStatementReplacements)
- {
- if (operator != null
- && (sql != null || preparedStatementReplacements != null))
- {
- throw new IllegalArgumentException("Either operator or "
- + "some of (sql, preparedStatementReplacements) "
- + "can be not null, not both");
- }
- if ((lValue == null || operator == null)
- && (sql == null))
- {
- throw new IllegalArgumentException("Either the values"
- + "(lValue, comparison) or "
- + "sql must be not null");
- }
- this.lValue = lValue;
- this.operator = operator;
- this.rValue = rValue;
- this.sql = sql;
- this.preparedStatementReplacements = preparedStatementReplacements;
- }
-
- /**
- * Returns the value on the left hand side of the operator of the
- * expression.
- *
- * @return the lValue.
- */
- public Object getLValue()
- {
- return lValue;
- }
-
- /**
- * Sets the value on the left hand side of the operator of the
- * expression. The value represents the name of a database column.
- *
- * @param lValue the value to set, not null or empty.
- *
- * @throws IllegalArgumentException if lValue is null or empty.
- */
- public void setLValue(String lValue)
- {
- this.lValue = lValue;
- }
-
- /**
- * Returns the value on the operator of the expression.
- *
- * @return the operator, or null if this Expression represents a verbatim
- * sql expression.
- */
- public SqlEnum getOperator()
- {
- return operator;
- }
-
- /**
- * Sets the value on the operator of the expression.
- *
- * @param operator the value to set, or null fo no operator.
- */
- public void setOperator(SqlEnum operator)
- {
- this.operator = operator;
- }
-
- /**
- * Returns the value on the right hand side of the operator of the
- * expression.
- *
- * @return the rValue, or null.
- */
- public Object getRValue()
- {
- return rValue;
- }
-
- /**
- * Sets the value on the right hand side of the operator of the
- * expression.
- *
- * @param rValue the value to set, or null for the empty String.
- */
- public void setRValue(Object rValue)
- {
- this.rValue = rValue;
- }
-
- /**
- * Returns the verbatim sql for this expression, if any.
- *
- * @return the verbatim sql for this expression, or null if not given.
- */
- public String getSql()
- {
- return sql;
- }
-
- /**
- * Returns the values for the placeholders in the verbatim sql condition.
- *
- * @return the placeholder values, or null.
- */
- public Object[] getPreparedStatementReplacements()
- {
- return preparedStatementReplacements;
- }
-
- /**
- * Returns whether this expression represents a verbatim sql condition.
- *
- * @return true if this Criterion represents a verbatim sql condition,
- * false if the sql is computed from lValue, comparison and rValue.
- */
- public boolean isVerbatimSqlCondition()
- {
- return (sql != null);
- }
-
- @Override
- public int hashCode()
- {
- HashCodeBuilder hashCodeBuilder = new HashCodeBuilder()
- .append(lValue)
- .append(operator)
- .append(rValue)
- .append(sql)
- .append(preparedStatementReplacements);
- return hashCodeBuilder.toHashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- {
- return true;
- }
- if (obj == null)
- {
- return false;
- }
- if (getClass() != obj.getClass())
- {
- return false;
- }
- WhereClauseExpression other = (WhereClauseExpression) obj;
- EqualsBuilder equalsBuilder = new EqualsBuilder()
- .append(lValue, other.lValue)
- .append(operator, other.operator)
- .append(rValue, other.rValue)
- .append(sql, other.sql)
- .append(
- preparedStatementReplacements,
- other.preparedStatementReplacements);
- return equalsBuilder.isEquals();
- }
-
- @Override
- public String toString()
- {
- StringBuilder result = new StringBuilder(lValue.toString());
- if (operator != null)
- {
- result.append(operator);
- }
- result.append(rValue);
- return result.toString();
- }
-}
+package org.apache.torque.sql;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.torque.criteria.SqlEnum;
+
+/**
+ * The raw values for a part of the where clause of a SQL statement,
+ * either of the form lValue operator rValue, e.g. author.author_id = 1,
+ * or in form of a custom sql query with sql and replacement values.
+ *
+ * @version $Id$
+ */
+public class WhereClauseExpression
+{
+ /**
+ * The value on the left hand side of the operator, not null.
+ */
+ private Object lValue;
+
+ /**
+ * The operator.
+ */
+ private SqlEnum operator;
+
+ /**
+ * The value on the right hand side of the operator.
+ */
+ private Object rValue;
+
+ /** A verbatim SQL for this Criterion. */
+ private String sql;
+
+ /**
+ * Replacements for the placeholders in the verbatim SQL.
+ * Is only used if sql is not null.
+ */
+ private Object[] preparedStatementReplacements;
+
+ /**
+ * Constructor.
+ *
+ * @param lValue The value on the left hand side of the operator of the
+ * expression. The value represents the name of a database column.
+ * @param operator the operator. Either this parameter or sql must be
+ * not null.
+ * @param rValue The value on the right hand side of the operator of the
+ * expression. The value represents the name of a database column.
+ * @param sql a verbatim sql condition. Either this parameter or
+ * operator must be not null.
+ * @param preparedStatementReplacements Values for the placeholders
+ * in the verbatim sql condition.
+ */
+ public WhereClauseExpression(
+ Object lValue,
+ SqlEnum operator,
+ Object rValue,
+ String sql,
+ Object[] preparedStatementReplacements)
+ {
+ if (operator != null
+ && (sql != null || preparedStatementReplacements != null))
+ {
+ throw new IllegalArgumentException("Either operator or "
+ + "some of (sql, preparedStatementReplacements) "
+ + "can be not null, not both");
+ }
+ if ((lValue == null || operator == null)
+ && (sql == null))
+ {
+ throw new IllegalArgumentException("Either the values"
+ + "(lValue, comparison) or "
+ + "sql must be not null");
+ }
+ this.lValue = lValue;
+ this.operator = operator;
+ this.rValue = rValue;
+ this.sql = sql;
+ this.preparedStatementReplacements = preparedStatementReplacements;
+ }
+
+ /**
+ * Returns the value on the left hand side of the operator of the
+ * expression.
+ *
+ * @return the lValue.
+ */
+ public Object getLValue()
+ {
+ return lValue;
+ }
+
+ /**
+ * Sets the value on the left hand side of the operator of the
+ * expression. The value represents the name of a database column.
+ *
+ * @param lValue the value to set, not null or empty.
+ *
+ * @throws IllegalArgumentException if lValue is null or empty.
+ */
+ public void setLValue(String lValue)
+ {
+ this.lValue = lValue;
+ }
+
+ /**
+ * Returns the value on the operator of the expression.
+ *
+ * @return the operator, or null if this Expression represents a verbatim
+ * sql expression.
+ */
+ public SqlEnum getOperator()
+ {
+ return operator;
+ }
+
+ /**
+ * Sets the value on the operator of the expression.
+ *
+ * @param operator the value to set, or null fo no operator.
+ */
+ public void setOperator(SqlEnum operator)
+ {
+ this.operator = operator;
+ }
+
+ /**
+ * Returns the value on the right hand side of the operator of the
+ * expression.
+ *
+ * @return the rValue, or null.
+ */
+ public Object getRValue()
+ {
+ return rValue;
+ }
+
+ /**
+ * Sets the value on the right hand side of the operator of the
+ * expression.
+ *
+ * @param rValue the value to set, or null for the empty String.
+ */
+ public void setRValue(Object rValue)
+ {
+ this.rValue = rValue;
+ }
+
+ /**
+ * Returns the verbatim sql for this expression, if any.
+ *
+ * @return the verbatim sql for this expression, or null if not given.
+ */
+ public String getSql()
+ {
+ return sql;
+ }
+
+ /**
+ * Returns the values for the placeholders in the verbatim sql condition.
+ *
+ * @return the placeholder values, or null.
+ */
+ public Object[] getPreparedStatementReplacements()
+ {
+ return preparedStatementReplacements;
+ }
+
+ /**
+ * Returns whether this expression represents a verbatim sql condition.
+ *
+ * @return true if this Criterion represents a verbatim sql condition,
+ * false if the sql is computed from lValue, comparison and rValue.
+ */
+ public boolean isVerbatimSqlCondition()
+ {
+ return (sql != null);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ HashCodeBuilder hashCodeBuilder = new HashCodeBuilder()
+ .append(lValue)
+ .append(operator)
+ .append(rValue)
+ .append(sql)
+ .append(preparedStatementReplacements);
+ return hashCodeBuilder.toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ WhereClauseExpression other = (WhereClauseExpression) obj;
+ EqualsBuilder equalsBuilder = new EqualsBuilder()
+ .append(lValue, other.lValue)
+ .append(operator, other.operator)
+ .append(rValue, other.rValue)
+ .append(sql, other.sql)
+ .append(
+ preparedStatementReplacements,
+ other.preparedStatementReplacements);
+ return equalsBuilder.isEquals();
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder result = new StringBuilder(lValue.toString());
+ if (operator != null)
+ {
+ result.append(operator);
+ }
+ result.append(rValue);
+ return result.toString();
+ }
+}
Propchange: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/sql/WhereClauseExpression.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org