/** * Similar to {@link #build()} and {@link #getObject()} but checks the state to * determine if {@link #build()} needs to be called first. * * @return the result of {@link #build()} or {@link #getObject()}. If an error occurs * while building, returns null. */ public O getOrBuild() { if (isUnbuilt()) { try { return build(); } catch (Exception e) { logger.debug("Failed to perform build. Returning null", e); return null; } } else { return getObject(); } }
/** * Similar to {@link #build()} and {@link #getObject()} but checks the state to * determine if {@link #build()} needs to be called first. * * @return the result of {@link #build()} or {@link #getObject()}. If an error occurs * while building, returns null. */ public O getOrBuild() { if (isUnbuilt()) { try { return build(); } catch (Exception e) { logger.debug("Failed to perform build. Returning null", e); return null; } } else { return getObject(); } }
/** * Similar to {@link #build()} and {@link #getObject()} but checks the state to * determine if {@link #build()} needs to be called first. * * @return the result of {@link #build()} or {@link #getObject()}. If an error occurs * while building, returns null. */ public O getOrBuild() { if (isUnbuilt()) { try { return build(); } catch (Exception e) { logger.debug("Failed to perform build. Returning null", e); return null; } } else { return getObject(); } }