public final class WeekOfWeekBasedYear extends java.lang.Object implements Calendrical, java.lang.Comparable<WeekOfWeekBasedYear>, CalendricalMatcher, java.io.Serializable
WeekOfWeekBasedYear is an immutable time field that can only store a week of week-based-year. It is a type-safe way of representing a week of week-based-year in an application.
The week of week-based-year is a field that should be used in combination with
the WeekBasedYear field. Together they represent the ISO-8601 week based date
calculation described in WeekBasedYear
.
Static factory methods allow you to construct instances. The week of week-based-year may be queried using getValue().
WeekOfWeekBasedYear is immutable and thread-safe.
Modifier and Type | Method and Description |
---|---|
int |
compareTo(WeekOfWeekBasedYear otherWeekOfWeekBasedYear)
Compares this week of week-based-year instance to another.
|
boolean |
equals(java.lang.Object otherWeekOfWeekBasedYear)
Is this instance equal to that specified, evaluating the week of week-based-year.
|
<T> T |
get(CalendricalRule<T> rule)
Gets the value of the specified calendrical rule.
|
int |
getValue()
Gets the week of week-based-year value.
|
int |
hashCode()
A hash code for the week of week-based-year object.
|
boolean |
isAfter(WeekOfWeekBasedYear otherWeekOfWeekBasedYear)
Is this week of week-based-year instance after the specified week of week-based-year.
|
boolean |
isBefore(WeekOfWeekBasedYear otherWeekOfWeekBasedYear)
Is this week of week-based-year instance before the specified week of week-based-year.
|
boolean |
isValid(WeekBasedYear weekyear)
Checks if this week of weekyear is valid for the specified week-based-year.
|
boolean |
matchesCalendrical(Calendrical calendrical)
Checks if the week-of-week-based-year extracted from the calendrical matches this.
|
static DateTimeFieldRule<java.lang.Integer> |
rule()
Gets the rule that defines how the week of week-based-year field operates.
|
java.lang.String |
toString()
A string describing the week of week-based-year object.
|
static WeekOfWeekBasedYear |
weekOfWeekBasedYear(Calendrical calendrical)
Obtains an instance of
WeekOfWeekBasedYear from a calendrical. |
static WeekOfWeekBasedYear |
weekOfWeekBasedYear(int weekOfWeekyear)
Obtains an instance of
WeekOfWeekBasedYear from a value. |
public static DateTimeFieldRule<java.lang.Integer> rule()
The rule provides access to the minimum and maximum values, and a generic way to access values within a calendrical.
public static WeekOfWeekBasedYear weekOfWeekBasedYear(int weekOfWeekyear)
WeekOfWeekBasedYear
from a value.
A week of week-based-year object represents one of the 53 weeks of the year, from 1 to 53. These are cached internally and returned as singletons, so they can be compared using ==.
weekOfWeekyear
- the week of week-based-year to represent, from 1 to 53IllegalCalendarFieldValueException
- if the weekOfWeekyear is invalidpublic static WeekOfWeekBasedYear weekOfWeekBasedYear(Calendrical calendrical)
WeekOfWeekBasedYear
from a calendrical.
This can be used extract the week-of-week-based-year value directly from any implementation
of Calendrical
, including those in other calendar systems.
calendrical
- the calendrical to extract from, not nullUnsupportedRuleException
- if the week-of-week-based-year cannot be obtainedpublic <T> T get(CalendricalRule<T> rule)
This method queries the value of the specified calendrical rule.
If the value cannot be returned for the rule from this instance then
null
will be returned.
get
in interface Calendrical
rule
- the rule to use, not nullpublic int getValue()
public boolean matchesCalendrical(Calendrical calendrical)
matchesCalendrical
in interface CalendricalMatcher
calendrical
- the calendrical to match, not nullpublic boolean isValid(WeekBasedYear weekyear)
weekyear
- the weekyear to validate against, not nullpublic int compareTo(WeekOfWeekBasedYear otherWeekOfWeekBasedYear)
compareTo
in interface java.lang.Comparable<WeekOfWeekBasedYear>
otherWeekOfWeekBasedYear
- the other week of week-based-year instance, not nulljava.lang.NullPointerException
- if otherWeekOfWeekBasedYear is nullpublic boolean isAfter(WeekOfWeekBasedYear otherWeekOfWeekBasedYear)
otherWeekOfWeekBasedYear
- the other week of week-based-year instance, not nulljava.lang.NullPointerException
- if otherWeekOfWeekBasedYear is nullpublic boolean isBefore(WeekOfWeekBasedYear otherWeekOfWeekBasedYear)
otherWeekOfWeekBasedYear
- the other week of week-based-year instance, not nulljava.lang.NullPointerException
- if otherWeekOfWeekBasedYear is nullpublic boolean equals(java.lang.Object otherWeekOfWeekBasedYear)
equals
in class java.lang.Object
otherWeekOfWeekBasedYear
- the other week of week-based-year instance, null returns falsepublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object