KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > joda > time > ReadableDateTime


1 /*
2  * Copyright 2001-2005 Stephen Colebourne
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.joda.time;
17
18 import java.util.Locale JavaDoc;
19
20 /**
21  * Defines an instant in time that can be queried using datetime fields.
22  * <p>
23  * The implementation of this interface may be mutable or immutable.
24  * This interface only gives access to retrieve data, never to change it.
25  * <p>
26  * Methods in your application should be defined using <code>ReadableDateTime</code>
27  * as a parameter if the method only wants to read the datetime, and not perform
28  * any advanced manipulations.
29  *
30  * @author Stephen Colebourne
31  * @author Brian S O'Neill
32  * @since 1.0
33  */

34 public interface ReadableDateTime extends ReadableInstant {
35
36     /**
37      * Get the day of week field value.
38      * <p>
39      * The values for the day of week are defined in {@link DateTimeConstants}.
40      *
41      * @return the day of week
42      */

43     int getDayOfWeek();
44
45     /**
46      * Get the day of month field value.
47      *
48      * @return the day of month
49      */

50     int getDayOfMonth();
51
52     /**
53      * Get the day of year field value.
54      *
55      * @return the day of year
56      */

57     int getDayOfYear();
58
59     /**
60      * Get the week of weekyear field value.
61      *
62      * @return the week of a week based year
63      */

64     int getWeekOfWeekyear();
65
66     /**
67      * Get the weekyear field value.
68      *
69      * @return the year of a week based year
70      */

71     int getWeekyear();
72
73     /**
74      * Get the month of year field value.
75      *
76      * @return the month of year
77      */

78     int getMonthOfYear();
79
80     /**
81      * Get the year field value.
82      *
83      * @return the year
84      */

85     int getYear();
86
87     /**
88      * Get the year of era field value.
89      *
90      * @return the year of era
91      */

92     int getYearOfEra();
93
94     /**
95      * Get the year of century field value.
96      *
97      * @return the year of century
98      */

99     int getYearOfCentury();
100
101     /**
102      * Get the year of era field value.
103      *
104      * @return the year of era
105      */

106     int getCenturyOfEra();
107
108     /**
109      * Get the era field value.
110      *
111      * @return the era
112      */

113     int getEra();
114
115     // Time field access methods
116
//-----------------------------------------------------------
117

118     /**
119      * Get the millis of second field value.
120      *
121      * @return the millis of second
122      */

123     int getMillisOfSecond();
124
125     /**
126      * Get the millis of day field value.
127      *
128      * @return the millis of day
129      */

130     int getMillisOfDay();
131
132     /**
133      * Get the second of minute field value.
134      *
135      * @return the second of minute
136      */

137     int getSecondOfMinute();
138
139     /**
140      * Get the second of day field value.
141      *
142      * @return the second of day
143      */

144     int getSecondOfDay();
145
146     /**
147      * Get the minute of hour field value.
148      *
149      * @return the minute of hour
150      */

151     int getMinuteOfHour();
152
153     /**
154      * Get the minute of day field value.
155      *
156      * @return the minute of day
157      */

158     int getMinuteOfDay();
159
160     /**
161      * Get the hour of day field value.
162      *
163      * @return the hour of day
164      */

165     int getHourOfDay();
166
167     /**
168      * Get this object as a DateTime.
169      * <p>
170      * If the implementation of the interface is a DateTime, it is returned directly.
171      *
172      * @return a DateTime using the same millis
173      */

174     DateTime toDateTime();
175
176     /**
177      * Get this object as a MutableDateTime, always returning a new instance.
178      *
179      * @return a MutableDateTime using the same millis
180      */

181     MutableDateTime toMutableDateTime();
182
183     /**
184      * Output the instant using the specified format pattern.
185      *
186      * @param pattern pattern specification
187      * @throws IllegalArgumentException if pattern is invalid
188      * @see org.joda.time.format.DateTimeFormat
189      */

190     String JavaDoc toString(String JavaDoc pattern) throws IllegalArgumentException JavaDoc;
191
192     /**
193      * Output the instant using the specified format pattern.
194      *
195      * @param pattern pattern specification
196      * @param locale Locale to use, or null for default
197      * @throws IllegalArgumentException if pattern is invalid
198      * @see org.joda.time.format.DateTimeFormat
199      */

200     String JavaDoc toString(String JavaDoc pattern, Locale JavaDoc locale) throws IllegalArgumentException JavaDoc;
201     
202 }
203
Popular Tags