001/*
002 * HA-JDBC: High-Availability JDBC
003 * Copyright (c) 2004-2007 Paul Ferraro
004 * 
005 * This library is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU Lesser General Public License as published by the 
007 * Free Software Foundation; either version 2.1 of the License, or (at your 
008 * option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful, but WITHOUT
011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
013 * for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public License
016 * along with this library; if not, write to the Free Software Foundation, 
017 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018 * 
019 * Contact: ferraro@users.sourceforge.net
020 */
021package net.sf.hajdbc.cache;
022
023import net.sf.hajdbc.ColumnProperties;
024
025/**
026 * @author Paul Ferraro
027 *
028 */
029public class ColumnPropertiesImpl implements ColumnProperties
030{
031        private final String name;
032        private final int type;
033        private final String nativeType;
034        private final boolean autoIncrement;
035        
036        public ColumnPropertiesImpl(String name, int type, String nativeType, String defaultValue, String remarks, Boolean autoIncrement)
037        {
038                this.name = name;
039                this.type = type;
040                this.nativeType = nativeType;
041                this.autoIncrement = autoIncrement;
042        }
043        
044        /**
045         * @see net.sf.hajdbc.ColumnProperties#getName()
046         */
047        @Override
048        public String getName()
049        {
050                return this.name;
051        }
052        
053        /**
054         * @see net.sf.hajdbc.ColumnProperties#getType()
055         */
056        @Override
057        public int getType()
058        {
059                return this.type;
060        }
061        
062        /**
063         * @see net.sf.hajdbc.ColumnProperties#getNativeType()
064         */
065        @Override
066        public String getNativeType()
067        {
068                return this.nativeType;
069        }
070
071        /**
072         * @see net.sf.hajdbc.ColumnProperties#isAutoIncrement()
073         */
074        @Override
075        public boolean isAutoIncrement()
076        {
077                return this.autoIncrement;
078        }
079
080        /**
081         * @see java.lang.Object#equals(java.lang.Object)
082         */
083        @Override
084        public boolean equals(Object object)
085        {
086                if ((object == null) || !(object instanceof ColumnProperties)) return false;
087                
088                ColumnProperties column = (ColumnProperties) object;
089                
090                return this.name.equals(column.getName());
091        }
092
093        /**
094         * @see java.lang.Object#hashCode()
095         */
096        @Override
097        public int hashCode()
098        {
099                return this.name.hashCode();
100        }
101        
102}