public final class StartOfMonth extends java.lang.Object implements java.lang.Comparable<StartOfMonth>, java.io.Serializable
Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.
Constructor and Description |
---|
StartOfMonth(int dayOfMonth)
Constructs a
StartOfMonth object specifying a definition of
"months" that begin on the specified day of the month. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(StartOfMonth comparisonStartOfMonth)
Compares this
StartOfMonth with the specified comparison
StartOfMonth for chronological order. |
int |
dayOfMonth()
Returns a number between 1 and 28 (inclusive) indicating which day should
be taken as the first of the month.
|
boolean |
equals(java.lang.Object o)
Returns
true if o is a StartOfMonth
object representing the same day in the month as this ;
false otherwise. |
static StartOfMonth |
fromString(java.lang.String startOfMonthString)
Parses a string representation of a
StartOfMonth in
---DD format, the format used by XML Schema's
gDay type (based on ISO 8601). |
int |
hashCode()
Overridden to ensure consistency with
equals . |
static StartOfMonth |
of(int dayOfMonth)
Returns a non-null
StartOfMonth object specifying a
definition of "months" that begin on the specified day of the month. |
java.lang.String |
toString()
Returns a non-null, non-empty string representation of this object in
---DD format, the format used by XML Schema's
gDay type (based on ISO 8601). |
public StartOfMonth(int dayOfMonth)
StartOfMonth
object specifying a definition of
"months" that begin on the specified day of the month.dayOfMonth
- a number between 1 and 28 (inclusive) indicating which
day should be taken as the start of the "month". Pass 1 to specify
regular calendar months.java.lang.IllegalArgumentException
- if dayOfMonth
is less than
1 or greater than 28.public static StartOfMonth of(int dayOfMonth)
StartOfMonth
object specifying a
definition of "months" that begin on the specified day of the month.dayOfMonth
- a number between 1 and 28 (inclusive) indicating which
day should be taken as the start of the "month". Pass 1 to specify
regular calendar months.java.lang.IllegalArgumentException
- if dayOfMonth
is less than
1 or greater than 28.public int dayOfMonth()
public static StartOfMonth fromString(java.lang.String startOfMonthString) throws java.lang.NumberFormatException
StartOfMonth
in
---DD
format, the format used by XML Schema's
gDay
type (based on ISO 8601).
Note that, since StartOfMonth
is designed to be applicable
to all months of all years, this method will not accept
"---29"
, "---30"
, or "---31"
.
startOfMonthString
- a string with format ---DD
, where
DD
is a number between 01 and 28 (inclusive).StartOfMonth
object corresponding to the
day of the month represented by startOfMonthString
.java.lang.NullPointerException
- if startOfMonthString
is
null
.java.lang.NumberFormatException
- if startOfMonthString
has an
invalid format, or represents a day of the month that is greater
than 28.toString()
public java.lang.String toString()
---DD
format, the format used by XML Schema's
gDay
type (based on ISO 8601).toString
in class java.lang.Object
fromString(java.lang.String)
public boolean equals(java.lang.Object o)
true
if o
is a StartOfMonth
object representing the same day in the month as this
;
false
otherwise.equals
in class java.lang.Object
public int hashCode()
equals
.hashCode
in class java.lang.Object
public int compareTo(StartOfMonth comparisonStartOfMonth)
StartOfMonth
with the specified comparison
StartOfMonth
for chronological order.compareTo
in interface java.lang.Comparable<StartOfMonth>
comparisonStartOfMonth
- the StartOfMonth
to be
compared. Cannot be null
.StartOfMonth
is before
comparisonStartOfMonth
; zero if this
StartOfMonth
is equal to
comparisonStartOfMonth
; or a positive integer if
this StartOfMonth
is after
comparisonStartOfMonth
.java.lang.NullPointerException
- if comparisonStartOfMonth
is
null
.
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.