Source Code Cross Referenced for FormatterConfiguration.java in  » Development » CSVObjects » net » sf » anupam » csv » formatters » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » CSVObjects » net.sf.anupam.csv.formatters 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * FormatConfiguration.java 
003:         * 
004:         * Copyright (C) 2005 Anupam Sengupta (anupamsg@users.sourceforge.net) 
005:         * 
006:         * This program is free software; you can redistribute it and/or 
007:         * modify it under the terms of the GNU General Public License 
008:         * as published by the Free Software Foundation; either version 2 
009:         * of the License, or (at your option) any later version. 
010:         * 
011:         * This program is distributed in the hope that it will be useful, 
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
014:         * GNU General Public License for more details. 
015:         * 
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software 
018:         * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
019:         *
020:         * Version: $Revision: 1.2 $
021:         */
022:        package net.sf.anupam.csv.formatters;
023:
024:        import org.apache.commons.lang.builder.EqualsBuilder;
025:        import org.apache.commons.lang.builder.HashCodeBuilder;
026:        import org.apache.commons.lang.builder.ToStringBuilder;
027:        import org.apache.commons.lang.builder.CompareToBuilder;
028:
029:        /**
030:         * FormatConfiguration.
031:         *
032:         * @author Anupam Sengupta
033:         * @version $Revision: 1.2 $
034:         * @since 1.5
035:         */
036:        public class FormatterConfiguration implements 
037:                Comparable<FormatterConfiguration> {
038:
039:            /**
040:             * Name of this formatter.
041:             */
042:            private String formatterName;
043:
044:            /**
045:             * Fully qualified class name of the formatter.
046:             */
047:            private String formatterClass;
048:
049:            /**
050:             * Whether special formatter construction is to be performed by the factory
051:             * methods.
052:             */
053:            private boolean constructionNeeded;
054:
055:            /**
056:             * Constructor for FormatConfiguration.
057:             */
058:            public FormatterConfiguration() {
059:                super ();
060:            }
061:
062:            /**
063:             * Compares this formatter configuration to another configuration for ordering purposes.
064:             * The comparision is based on the formatter name.
065:             *
066:             * @param other the other configuration to compare against
067:             * @return <code>0</code> if the two configurations are equal, <code>-1</code> if
068:             *         this configuration ranks "lower", <code>+1</code> if this configuration ranks "higher"
069:             * @see Comparable#compareTo(Object)
070:             */
071:            public int compareTo(final FormatterConfiguration other) {
072:
073:                return new CompareToBuilder().append(formatterName,
074:                        other.formatterName).append(formatterClass,
075:                        other.formatterClass).toComparison();
076:            }
077:
078:            /**
079:             * Returns a string representation of this formatter configuration for
080:             * <strong>debugging</strong> purposes only.
081:             *
082:             * @return a string representation of this formatter configuration
083:             * @see Object#toString()
084:             */
085:            @Override
086:            public String toString() {
087:                return new ToStringBuilder(this ).append("formatterName",
088:                        formatterName).append("formatterClass", formatterClass)
089:                        .append("constructionNeeded", constructionNeeded)
090:                        .toString();
091:            }
092:
093:            /**
094:             * Computes the hash code for this formatter configuration. The has code is based on the
095:             * formatter configuration's name.
096:             *
097:             * @return the hash code
098:             * @see Object#hashCode()
099:             */
100:            @Override
101:            public int hashCode() {
102:                return new HashCodeBuilder().append(formatterName).append(
103:                        formatterClass).toHashCode();
104:            }
105:
106:            /**
107:             * Compares this formatter configuration to another configuration for equality. Equality
108:             * test is based on the formatter configuration name.
109:             *
110:             * @param other the other configuration to compare to
111:             * @return <code>true</code> if the configurations are equal, <code>false</code> other wise
112:             * @see Object#equals(Object)
113:             */
114:            @Override
115:            public boolean equals(final Object other) {
116:                if (this  == other) {
117:                    return true;
118:                }
119:                if (!(other instanceof  FormatterConfiguration)) {
120:                    return false;
121:                }
122:
123:                final FormatterConfiguration castOther = (FormatterConfiguration) other;
124:                return new EqualsBuilder().append(formatterName,
125:                        castOther.formatterName).append(formatterClass,
126:                        castOther.formatterClass).isEquals();
127:            }
128:
129:            /**
130:             * Returns value of the formatName.
131:             *
132:             * @return Returns the formatName.
133:             */
134:            public String getFormatterName() {
135:                return this .formatterName;
136:            }
137:
138:            /**
139:             * Sets value of the formatName.
140:             *
141:             * @param formatName The formatName to set.
142:             */
143:            public void setFormatterName(final String formatName) {
144:                this .formatterName = formatName;
145:            }
146:
147:            /**
148:             * Returns value of the formatterClass.
149:             *
150:             * @return Returns the formatterClass.
151:             */
152:            public String getFormatterClass() {
153:                return this .formatterClass;
154:            }
155:
156:            /**
157:             * Sets value of the formatterClass.
158:             *
159:             * @param formatterClass The formatterClass to set.
160:             */
161:            public void setFormatterClass(final String formatterClass) {
162:                this .formatterClass = formatterClass;
163:            }
164:
165:            /**
166:             * Returns value of the constructionNeeded.
167:             *
168:             * @return Returns the constructionNeeded.
169:             */
170:            public boolean isConstructionNeeded() {
171:                return this .constructionNeeded;
172:            }
173:
174:            /**
175:             * Sets value of the constructionNeeded.
176:             *
177:             * @param constructionNeeded The constructionNeeded to set.
178:             */
179:            public void setConstructionNeeded(final boolean constructionNeeded) {
180:                this.constructionNeeded = constructionNeeded;
181:            }
182:
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.