public enum DefaultTimeGrain extends Enum<DefaultTimeGrain> implements ZonelessTimeGrain
ReadablePeriod
. Satisfiability is
determined by configuring an explicit tree together via the satisfying grains property. Rounding functions support
alignment testing, and are provided by joda's DateTime.Property
class.Enum Constant and Description |
---|
DAY |
HOUR |
MINUTE |
MONTH |
QUARTER |
WEEK |
YEAR |
Modifier and Type | Field and Description |
---|---|
static String |
PERIOD_TYPE_NAME |
Modifier and Type | Method and Description |
---|---|
void |
addSatisfyingGrain(TimeGrain satisfies)
Notifies this grain that it can be decomposed to another grain.
|
String |
getAlignmentDescription()
Get description of correct alignment of a granularity, e.g.
|
org.joda.time.Duration |
getEstimatedDuration()
Estimated duration gives a rough millisecond length of the TimeGrain usable for comparison.
|
String |
getName()
Get the name of the granularity.
|
org.joda.time.ReadablePeriod |
getPeriod()
Get the Period of the TimeGrain.
|
String |
getPeriodString()
Period string to use when serializing.
|
String |
getType()
Type of Granularity to use when serializing.
|
org.joda.time.DateTime |
roundFloor(org.joda.time.DateTime dateTime)
Given a date time find the first instant at or before that date time which starts a time grain.
|
boolean |
satisfiedBy(TimeGrain grain)
True if the argument grain can be used to build this grain.
|
String |
toString() |
static DefaultTimeGrain |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DefaultTimeGrain[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
aligns, buildZonedTimeGrain
accepts, aligns, intervalsIterator, roundCeiling, satisfiedBy
intervalsIterable, intervalsIterator, satisfies
public static final DefaultTimeGrain MINUTE
public static final DefaultTimeGrain HOUR
public static final DefaultTimeGrain DAY
public static final DefaultTimeGrain WEEK
public static final DefaultTimeGrain MONTH
public static final DefaultTimeGrain QUARTER
public static final DefaultTimeGrain YEAR
public static final String PERIOD_TYPE_NAME
public static DefaultTimeGrain[] values()
for (DefaultTimeGrain c : DefaultTimeGrain.values()) System.out.println(c);
public static DefaultTimeGrain valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getType()
TimeGrain
public String toString()
toString
in interface TimeGrain
toString
in class Enum<DefaultTimeGrain>
public org.joda.time.ReadablePeriod getPeriod()
TimeGrain
public String getAlignmentDescription()
Granularity
getAlignmentDescription
in interface Granularity
getAlignmentDescription
in interface TimeGrain
public String getPeriodString()
TimeGrain
getPeriodString
in interface TimeGrain
public org.joda.time.DateTime roundFloor(org.joda.time.DateTime dateTime)
TimeGrain
roundFloor
in interface TimeGrain
dateTime
- The time being roundedpublic boolean satisfiedBy(@NotNull TimeGrain grain)
TimeGrain
satisfiedBy
in interface TimeGrain
grain
- The grain being testedpublic org.joda.time.Duration getEstimatedDuration()
TimeGrain
getEstimatedDuration
in interface TimeGrain
public String getName()
Granularity
getName
in interface Granularity
getName
in interface TimeGrain
public void addSatisfyingGrain(TimeGrain satisfies)
satisfies
- The grain which this grain can be built from.Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.