Source Code Cross Referenced for CharacterProperty.java in  » Code-Analyzer » pmd-4.2rc1 » net » sourceforge » pmd » properties » 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 » Code Analyzer » pmd 4.2rc1 » net.sourceforge.pmd.properties 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.pmd.properties;
002:
003:        import net.sourceforge.pmd.util.StringUtil;
004:
005:        /**
006:         * Defines a property type that supports Character values.
007:         * 
008:         * @author Brian Remedios
009:         * @version $Revision$
010:         */
011:        public class CharacterProperty extends AbstractPMDProperty {
012:
013:            /**
014:             * Constructor for CharacterProperty.
015:             * @param theName String
016:             * @param theDescription String
017:             * @param theDefault char
018:             * @param theUIOrder float
019:             */
020:            public CharacterProperty(String theName, String theDescription,
021:                    char theDefault, float theUIOrder) {
022:                super (theName, theDescription, Character.valueOf(theDefault),
023:                        theUIOrder);
024:            }
025:
026:            /**
027:             * Constructor for CharacterProperty.
028:             * @param theName String
029:             * @param theDescription String
030:             * @param theDefaults char[]
031:             * @param theUIOrder float
032:             * @param delimiter char
033:             */
034:            public CharacterProperty(String theName, String theDescription,
035:                    char[] theDefaults, float theUIOrder, char delimiter) {
036:                this (theName, theDescription, asCharacters(theDefaults),
037:                        theUIOrder, delimiter);
038:            }
039:
040:            /**
041:             * Constructor for CharacterProperty.
042:             * @param theName String
043:             * @param theDescription String
044:             * @param theDefaults String
045:             * @param theUIOrder float
046:             * @param delimiter char
047:             */
048:            public CharacterProperty(String theName, String theDescription,
049:                    String theDefaults, float theUIOrder, char delimiter) {
050:                this (theName, theDescription, theDefaults.toCharArray(),
051:                        theUIOrder, delimiter);
052:            }
053:
054:            /**
055:             * Constructor for CharacterProperty.
056:             * @param theName String
057:             * @param theDescription String
058:             * @param theDefaults char[]
059:             * @param theUIOrder float
060:             * @param delimiter char
061:             */
062:            public CharacterProperty(String theName, String theDescription,
063:                    Character[] theDefaults, float theUIOrder, char delimiter) {
064:                super (theName, theDescription, theDefaults, theUIOrder);
065:
066:                multiValueDelimiter(delimiter);
067:                maxValueCount(Integer.MAX_VALUE);
068:            }
069:
070:            /**
071:             * Method asCharacters.
072:             * @param chars char[]
073:             * @return Character[]
074:             */
075:            private static final Character[] asCharacters(char[] chars) {
076:                Character[] characters = new Character[chars.length];
077:                for (int i = 0; i < chars.length; i++)
078:                    characters[i] = Character.valueOf(chars[i]);
079:                return characters;
080:            }
081:
082:            /**
083:             * Method type.
084:             * @return Class
085:             * @see net.sourceforge.pmd.PropertyDescriptor#type()
086:             */
087:            public Class<Character> type() {
088:                return Character.class;
089:            }
090:
091:            /**
092:             * Method valueFrom.
093:             * @param valueString String
094:             * @return Object
095:             * @throws IllegalArgumentException
096:             * @see net.sourceforge.pmd.PropertyDescriptor#valueFrom(String)
097:             */
098:            public Object valueFrom(String valueString)
099:                    throws IllegalArgumentException {
100:
101:                if (maxValueCount() == 1) {
102:                    if (valueString.length() > 1)
103:                        throw new IllegalArgumentException(valueString);
104:                    return Character.valueOf(valueString.charAt(0));
105:                }
106:
107:                String[] values = StringUtil.substringsOf(valueString,
108:                        multiValueDelimiter);
109:
110:                Character[] chars = new Character[values.length];
111:                for (int i = 0; i < values.length; i++)
112:                    chars[i] = Character.valueOf(values[i].charAt(0));
113:                return chars;
114:            }
115:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.