org.simpleflatmapper.reflect.getter.BytesUUIDGetter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-reflect Show documentation
Show all versions of sfm-reflect Show documentation
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 +
'}';
}
}