Java Doc for ValidationResult.java in  » Swing-Library » jgoodies-validation » com » jgoodies » validation » 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 » Swing Library » jgoodies validation » com.jgoodies.validation 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jgoodies.validation.ValidationResult

ValidationResult
final public class ValidationResult implements Serializable(Code)
Describes a validation result as a list of ValidationMessages. You can add single validation messages, single text messages, lists of messages, and all messages from another ValidationResult.
author:
   Karsten Lentzsch
version:
   $Revision: 1.16 $
See Also:   ValidationMessage
See Also:   Validator


Field Summary
final public static  ValidationResultEMPTY
     A constant for an empty and unmodifiable validation result.

Constructor Summary
public  ValidationResult()
     Constructs an empty modifiable ValidationResult.

Method Summary
public  voidadd(ValidationMessage validationMessage)
     Adds a new ValidationMessage to the list of messages.
public  voidaddAll(List<ValidationMessage> messages)
     Adds all messages from the given list to this validation result.
public  voidaddAllFrom(ValidationResult validationResult)
     Adds all messages from the given ValidationResult to the list of messages that this validation result holds.
public  voidaddError(String text)
     Creates and adds an error message to the list of validation messages using the given text.
public  voidaddWarning(String text)
     Creates and adds a warning message to the list of validation messages using the given text.
public  booleancontains(ValidationMessage message)
     Checks and answers whether this result contains the specified message.
public  booleanequals(Object o)
     Compares the specified object with this validation result for equality. Returns true if and only if the specified object is also a validation result, both results have the same size, and all corresponding pairs of validation messages in the two validation results are equal.
public  List<ValidationMessage>getErrors()
     Returns an unmodifiable List of the validation messages that indicate errors.
public  List<ValidationMessage>getMessages()
     Returns an unmodifiable List of all validation messages.
public  StringgetMessagesText()
     Returns a string representation of the message list.
public  SeveritygetSeverity()
     Returns the highest severity of this result's messages, Severity.OK if there are no messages.
public  List<ValidationMessage>getWarnings()
     Returns an unmodifiable List of the validation messages that indicate warnings.
public  booleanhasErrors()
     Checks and answers whether this validation result contains a message of type ERROR.
public  booleanhasMessages()
     Checks and answers whether this validation result has messages or not.
public  booleanhasWarnings()
     Checks and answers whether this validation result contains a message of type WARNING.

Note that this method checks for warning messages only.

public  inthashCode()
     Returns the hash code value for this validation result.
public  booleanisEmpty()
     Checks and answers whether this validation result contains no messages.
public  booleanisModifiable()
     Returns if this validation result is modifiable or not.
public  Map<Object, ValidationResult>keyMap()
     Creates and returns an unmodifiable Map that maps the message keys of this validation result to unmodifiable sub results that share the key.

More formally: for each key key in the created map map, map.get(key) returns a ValidationResult result, such that for each ValidationMessage message in result we have: message.key().equals(key).

public  intsize()
     Returns the number of messages in this result.
public  ValidationResultsubResult(int fromIndex, int toIndex)
     Returns an unmodifiable view of the portion of this result between the specified fromIndex, inclusive, and toIndex, exclusive.
public  ValidationResultsubResult(Object messageKey)
     Returns an unmodifiable sub result of this result that consists of all messages that share the specified message key.
public  ValidationResultsubResult(Object[] messageKeys)
     Returns an unmodifiable sub result of this result that consists of all messages that share the specified message keys.
public  StringtoString()
     Returns a string representation intended for debugging purposes.
public static  ValidationResultunmodifiableResult(ValidationResult validationResult)
     Returns an unmodifiable view of the given ValidationResult. Useful to provide users with "read-only" access to internal results, or to indicate to other validation result processors that a result is not intended to be modified.

Field Detail
EMPTY
final public static ValidationResult EMPTY(Code)
A constant for an empty and unmodifiable validation result.




Constructor Detail
ValidationResult
public ValidationResult()(Code)
Constructs an empty modifiable ValidationResult.




Method Detail
add
public void add(ValidationMessage validationMessage)(Code)
Adds a new ValidationMessage to the list of messages.
Parameters:
  validationMessage - the message to add
