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

org.sfm.csv.primitive.FloatDelayedCellSetter Maven / Gradle / Ivy

package org.sfm.csv.primitive;

import org.sfm.csv.DelayedCellSetter;
import org.sfm.csv.ParsingContext;
import org.sfm.csv.cell.FloatCellValueReader;
import org.sfm.reflect.primitive.FloatSetter;

public class FloatDelayedCellSetter implements DelayedCellSetter {

	private final FloatSetter setter;
	private float value;
	
	public FloatDelayedCellSetter(FloatSetter setter) {
		this.setter = setter;
	}

	@Override
	public Float getValue() {
		return new Float(getFloat());
	}

	public float getFloat() {
		float v = value;
		value = 0;
		return v;
	}
	
	@Override
	public void set(T t) throws Exception {
		float v = value;
		value = 0;
		setter.setFloat(t, v);
	}

	@Override
	public boolean isSettable() {
		return setter != null;
	}

	@Override
	public void set(char[] chars, int offset, int length, ParsingContext parsingContext) throws Exception {
		this.value = FloatCellValueReader.parseFloat(chars, offset, length);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy