Class StringExpression
- javafx.beans.binding.StringExpression
All Implemented Interfaces:
Observable, ObservableObjectValue<String>, ObservableStringValue, ObservableValue<String>
Direct Known Subclasses:
public abstract class StringExpression extends Object implements ObservableStringValue
StringExpression is a ObservableStringValue plus additional convenience methods to generate bindings in a fluent style. A concrete sub-class of StringExpression has to implement the method ObservableObjectValue.get(), which provides the actual value of this expression.
Note: all implementation of BooleanBinding returned by the comparisons in this class consider a String that is null equal to an empty String.
Since:
JavaFX 2.0
-
Constructor Summary
Constructors Constructor and Description StringExpression()
-
Method Summary
All MethodsStatic MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description StringExpressionconcat(Object other)Returns aStringExpressionthat holds the value of thisStringExpressionconcatenated with anotherObject.StringgetValue()Returns the current value of thisObservableValueStringgetValueSafe()Returns usually the value of thisStringExpression.BooleanBindinggreaterThan(ObservableStringValue other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis greater than anotherObservableStringValue.BooleanBindinggreaterThan(String other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis greater than a constant value.BooleanBindinggreaterThanOrEqualTo(ObservableStringValue other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis greater than or equal to anotherObservableStringValue.BooleanBindinggreaterThanOrEqualTo(String other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis greater than or equal to a constant value.BooleanBindingisEmpty()BooleanBindingisEqualTo(ObservableStringValue other)BooleanBindingisEqualTo(String other)BooleanBindingisEqualToIgnoreCase(ObservableStringValue other)Creates a newBooleanBindingthat holdstrueif this and anotherObservableStringValueare equal ignoring case.BooleanBindingisEqualToIgnoreCase(String other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis equal to a constant value ignoring case.BooleanBindingisNotEmpty()BooleanBindingisNotEqualTo(ObservableStringValue other)Creates a newBooleanBindingthat holdstrueif this and anotherObservableStringValueare not equal.BooleanBindingisNotEqualTo(String other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis not equal to a constant value.BooleanBindingisNotEqualToIgnoreCase(ObservableStringValue other)Creates a newBooleanBindingthat holdstrueif this and anotherObservableStringValueare not equal ignoring case.BooleanBindingisNotEqualToIgnoreCase(String other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis not equal to a constant value ignoring case.BooleanBindingisNotNull()BooleanBindingisNull()IntegerBindinglength()Creates a newIntegerBindingthat holds the length of thisStringExpression.BooleanBindinglessThan(ObservableStringValue other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis less than anotherObservableStringValue.BooleanBindinglessThan(String other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis less than a constant value.BooleanBindinglessThanOrEqualTo(ObservableStringValue other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis less than or equal to anotherObservableStringValue.BooleanBindinglessThanOrEqualTo(String other)Creates a newBooleanBindingthat holdstrueif thisStringExpressionis less than or equal to a constant value.static StringExpressionstringExpression(ObservableValue<?> value)Returns aStringExpressionthat wraps aObservableValue.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javafx.beans.value.ObservableObjectValue
get
-
Methods inherited from interface javafx.beans.value.ObservableValue
addListener, removeListener
-
Methods inherited from interface javafx.beans.Observable
addListener, removeListener
-
-
Constructor Detail
-
StringExpression
public StringExpression()
-
-
Method Detail
-
getValue
public String getValue()
Description copied from interface:ObservableValueReturns the current value of thisObservableValueSpecified by:
getValuein interfaceObservableValue<String>Returns:
The current value
-
getValueSafe
public final String getValueSafe()
Returns usually the value of thisStringExpression. Only if the value isnullan emptyStringis returned instead.Returns:
the value of this
StringExpressionor the emptyString
-
stringExpression
public static StringExpression stringExpression(ObservableValue<?> value)
Returns aStringExpressionthat wraps aObservableValue. If theObservableValueis already aStringExpression, it will be returned. Otherwise a newStringBindingis created that holds the value of theObservableValueconverted to aString.Parameters:
value- The sourceObservableValueReturns:
A
StringExpressionthat wraps theObservableValueif necessaryThrows:
NullPointerException- ifvalueisnull
-
concat
public StringExpression concat(Object other)
Returns aStringExpressionthat holds the value of thisStringExpressionconcatenated with anotherObject.If the value of this
StringExpressionchanges, the value of the resultingStringExpressionis updated automatically. Also if the otherObjectis an implementation ofObservableValue, changes in the otherObjectare reflected automatically in the resultingStringExpression.Parameters:
other- the otherObjectReturns:
the new
StringExpression
-
isEqualTo
public BooleanBinding isEqualTo(ObservableStringValue other)
Creates a newBooleanBindingthat holdstrueif this and anotherObservableStringValueare equal.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
isEqualTo
public BooleanBinding isEqualTo(String other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis equal to a constant value.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableStringValue other)
Creates a newBooleanBindingthat holdstrueif this and anotherObservableStringValueare not equal.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
isNotEqualTo
public BooleanBinding isNotEqualTo(String other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis not equal to a constant value.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
isEqualToIgnoreCase
public BooleanBinding isEqualToIgnoreCase(ObservableStringValue other)
Creates a newBooleanBindingthat holdstrueif this and anotherObservableStringValueare equal ignoring case.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the secondObservableStringValueReturns:
the new
BooleanBinding
-
isEqualToIgnoreCase
public BooleanBinding isEqualToIgnoreCase(String other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis equal to a constant value ignoring case.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
isNotEqualToIgnoreCase
public BooleanBinding isNotEqualToIgnoreCase(ObservableStringValue other)
Creates a newBooleanBindingthat holdstrueif this and anotherObservableStringValueare not equal ignoring case.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the secondObservableStringValueReturns:
the new
BooleanBinding
-
isNotEqualToIgnoreCase
public BooleanBinding isNotEqualToIgnoreCase(String other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis not equal to a constant value ignoring case.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
greaterThan
public BooleanBinding greaterThan(ObservableStringValue other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis greater than anotherObservableStringValue.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the secondObservableStringValueReturns:
the new
BooleanBinding
-
greaterThan
public BooleanBinding greaterThan(String other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis greater than a constant value.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
lessThan
public BooleanBinding lessThan(ObservableStringValue other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis less than anotherObservableStringValue.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the secondObservableStringValueReturns:
the new
BooleanBinding
-
lessThan
public BooleanBinding lessThan(String other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis less than a constant value.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(ObservableStringValue other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis greater than or equal to anotherObservableStringValue.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the secondObservableStringValueReturns:
the new
BooleanBinding
-
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(String other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis greater than or equal to a constant value.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(ObservableStringValue other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis less than or equal to anotherObservableStringValue.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the secondObservableStringValueReturns:
the new
BooleanBinding
-
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(String other)
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis less than or equal to a constant value.Note: In this comparison a
Stringthat isnullis considered equal to an emptyString.Parameters:
other- the constant valueReturns:
the new
BooleanBinding
-
isNull
public BooleanBinding isNull()
Returns:
the new
BooleanBinding
-
isNotNull
public BooleanBinding isNotNull()
Returns:
the new
BooleanBinding
-
length
public IntegerBinding length()
Creates a newIntegerBindingthat holds the length of thisStringExpression.Note: If the value of this
StringExpressionisnull, the length is considered to be0.Returns:
the new
IntegerBindingSince:
JavaFX 8.0
-
isEmpty
public BooleanBinding isEmpty()
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis empty.Note: If the value of this
StringExpressionisnull, it is considered to be empty.Returns:
the new
BooleanBindingSince:
JavaFX 8.0
-
isNotEmpty
public BooleanBinding isNotEmpty()
Creates a newBooleanBindingthat holdstrueif thisStringExpressionis not empty.Note: If the value of this
StringExpressionisnull, it is considered to be empty.Returns:
the new
BooleanBindingSince:
JavaFX 8.0
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.