All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.gwt.requestfactory.shared.impl.posers.DatePoser Maven / Gradle / Ivy

There is a newer version: 2.10.0
Show newest version
/*
 * Copyright 2010 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.gwt.requestfactory.shared.impl.posers;

import com.google.gwt.requestfactory.shared.impl.Poser;

import java.util.Date;

/**
 * A sometimes-mutable implementation of {@link Date}.
 *
 * 

RequestFactory has moved to * com.google.web.bindery.requestfactory. This package will be * removed in a future version of GWT.

*/ @Deprecated public class DatePoser extends Date implements Poser { private boolean frozen; public DatePoser(Date copy) { super(copy.getTime()); setFrozen(true); } public Date getPosedValue() { return new Date(getTime()); } public boolean isFrozen() { return frozen; } @Override public void setDate(int date) { checkFrozen(); super.setDate(date); } public void setFrozen(boolean frozen) { this.frozen = frozen; } @Override public void setHours(int hours) { checkFrozen(); super.setHours(hours); } @Override public void setMinutes(int minutes) { checkFrozen(); super.setMinutes(minutes); } @Override public void setMonth(int month) { checkFrozen(); super.setMonth(month); } @Override public void setSeconds(int seconds) { checkFrozen(); super.setSeconds(seconds); } @Override public void setTime(long time) { checkFrozen(); super.setTime(time); } @Override public void setYear(int year) { checkFrozen(); super.setYear(year); } private void checkFrozen() { if (frozen) { throw new IllegalStateException("The Date has been frozen"); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy