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

com.googlecode.objectify.impl.translate.NullSafeTranslator Maven / Gradle / Ivy

There is a newer version: 6.1.2
Show newest version
package com.googlecode.objectify.impl.translate;

import com.googlecode.objectify.impl.Path;

/**
 * 

Handles null checking so we don't have to do it everywhere.

* * @author Jeff Schnitzer */ abstract public class NullSafeTranslator implements Translator { @Override final public P load(D node, LoadContext ctx, Path path) throws SkipException { if (node == null) return null; else return loadSafe(node, ctx, path); } @Override final public D save(P pojo, boolean index, SaveContext ctx, Path path) throws SkipException { if (pojo == null) return null; else return saveSafe(pojo, index, ctx, path); } /** * Implement this, returning a proper translated value * @param node will never be null */ abstract protected P loadSafe(D node, LoadContext ctx, Path path) throws SkipException; /** * Implement this, returning a proper translated value * @param pojo will never be null */ abstract protected D saveSafe(P pojo, boolean index, SaveContext ctx, Path path) throws SkipException; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy