package net.w_horse.excelpojo.excel;

import java.lang.annotation.Annotation;


import net.w_horse.excelpojo.annotation.ExcelPOJOAnnotationParser;
import net.w_horse.excelpojo.bean.Utils;
import net.w_horse.excelpojo.xml.ExcelPOJOXmlParser;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.w3c.dom.Element;

public class ConstantValueCellSeeker extends AbstractCellSeeker {

	private String value;
	@Override
	public void set(Element element, ExcelPOJOXmlParser parser) {
		parser.setCellSeeker(element, this);
	}

	@Override
	public void set(Annotation annotation, ExcelPOJOAnnotationParser parser) {
		parser.setCellSeeker(annotation, this);
	}

	@Override
	public boolean verify() throws IllegalArgumentException {
		return true;
	}

	@Override
	public Object seekCellValue(HSSFSheet sheet, Class<?> requiredType) {
		return Utils.convertIfNecessary(getValue(), requiredType);
	}

	@Override
	protected Offset seekCellPosition(HSSFSheet sheet) {
		return new Offset();
	}

	@Override
	protected Offset seekCellPosition(HSSFSheet sheet, Offset basePosition, Offset offset) {
		return new Offset();
	}

	@Override
	public void setValue(HSSFSheet sheet, Object bean) {
		// 書き込みについては何もしない
	}

	@Override
	protected void setValue(HSSFSheet sheet, Offset basePosition,
			Offset offset, Object value) {
		// 書き込みについては何もしない
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getValue() {
		return value;
	}

	public void setMargedRows(boolean connectedRows) {
	}


}