throws:
  NullPointerException - if the message is null
throws:
  UnsupportedOperationException - if the result is unmodifiable
throws:
  IllegalArgumentException - if the severity is OK
See Also:   ValidationResult.addError(String)
See Also:   ValidationResult.addWarning(String)



addAll
public void addAll(List<ValidationMessage> messages)(Code)
Adds all messages from the given list to this validation result.
Parameters:
  messages - the messages to be added
throws:
  NullPointerException - if the messages list is null
throws:
  UnsupportedOperationException - if the result is unmodifiable
throws:
  IllegalArgumentException - if the messages list containsa message with severity OK
See Also:   ValidationResult.addAllFrom(ValidationResult)



addAllFrom
public void addAllFrom(ValidationResult validationResult)(Code)
Adds all messages from the given ValidationResult to the list of messages that this validation result holds.
Parameters:
  validationResult - the validation result to add messages from
throws:
  NullPointerException - if the validation result is null
throws:
  UnsupportedOperationException - if the result is unmodifiable
See Also:   ValidationResult.addAll(List)



addError
public void addError(String text)(Code)
Creates and adds an error message to the list of validation messages using the given text.
Parameters:
  text - the error text to add
throws:
  NullPointerException - if the message text null
throws:
  UnsupportedOperationException - if the result is unmodifiable
See Also:   ValidationResult.add(ValidationMessage)
See Also:   ValidationResult.addWarning(String)



addWarning
public void addWarning(String text)(Code)
Creates and adds a warning message to the list of validation messages using the given text.
Parameters:
  text - the warning text to add
throws:
  NullPointerException - if the message text null
throws:
  UnsupportedOperationException - if the result is unmodifiable
See Also:   ValidationResult.add(ValidationMessage)
See Also:   ValidationResult.addError(String)



contains
public boolean contains(ValidationMessage message)(Code)
Checks and answers whether this result contains the specified message. More formally, returns true if and only if this result contains at least one message m such that (message.equals(m)).
Parameters:
  message - message whose presence in this result is to be tested true if this result contains the specified message
throws:
  NullPointerException - if the specified message isnull



equals
public boolean equals(Object o)(Code)
Compares the specified object with this validation result for equality. Returns true if and only if the specified object is also a validation result, both results have the same size, and all corresponding pairs of validation messages in the two validation results are equal. (Two validation messages m1 and m2 are equal if (m1==null ? m2==null : m1.equals(m2)).) In other words, two validation results are defined to be equal if and only if they contain the same validation messages in the same order.

This implementation first checks if the specified object is this validation result. If so, it returns true; if not, it checks if the specified object is a validation result. If not, it returns false; if so, it checks and returns if the lists of messages in both results are equal.
Parameters:
  o - the object to be compared for equality with this validation result. true if the specified object is equalto this validation result.
See Also:   List.equals(java.lang.Object)
See Also:   Object.equals(java.lang.Object)




getErrors
public List<ValidationMessage> getErrors()(Code)
Returns an unmodifiable List of the validation messages that indicate errors. the List of error validation messages
See Also:   ValidationResult.getMessages()
See Also:   ValidationResult.getWarnings()



getMessages
public List<ValidationMessage> getMessages()(Code)
Returns an unmodifiable List of all validation messages. the List of all validation messages
See Also:   ValidationResult.getErrors()
See Also:   ValidationResult.getWarnings()



getMessagesText
public String getMessagesText()(Code)
Returns a string representation of the message list. a string representation of the message list



getSeverity
public Severity getSeverity()(Code)
Returns the highest severity of this result's messages, Severity.OK if there are no messages. the highest severity of this result's messages,Severity.OK if there are no messages
See Also:   ValidationResult.hasMessages()
See Also:   ValidationResult.hasErrors()
See Also:   ValidationResult.hasWarnings()



getWarnings
public List<ValidationMessage> getWarnings()(Code)
Returns an unmodifiable List of the validation messages that indicate warnings. the List of validation warnings
See Also:   ValidationResult.getMessages()
See Also:   ValidationResult.getErrors()



hasErrors
public boolean hasErrors()(Code)
Checks and answers whether this validation result contains a message of type ERROR. true if there are error messages, false if not
See Also:   ValidationResult.getSeverity()
See Also:   ValidationResult.hasMessages()
See Also:   ValidationResult.hasWarnings()



hasMessages
public boolean hasMessages()(Code)
Checks and answers whether this validation result has messages or not. true if there are messages, false if not
See Also:   ValidationResult.getSeverity()
See Also:   ValidationResult.hasErrors()
See Also:   ValidationResult.hasWarnings()



hasWarnings
public boolean hasWarnings()(Code)
Checks and answers whether this validation result contains a message of type WARNING.

Note that this method checks for warning messages only. It'll return false, if there are errors but no warnings. If you want to test whether this result contains warning and/or errors, use #hasMessages instead. true if there are warnings, false if not
See Also:   ValidationResult.getSeverity()
See Also:   ValidationResult.hasMessages()
See Also:   ValidationResult.hasErrors()




hashCode
public int hashCode()(Code)
Returns the hash code value for this validation result. This implementation returns the hash from the List of messages. the hash code value for this validation result.
See Also:   List.hashCode
See Also:   Object.hashCode



isEmpty
public boolean isEmpty()(Code)
Checks and answers whether this validation result contains no messages. true if this validation result contains no messages
See Also:   ValidationResult.hasErrors()
See Also:   ValidationResult.hasWarnings()



isModifiable
public boolean isModifiable()(Code)
Returns if this validation result is modifiable or not. Can be used to cache data from unmodifiable result. true if modifiable, false if unmodifiable



keyMap
public Map<Object, ValidationResult> keyMap()(Code)
Creates and returns an unmodifiable Map that maps the message keys of this validation result to unmodifiable sub results that share the key.

More formally: for each key key in the created map map, map.get(key) returns a ValidationResult result, such that for each ValidationMessage message in result we have: message.key().equals(key). a mapping from message key to an associated validation resultthat consist only of messages with this key
See Also:   ValidationMessage.key




size
public int size()(Code)
Returns the number of messages in this result. the number of elements in this list



subResult
public ValidationResult subResult(int fromIndex, int toIndex)(Code)
Returns an unmodifiable view of the portion of this result between the specified fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the returned result is empty.) The returned result is a copy, so changes in the returned result won't affect this result, and vice-versa.
Parameters:
  fromIndex - low end point (inclusive) of the subResult
Parameters:
  toIndex - high end point (exclusive) of the subResult a view of the specified range within this result.
throws:
  IndexOutOfBoundsException - for an illegal end point index value(fromIndex < 0 || toIndex > size || fromIndex > toIndex).
See Also:   ValidationResult.subResult(Object)



subResult
public ValidationResult subResult(Object messageKey)(Code)
Returns an unmodifiable sub result of this result that consists of all messages that share the specified message key. If the specified key is null, this method returns an empty result. The returned result is a copy, so changes in this result won't affect it.
Parameters:
  messageKey - the key to look for, can be null a sub result containing all messages that share thespecified key, or the empty result if the key is null
See Also:   ValidationResult.subResult(int,int)



subResult
public ValidationResult subResult(Object[] messageKeys)(Code)
Returns an unmodifiable sub result of this result that consists of all messages that share the specified message keys. If the array of keys is null, this method returns an empty result. The returned result is a copy, so changes in this result won't affect it.
Parameters:
  messageKeys - the keys to look for, can be null a sub result containing all messages that share the specifiedkeys, or the empty result if the key array is null
See Also:   ValidationResult.subResult(int,int)
since:
   1.4



toString
public String toString()(Code)
Returns a string representation intended for debugging purposes. a string representation intended for debugging
See Also:   Object.toString



unmodifiableResult
public static ValidationResult unmodifiableResult(ValidationResult validationResult)(Code)
Returns an unmodifiable view of the given ValidationResult. Useful to provide users with "read-only" access to internal results, or to indicate to other validation result processors that a result is not intended to be modified. Attempts to modify the returned validation result throw an UnsupportedOperationException.
Parameters:
  validationResult - the result for which an unmodifiable view is to be returned an unmodifiable view of the specified validation result



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.