< prev index next >

modules/javafx.base/src/main/java/javafx/beans/binding/When.java

Print this page




 844         /**
 845          * Defines a constant value of the ternary expression, that is returned
 846          * if the condition is {@code false}.
 847          *
 848          * @param otherwiseValue
 849          *            the value
 850          * @return the complete {@link ObjectBinding}
 851          */
 852         public ObjectBinding<T> otherwise(final T otherwiseValue) {
 853             if (trueResult != null)
 854                 return new ObjectCondition<T>(trueResult, otherwiseValue);
 855             else
 856                 return new ObjectCondition<T>(trueResultValue, otherwiseValue);
 857         }
 858     }
 859 
 860     /**
 861      * Defines the {@link javafx.beans.value.ObservableObjectValue} which value
 862      * is returned by the ternary expression if the condition is {@code true}.
 863      *

 864      * @param thenValue
 865      *            the value
 866      * @return the intermediate result which still requires the otherwise-branch
 867      */
 868     public <T> ObjectConditionBuilder<T> then(final ObservableObjectValue<T> thenValue) {
 869         if (thenValue == null) {
 870             throw new NullPointerException("Value needs to be specified");
 871         }
 872         return new ObjectConditionBuilder<T>(thenValue);
 873     }
 874 
 875     /**
 876      * Defines a constant value of the ternary expression, that is returned if
 877      * the condition is {@code true}.
 878      *

 879      * @param thenValue
 880      *            the value
 881      * @return the intermediate result which still requires the otherwise-branch
 882      */
 883     public <T> ObjectConditionBuilder<T> then(final T thenValue) {
 884         return new ObjectConditionBuilder<T>(thenValue);
 885     }
 886 
 887 }


 844         /**
 845          * Defines a constant value of the ternary expression, that is returned
 846          * if the condition is {@code false}.
 847          *
 848          * @param otherwiseValue
 849          *            the value
 850          * @return the complete {@link ObjectBinding}
 851          */
 852         public ObjectBinding<T> otherwise(final T otherwiseValue) {
 853             if (trueResult != null)
 854                 return new ObjectCondition<T>(trueResult, otherwiseValue);
 855             else
 856                 return new ObjectCondition<T>(trueResultValue, otherwiseValue);
 857         }
 858     }
 859 
 860     /**
 861      * Defines the {@link javafx.beans.value.ObservableObjectValue} which value
 862      * is returned by the ternary expression if the condition is {@code true}.
 863      *
 864      * @param <T> the type of the wrapped {@code Object}
 865      * @param thenValue
 866      *            the value
 867      * @return the intermediate result which still requires the otherwise-branch
 868      */
 869     public <T> ObjectConditionBuilder<T> then(final ObservableObjectValue<T> thenValue) {
 870         if (thenValue == null) {
 871             throw new NullPointerException("Value needs to be specified");
 872         }
 873         return new ObjectConditionBuilder<T>(thenValue);
 874     }
 875 
 876     /**
 877      * Defines a constant value of the ternary expression, that is returned if
 878      * the condition is {@code true}.
 879      *
 880      * @param <T> the type of the wrapped {@code Object}
 881      * @param thenValue
 882      *            the value
 883      * @return the intermediate result which still requires the otherwise-branch
 884      */
 885     public <T> ObjectConditionBuilder<T> then(final T thenValue) {
 886         return new ObjectConditionBuilder<T>(thenValue);
 887     }
 888 
 889 }
< prev index next >