net.time4j.DateElement Maven / Gradle / Ivy
/*
* -----------------------------------------------------------------------
* Copyright © 2013-2016 Meno Hochschild,
* -----------------------------------------------------------------------
* This file (DateElement.java) is part of project Time4J.
*
* Time4J is free software: You can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 2.1 of the License, or
* (at your option) any later version.
*
* Time4J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Time4J. If not, see .
* -----------------------------------------------------------------------
*/
package net.time4j;
import net.time4j.engine.BasicElement;
import net.time4j.engine.ChronoFunction;
import net.time4j.tz.TZID;
import net.time4j.tz.Timezone;
import net.time4j.tz.ZonalOffset;
import java.io.ObjectStreamException;
/**
* Repräsentiert eine Datumskomponente.
*
* @author Meno Hochschild
* @doctags.concurrency {immutable}
*/
final class DateElement
extends BasicElement
implements CalendarDateElement {
//~ Statische Felder/Initialisierungen --------------------------------
/**
* Singleton-Instanz.
*/
static final DateElement INSTANCE = new DateElement();
private static final long serialVersionUID = -6519899440006935829L;
//~ Konstruktoren -----------------------------------------------------
private DateElement() {
super("CALENDAR_DATE");
}
//~ Methoden ----------------------------------------------------------
@Override
public Class getType() {
return PlainDate.class;
}
@Override
public PlainDate getDefaultMinimum() {
return PlainDate.MIN;
}
@Override
public PlainDate getDefaultMaximum() {
return PlainDate.MAX;
}
@Override
public boolean isDateElement() {
return true;
}
@Override
public boolean isTimeElement() {
return false;
}
@Override
public ElementOperator firstDayOfNextMonth() {
return CalendarOperator.FIRST_DAY_OF_NEXT_MONTH;
}
@Override
public ElementOperator firstDayOfNextQuarter() {
return CalendarOperator.FIRST_DAY_OF_NEXT_QUARTER;
}
@Override
public ElementOperator firstDayOfNextYear() {
return CalendarOperator.FIRST_DAY_OF_NEXT_YEAR;
}
@Override
public ElementOperator lastDayOfPreviousMonth() {
return CalendarOperator.LAST_DAY_OF_PREVIOUS_MONTH;
}
@Override
public ElementOperator lastDayOfPreviousQuarter() {
return CalendarOperator.LAST_DAY_OF_PREVIOUS_QUARTER;
}
@Override
public ElementOperator lastDayOfPreviousYear() {
return CalendarOperator.LAST_DAY_OF_PREVIOUS_YEAR;
}
@Override
public ChronoFunction inStdTimezone() {
return this.in(Timezone.ofSystem());
}
@Override
public ChronoFunction inTimezone(TZID tzid) {
return this.in(Timezone.of(tzid));
}
@Override
public ChronoFunction in(Timezone tz) {
return new ZonalQuery<>(this, tz);
}
@Override
public ChronoFunction atUTC() {
return this.at(ZonalOffset.UTC);
}
@Override
public ChronoFunction at(ZonalOffset offset) {
return new ZonalQuery<>(this, offset);
}
@Override
protected boolean isSingleton() {
return true;
}
private Object readResolve() throws ObjectStreamException {
return INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy