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

org.simpleflatmapper.reflect.getter.BytesUUIDGetter Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

The newest version!
package org.simpleflatmapper.reflect.getter;

import org.simpleflatmapper.reflect.Getter;
import org.simpleflatmapper.util.UUIDHelper;

import java.util.UUID;

public final class BytesUUIDGetter implements Getter {

	private final Getter bytesGetter;

	public BytesUUIDGetter(final Getter bytesGetter)  {
		this.bytesGetter = bytesGetter;
	}

	@Override
	public UUID get(final R target) throws Exception {
		final byte[] o = bytesGetter.get(target);
		if (o == null) return null;
		return UUIDHelper.fromBytes(o);
	}

    @Override
    public String toString() {
        return "StringUUIDGetter{" +
                "bytesGetter=" + bytesGetter +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy