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

org.hibernate.boot.model.TruthValue Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha1
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.boot.model;

/**
 * An enumeration of truth values.
 * 

* Yes this *could* be handled with Boolean, but then you run into potential * problems with unwanted auto-unboxing. * * @author Steve Ebersole */ public enum TruthValue { TRUE, FALSE, UNKNOWN; @SuppressWarnings("SimplifiableIfStatement") public boolean toBoolean(boolean defaultValue) { if ( this == TRUE ) { return true; } else if ( this == FALSE ) { return false; } else { return defaultValue; } } public static boolean toBoolean(TruthValue value, boolean defaultValue) { return value != null ? value.toBoolean( defaultValue ) : defaultValue; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy