/*
 * Copyright (C) 2004-2007  exedio GmbH (www.exedio.com)
 *
 * This library 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.
 *
 * This library 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 this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package com.exedio.cope;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

class DataFinalItem extends Item
{

	static final DataField data = new DataField(OPTIONAL).toFinal();
	
	void getDataFinal(final OutputStream data) // TODO generate this
	throws IOException
	{
		DataFinalItem.data.get(this, data);
	}
	
	void getDataFinal(final File data) // TODO generate this
	throws IOException
	{
		DataFinalItem.data.get(this, data);
	}
	
	void setDataFinal(final InputStream data) // TODO generate this
	throws IOException
	{
		try
		{
			DataFinalItem.data.set(this, data);
		}
		catch(MandatoryViolationException e)
		{
			throw new RuntimeException(e);
		}
	}
	
	void setDataFinal(final File data) // TODO generate this
	throws IOException
	{
		try
		{
			DataFinalItem.data.set(this, data);
		}
		catch(MandatoryViolationException e)
		{
			throw new RuntimeException(e);
		}
	}
	
	/**

	 **
	 * Creates a new DataFinalItem with all the fields initially needed.
	 * @param data the initial value for field {@link #data}.
	 * @cope.generated This feature has been generated by the cope instrumentor and will be overwritten by the build process.
	 *       It can be customized with the tags <tt>@cope.constructor public|package|protected|private|none</tt> in the class comment and <tt>@cope.initial</tt> in the comment of fields.
	 */
	DataFinalItem(
				final byte[] data)
	{
		this(new com.exedio.cope.SetValue[]{
			DataFinalItem.data.map(data),
		});
	}/**

	 **
	 * Creates a new DataFinalItem and sets the given fields initially.
	 * This constructor is called by {@link com.exedio.cope.Type#newItem Type.newItem}.
	 * @cope.generated This feature has been generated by the cope instrumentor and will be overwritten by the build process.
	 *       It can be customized with the tag <tt>@cope.generic.constructor public|package|protected|private|none</tt> in the class comment.
	 */
	private DataFinalItem(final com.exedio.cope.SetValue... setValues)
	{
		super(setValues);
	}/**

	 **
	 * Reactivation constructor. Used for internal purposes only.
	 * @see com.exedio.cope.Item#Item(com.exedio.cope.util.ReactivationConstructorDummy,int)
	 * @cope.generated This feature has been generated by the cope instrumentor and will be overwritten by the build process.
	 */
	private DataFinalItem(final com.exedio.cope.util.ReactivationConstructorDummy d,final int pk)
	{
		super(d,pk);
	}/**

	 **
	 * Returns the value of the persistent field {@link #data}.
	 * @cope.generated This feature has been generated by the cope instrumentor and will be overwritten by the build process.
	 *       It can be customized with the tag <tt>@cope.getter public|package|protected|private|none|non-final|boolean-as-is</tt> in the comment of the field.
	 */
	final byte[] getData()
	{
		return DataFinalItem.data.get(this);
	}/**

	 **
	 * The persistent type information for dataFinalItem.
	 * @cope.generated This feature has been generated by the cope instrumentor and will be overwritten by the build process.
	 *       It can be customized with the tag <tt>@cope.type public|package|protected|private|none</tt> in the class comment.
	 */
	public static final com.exedio.cope.Type<DataFinalItem> TYPE = newType(DataFinalItem.class)
;}

@@ -827,919 +827,110 @@
 e;%0A%0A
-import java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0A%0Aclass DataFinalItem extends Item%0A%7B%0A%0A%09static final DataField data = new DataField(OPTIONAL).toFinal();%0A%09%0A%09void getDataFinal(final OutputStream data) // TODO generate this%0A%09throws IOException%0A%09%7B%0A%09%09DataFinalItem.data.get(this, data);%0A%09%7D%0A%09%0A%09void getDataFinal(final File data) // TODO generate this%0A%09throws IOException%0A%09%7B%0A%09%09DataFinalItem.data.get(this, data);%0A%09%7D%0A%09%0A%09void setDataFinal(final InputStream data) // TODO generate this%0A%09throws IOException%0A%09%7B%0A%09%09try%0A%09%09%7B%0A%09%09%09DataFinalItem.data.set(this, data);%0A%09%09%7D%0A%09%09catch(MandatoryViolationException e)%0A%09%09%7B%0A%09%09%09throw new RuntimeException(e);%0A%09%09%7D%0A%09%7D%0A%09%0A%09void setDataFinal(final File data) // TODO generate this%0A%09throws IOException%0A%09%7B%0A%09%09try%0A%09%09%7B%0A%09%09%09DataFinalItem.data.set(this, data);%0A%09%09%7D%0A%09%09catch(MandatoryViolationException e)%0A%09%09%7B%0A%09%09%09throw new RuntimeException(e);%0A%09%09%7D%0A%09%7D
+%0Aclass DataFinalItem extends Item%0A%7B%0A%0A%09static final DataField data = new DataField(OPTIONAL).toFinal();
 %0A%09%0A%09

remove setters, nonsense for final field; remove getters, not needed