Java Doc for Datatype.java in  » 6.0-JDK-Modules » jaxb-xjc » org » relaxng » datatype » 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 » 6.0 JDK Modules » jaxb xjc » org.relaxng.datatype 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.relaxng.datatype.Datatype

Datatype
public interface Datatype (Code)
Datatype object. This object has the following functionality:
  1. functionality to identify a class of character sequences. This is done through the isValid method.
  2. functionality to produce a "value object" from a character sequence and context information.
  3. functionality to test the equality of two value objects.
This interface also defines the createStreamingValidator method, which is intended to efficiently support the validation of large character sequences.
author:
   James Clark
author:
   Kohsuke KAWAGUCHI


Field Summary
final public static  intID_TYPE_ID
     Indicates that RELAX NG compatibility processors should treat this datatype as having ID semantics.
final public static  intID_TYPE_IDREF
     Indicates that RELAX NG compatibility processors should treat this datatype as having IDREF semantics.
final public static  intID_TYPE_IDREFS
     Indicates that RELAX NG compatibility processors should treat this datatype as having IDREFS semantics.
final public static  intID_TYPE_NULL
     Indicates that the datatype doesn't have ID/IDREF semantics.


Method Summary
 voidcheckValid(String literal, ValidationContext context)
     Similar to the isValid method but throws an exception with diagnosis in case of errors.

If the specified 'literal' is a valid lexical representation for this datatype, then this method must return without throwing any exception. If not, the callee must throw an exception (with diagnosis message, if possible.)

The application can use this method to provide detailed error message to users.

 DatatypeStreamingValidatorcreateStreamingValidator(ValidationContext context)
     Creates an instance of a streaming validator for this type.

By using streaming validators instead of the isValid method, the caller can avoid keeping the entire string, which is sometimes quite big, in memory.
Parameters:
  context - If this datatype is context-dependent(i.e.

 ObjectcreateValue(String literal, ValidationContext context)
     Converts lexcial value and the current context to the corresponding value object.

The caller cannot generally assume that the value object is a meaningful Java object.

public  intgetIdType()
     Checks if the ID/IDREF semantics is associated with this datatype.

This method is introduced to support the RELAX NG DTD compatibility spec.

public  booleanisContextDependent()
     Checks if this datatype may need a context object for the validation.

The callee must return true even when the context is not always necessary.

 booleanisValid(String literal, ValidationContext context)
     Checks if the specified 'literal' matches this Datatype with respect to the current context.
Parameters:
  literal - the lexical representation to be checked.
Parameters:
  context - If this datatype is context-dependent(i.e.
 booleansameValue(Object value1, Object value2)
     Tests the equality of two value objects which were originally created by the createValue method of this object. The behavior is undefined if objects not created by this type are passed.
 intvalueHashCode(Object value)
     Computes the hash code for a value object, which is consistent with the sameValue method.

Field Detail
ID_TYPE_ID
final public static int ID_TYPE_ID(Code)
Indicates that RELAX NG compatibility processors should treat this datatype as having ID semantics. This value is one of the possible return values of the Datatype.getIdType method.



ID_TYPE_IDREF
final public static int ID_TYPE_IDREF(Code)
Indicates that RELAX NG compatibility processors should treat this datatype as having IDREF semantics. This value is one of the possible return values of the Datatype.getIdType method.



ID_TYPE_IDREFS
final public static int ID_TYPE_IDREFS(Code)
Indicates that RELAX NG compatibility processors should treat this datatype as having IDREFS semantics. This value is one of the possible return values of the Datatype.getIdType method.



ID_TYPE_NULL
final public static int ID_TYPE_NULL(Code)
Indicates that the datatype doesn't have ID/IDREF semantics. This value is one of the possible return values of the Datatype.getIdType method.





Method Detail
checkValid
void checkValid(String literal, ValidationContext context) throws DatatypeException(Code)
Similar to the isValid method but throws an exception with diagnosis in case of errors.

If the specified 'literal' is a valid lexical representation for this datatype, then this method must return without throwing any exception. If not, the callee must throw an exception (with diagnosis message, if possible.)

The application can use this method to provide detailed error message to users. This method is kept separate from the isValid method to achieve higher performance during normal validation.
exception:
  DatatypeException - If the given literal is invalid, then this exception is thrown.If the callee supports error diagnosis, then the exception shouldcontain a diagnosis message.




createStreamingValidator
DatatypeStreamingValidator createStreamingValidator(ValidationContext context)(Code)
Creates an instance of a streaming validator for this type.

By using streaming validators instead of the isValid method, the caller can avoid keeping the entire string, which is sometimes quite big, in memory.
Parameters:
  context - If this datatype is context-dependent(i.e. the Datatype.isContextDependent method returns true),then the caller must provide a non-null valid context object.Otherwise, the caller can pass null.The callee may keep a reference to this context objectonly while the returned streaming validator is being used.




createValue
Object createValue(String literal, ValidationContext context)(Code)
Converts lexcial value and the current context to the corresponding value object.

The caller cannot generally assume that the value object is a meaningful Java object. For example, the caller cannot expect this method to return java.lang.Number type for the "integer" type of XML Schema Part 2.

Also, the caller cannot assume that the equals method and the hashCode method of the value object are consistent with the semantics of the datatype. For that purpose, the sameValue method and the valueHashCode method have to be used. Note that this means you cannot use classes like java.util.Hashtable to store the value objects.

The returned value object should be used solely for the sameValue and valueHashCode methods.
Parameters:
  context - If this datatype is context-dependent(when the Datatype.isContextDependent method returns true),then the caller must provide a non-null valid context object.Otherwise, the caller can pass null. nullwhen the given lexical value is not a valid lexicalvalue for this type.




getIdType
public int getIdType()(Code)
Checks if the ID/IDREF semantics is associated with this datatype.

This method is introduced to support the RELAX NG DTD compatibility spec. (Of course it's always free to use this method for other purposes.)

If you are implementing a datatype library and have no idea about the "RELAX NG DTD compatibility" thing, just return ID_TYPE_NULL is fine. If this datatype doesn't have any ID/IDREF semantics,it returns Datatype.ID_TYPE_NULL. If it has such a semantics(for example, XSD:ID, XSD:IDREF and comp:ID type), thenit returns Datatype.ID_TYPE_ID, Datatype.ID_TYPE_IDREF orDatatype.ID_TYPE_IDREFS.




isContextDependent
public boolean isContextDependent()(Code)
Checks if this datatype may need a context object for the validation.

The callee must return true even when the context is not always necessary. (For example, the "QName" type doesn't need a context object when validating unprefixed string. But nonetheless QName must return true.)

XSD's string and short types are examples of context-independent datatypes. Its QName and ENTITY types are examples of context-dependent datatypes.

When a datatype is context-independent, then the Datatype.isValid method, the Datatype.checkValid method, the Datatype.createStreamingValidator method and the Datatype.createValue method can be called without providing a context object. true if this datatype is context-dependent(it needs a context object sometimes);false if this datatype is context-independent(it never needs a context object).




isValid
boolean isValid(String literal, ValidationContext context)(Code)
Checks if the specified 'literal' matches this Datatype with respect to the current context.
Parameters:
  literal - the lexical representation to be checked.
Parameters:
  context - If this datatype is context-dependent(i.e. the Datatype.isContextDependent method returns true),then the caller must provide a non-null valid context object.Otherwise, the caller can pass null.true if the 'literal' is a member of this Datatype;false if it's not a member of this Datatype.



sameValue
boolean sameValue(Object value1, Object value2)(Code)
Tests the equality of two value objects which were originally created by the createValue method of this object. The behavior is undefined if objects not created by this type are passed. It is the caller's responsibility to ensure that value objects belong to this type. true if two value objects are considered equal according tothe definition of this datatype; false if otherwise.



valueHashCode
int valueHashCode(Object value)(Code)
Computes the hash code for a value object, which is consistent with the sameValue method. hash code for the specified value object.



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