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

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

package org.sfm.csv.primitive;

import org.sfm.csv.DelayedCellSetter;
import org.sfm.csv.ParsingContext;
import org.sfm.csv.cell.LongCellValueReader;
import org.sfm.reflect.primitive.LongSetter;

public class LongDelayedCellSetter implements DelayedCellSetter {

	private final LongSetter setter;
	private long value;
	
	public LongDelayedCellSetter(LongSetter setter) {
		this.setter = setter;
	}

	@Override
	public Long getValue() {
		return new Long(getLong());
	}
	
	public long getLong() {
		long v = value;
		value = 0;
		return v;
	}

	@Override
	public void set(T t) throws Exception {
		long v = value;
		value = 0;
		setter.setLong(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 = LongCellValueReader.parseLong(chars, offset, length);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy