michael@3: /** michael@3: * Copyright (c) 2012, Ben Fortuna michael@3: * All rights reserved. michael@3: * michael@3: * Redistribution and use in source and binary forms, with or without michael@3: * modification, are permitted provided that the following conditions michael@3: * are met: michael@3: * michael@3: * o Redistributions of source code must retain the above copyright michael@3: * notice, this list of conditions and the following disclaimer. michael@3: * michael@3: * o Redistributions in binary form must reproduce the above copyright michael@3: * notice, this list of conditions and the following disclaimer in the michael@3: * documentation and/or other materials provided with the distribution. michael@3: * michael@3: * o Neither the name of Ben Fortuna nor the names of any other contributors michael@3: * may be used to endorse or promote products derived from this software michael@3: * without specific prior written permission. michael@3: * michael@3: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS michael@3: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT michael@3: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR michael@3: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR michael@3: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, michael@3: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, michael@3: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR michael@3: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF michael@3: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING michael@3: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS michael@3: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. michael@3: */ michael@3: package net.fortuna.ical4j.model.property; michael@3: michael@3: import net.fortuna.ical4j.model.ParameterList; michael@3: import net.fortuna.ical4j.model.Property; michael@3: import net.fortuna.ical4j.model.PropertyFactoryImpl; michael@3: import net.fortuna.ical4j.model.UtcOffset; michael@3: import net.fortuna.ical4j.model.ValidationException; michael@3: michael@3: /** michael@3: * $Id$ michael@3: * michael@3: * Created: [Apr 6, 2004] michael@3: * michael@3: * Defines a TZOFFSETTO iCalendar component property. michael@3: * @author benf michael@3: */ michael@3: public class TzOffsetTo extends Property { michael@3: michael@3: private static final long serialVersionUID = 8213874575051177732L; michael@3: michael@3: private UtcOffset offset; michael@3: michael@3: /** michael@3: * Default constructor. michael@3: */ michael@3: public TzOffsetTo() { michael@3: super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); michael@3: } michael@3: michael@3: /** michael@3: * @param value an offset value michael@3: */ michael@3: public TzOffsetTo(String value) { michael@3: super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); michael@3: setValue(value); michael@3: } michael@3: michael@3: /** michael@3: * @param aList a list of parameters for this component michael@3: * @param aValue a value string for this component michael@3: */ michael@3: public TzOffsetTo(final ParameterList aList, final String aValue) { michael@3: super(TZOFFSETTO, aList, PropertyFactoryImpl.getInstance()); michael@3: setValue(aValue); michael@3: } michael@3: michael@3: /** michael@3: * @param anOffset a timezone offset in milliseconds michael@3: */ michael@3: public TzOffsetTo(final UtcOffset anOffset) { michael@3: super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); michael@3: offset = anOffset; michael@3: } michael@3: michael@3: /** michael@3: * @param aList a list of parameters for this component michael@3: * @param anOffset a timezone offset in milliseconds michael@3: */ michael@3: public TzOffsetTo(final ParameterList aList, final UtcOffset anOffset) { michael@3: super(TZOFFSETTO, aList, PropertyFactoryImpl.getInstance()); michael@3: offset = anOffset; michael@3: } michael@3: michael@3: /** michael@3: * @return Returns the offset. michael@3: */ michael@3: public final UtcOffset getOffset() { michael@3: return offset; michael@3: } michael@3: michael@3: /** michael@3: * {@inheritDoc} michael@3: */ michael@3: public final void setValue(final String aValue) { michael@3: offset = new UtcOffset(aValue); michael@3: } michael@3: michael@3: /** michael@3: * {@inheritDoc} michael@3: */ michael@3: public final String getValue() { michael@3: if (offset != null) { michael@3: return offset.toString(); michael@3: } michael@3: return ""; michael@3: } michael@3: michael@3: /** michael@3: * @param offset The offset to set. michael@3: */ michael@3: public final void setOffset(final UtcOffset offset) { michael@3: this.offset = offset; michael@3: } michael@3: michael@3: /** michael@3: * {@inheritDoc} michael@3: */ michael@3: public final void validate() throws ValidationException { michael@3: // TODO: Auto-generated method stub michael@3: } michael@3: }