Java Doc for DateTimeParserBucket.java in  » Development » Joda-Time » org » joda » time » format » 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 » Joda Time » org.joda.time.format 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.joda.time.format.DateTimeParserBucket

DateTimeParserBucket
public class DateTimeParserBucket (Code)
DateTimeParserBucket is an advanced class, intended mainly for parser implementations. It can also be used during normal parsing operations to capture more information about the parse.

This class allows fields to be saved in any order, but be physically set in a consistent order. This is useful for parsing against formats that allow field values to contradict each other.

Field values are applied in an order where the "larger" fields are set first, making their value less likely to stick. A field is larger than another when it's range duration is longer. If both ranges are the same, then the larger field has the longer duration. If it cannot be determined which field is larger, then the fields are set in the order they were saved.

For example, these fields were saved in this order: dayOfWeek, monthOfYear, dayOfMonth, dayOfYear. When computeMillis is called, the fields are set in this order: monthOfYear, dayOfYear, dayOfMonth, dayOfWeek.

DateTimeParserBucket is mutable and not thread-safe.
author:
   Brian S O'Neill
author:
   Fredrik Borgh
since:
   1.0


Inner Class :class SavedState
Inner Class :static class SavedField implements Comparable


Constructor Summary
public  DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale)
     Constucts a bucket.
public  DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale, Integer pivotYear)
     Constucts a bucket, with the option of specifying the pivot year for two-digit year parsing.

Method Summary
public  longcomputeMillis()
     Computes the parsed datetime by setting the saved fields.
public  longcomputeMillis(boolean resetFields)
     Computes the parsed datetime by setting the saved fields.
public  longcomputeMillis(boolean resetFields, String text)
     Computes the parsed datetime by setting the saved fields.
public  ChronologygetChronology()
     Gets the chronology of the bucket, which will be a local (UTC) chronology.
public  LocalegetLocale()
     Returns the locale to be used during parsing.
public  intgetOffset()
     Returns the time zone offset in milliseconds used by computeMillis, unless getZone doesn't return null.
public  IntegergetPivotYear()
     Returns the pivot year used for parsing two-digit years.
public  DateTimeZonegetZone()
     Returns the time zone used by computeMillis, or null if an offset is used instead.
public  booleanrestoreState(Object savedState)
     Restores the state of this bucket from a previously saved state.
public  voidsaveField(DateTimeField field, int value)
     Saves a datetime field value.
public  voidsaveField(DateTimeFieldType fieldType, int value)
     Saves a datetime field value.
public  voidsaveField(DateTimeFieldType fieldType, String text, Locale locale)
     Saves a datetime field text value.
public  ObjectsaveState()
     Saves the state of this bucket, returning it in an opaque object.
public  voidsetOffset(int offset)
     Set a time zone offset to be used when computeMillis is called, which overrides the time zone.
public  voidsetPivotYear(Integer pivotYear)
     Sets the pivot year to use when parsing two digit years.
public  voidsetZone(DateTimeZone zone)
     Set a time zone to be used when computeMillis is called, which overrides any set time zone offset.


Constructor Detail
DateTimeParserBucket
public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale)(Code)
Constucts a bucket.
Parameters:
  instantLocal - the initial millis from 1970-01-01T00:00:00, local time
Parameters:
  chrono - the chronology to use
Parameters:
  locale - the locale to use



DateTimeParserBucket
public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale, Integer pivotYear)(Code)
Constucts a bucket, with the option of specifying the pivot year for two-digit year parsing.
Parameters:
  instantLocal - the initial millis from 1970-01-01T00:00:00, local time
Parameters:
  chrono - the chronology to use
Parameters:
  locale - the locale to use
Parameters:
  pivotYear - the pivot year to use when parsing two-digit years
since:
   1.1




Method Detail
computeMillis
public long computeMillis()(Code)
Computes the parsed datetime by setting the saved fields. This method is idempotent, but it is not thread-safe. milliseconds since 1970-01-01T00:00:00Z
throws:
  IllegalArgumentException - if any field is out of range



computeMillis
public long computeMillis(boolean resetFields)(Code)
Computes the parsed datetime by setting the saved fields. This method is idempotent, but it is not thread-safe.
Parameters:
  resetFields - false by default, but when true, unsaved field values are cleared milliseconds since 1970-01-01T00:00:00Z
throws:
  IllegalArgumentException - if any field is out of range



computeMillis
public long computeMillis(boolean resetFields, String text)(Code)
Computes the parsed datetime by setting the saved fields. This method is idempotent, but it is not thread-safe.
Parameters:
  resetFields - false by default, but when true, unsaved field values are cleared
Parameters:
  text - optional text being parsed, to be included in any error message milliseconds since 1970-01-01T00:00:00Z
throws:
  IllegalArgumentException - if any field is out of range
since:
   1.3



getChronology
public Chronology getChronology()(Code)
Gets the chronology of the bucket, which will be a local (UTC) chronology.



getLocale
public Locale getLocale()(Code)
Returns the locale to be used during parsing. the locale to use



getOffset
public int getOffset()(Code)
Returns the time zone offset in milliseconds used by computeMillis, unless getZone doesn't return null.



getPivotYear
public Integer getPivotYear()(Code)
Returns the pivot year used for parsing two-digit years.

If null is returned, this indicates default behaviour Integer value of the pivot year, null if not set
since:
   1.1




getZone
public DateTimeZone getZone()(Code)
Returns the time zone used by computeMillis, or null if an offset is used instead.



restoreState
public boolean restoreState(Object savedState)(Code)
Restores the state of this bucket from a previously saved state. The state object passed into this method is not consumed, and it can be used later to restore to that state again.
Parameters:
  savedState - opaque saved state, returned from saveState true state object is valid and state restored



saveField
public void saveField(DateTimeField field, int value)(Code)
Saves a datetime field value.
Parameters:
  field - the field, whose chronology must match that of this bucket
Parameters:
  value - the value



saveField
public void saveField(DateTimeFieldType fieldType, int value)(Code)
Saves a datetime field value.
Parameters:
  fieldType - the field type
Parameters:
  value - the value



saveField
public void saveField(DateTimeFieldType fieldType, String text, Locale locale)(Code)
Saves a datetime field text value.
Parameters:
  fieldType - the field type
Parameters:
  text - the text value
Parameters:
  locale - the locale to use



saveState
public Object saveState()(Code)
Saves the state of this bucket, returning it in an opaque object. Call restoreState to undo any changes that were made since the state was saved. Calls to saveState may be nested. opaque saved state, which may be passed to restoreState



setOffset
public void setOffset(int offset)(Code)
Set a time zone offset to be used when computeMillis is called, which overrides the time zone.



setPivotYear
public void setPivotYear(Integer pivotYear)(Code)
Sets the pivot year to use when parsing two digit years.

If the value is set to null, this will indicate that default behaviour should be used.
Parameters:
  pivotYear - the pivot year to use
since:
   1.1




setZone
public void setZone(DateTimeZone zone)(Code)
Set a time zone to be used when computeMillis is called, which overrides any set time zone offset.
Parameters:
  zone - the date time zone to operate in, or null if UTC



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.