/** * This method exists to facilitate serialization via javabeans conventions. Unlike get(), * it will return null if isLoaded() is false. * * @return the entity referenced, or null if either the entity was not found or isLoaded() is false. */ final public T getValue() { return isLoaded() ? get() : null; }
/** * Obtain the entity value, throwing an exception if the entity was not found. * * @return the entity referenced. Never returns null. * @throws NotFoundException if the specified entity was not found */ final public T safe() throws NotFoundException { T t = this.get(); if (t == null) throw new NotFoundException(key()); else return t; }
public static <T> T unref(Ref<T> ref) { return ref == null ? null : ref.get(); }