- java.lang.Object
-
- javafx.beans.binding.StringExpression
-
- All Implemented Interfaces:
Observable
,ObservableObjectValue<String>
,ObservableStringValue
,ObservableValue<String>
- Direct Known Subclasses:
ReadOnlyStringProperty
,StringBinding
public abstract class StringExpression extends Object implements ObservableStringValue
StringExpression
is anObservableStringValue
plus additional convenience methods to generate bindings in a fluent style.A concrete sub-class of
StringExpression
has to implement the methodObservableObjectValue.get()
, which provides the actual value of this expression.Note: all implementation of
BooleanBinding
returned by the comparisons in this class consider aString
that isnull
equal to an emptyString
.- Since:
- JavaFX 2.0
-
-
Constructor Summary
Constructors Constructor Description StringExpression()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringExpression
concat(Object other)
Returns aStringExpression
that holds the value of thisStringExpression
concatenated with anotherObject
.String
getValue()
Returns the current value of thisObservableValue
String
getValueSafe()
Returns usually the value of thisStringExpression
.BooleanBinding
greaterThan(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is greater than a constant value.BooleanBinding
greaterThan(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is greater than anotherObservableStringValue
.BooleanBinding
greaterThanOrEqualTo(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is greater than or equal to a constant value.BooleanBinding
greaterThanOrEqualTo(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is greater than or equal to anotherObservableStringValue
.BooleanBinding
isEmpty()
BooleanBinding
isEqualTo(String other)
BooleanBinding
isEqualTo(ObservableStringValue other)
BooleanBinding
isEqualToIgnoreCase(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is equal to a constant value ignoring case.BooleanBinding
isEqualToIgnoreCase(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableStringValue
are equal ignoring case.BooleanBinding
isNotEmpty()
BooleanBinding
isNotEqualTo(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is not equal to a constant value.BooleanBinding
isNotEqualTo(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableStringValue
are not equal.BooleanBinding
isNotEqualToIgnoreCase(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is not equal to a constant value ignoring case.BooleanBinding
isNotEqualToIgnoreCase(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableStringValue
are not equal ignoring case.BooleanBinding
isNotNull()
BooleanBinding
isNull()
IntegerBinding
length()
Creates a newIntegerBinding
that holds the length of thisStringExpression
.BooleanBinding
lessThan(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is less than a constant value.BooleanBinding
lessThan(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is less than anotherObservableStringValue
.BooleanBinding
lessThanOrEqualTo(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is less than or equal to a constant value.BooleanBinding
lessThanOrEqualTo(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is less than or equal to anotherObservableStringValue
.static StringExpression
stringExpression(ObservableValue<?> value)
Returns aStringExpression
that 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.Observable
addListener, removeListener
-
Methods inherited from interface javafx.beans.value.ObservableObjectValue
get
-
Methods inherited from interface javafx.beans.value.ObservableValue
addListener, removeListener
-
-
-
-
Method Detail
-
getValue
public String getValue()
Description copied from interface:ObservableValue
Returns the current value of thisObservableValue
- Specified by:
getValue
in interfaceObservableValue<String>
- Returns:
- The current value
-
getValueSafe
public final String getValueSafe()
Returns usually the value of thisStringExpression
. Only if the value isnull
an emptyString
is returned instead.- Returns:
- the value of this
StringExpression
or the emptyString
-
stringExpression
public static StringExpression stringExpression(ObservableValue<?> value)
Returns aStringExpression
that wraps aObservableValue
. If theObservableValue
is already aStringExpression
, it will be returned. Otherwise a newStringBinding
is created that holds the value of theObservableValue
converted to aString
.- Parameters:
value
- The sourceObservableValue
- Returns:
- A
StringExpression
that wraps theObservableValue
if necessary - Throws:
NullPointerException
- ifvalue
isnull
-
concat
public StringExpression concat(Object other)
Returns aStringExpression
that holds the value of thisStringExpression
concatenated with anotherObject
.If the value of this
StringExpression
changes, the value of the resultingStringExpression
is updated automatically. Also if the otherObject
is an implementation ofObservableValue
, changes in the otherObject
are reflected automatically in the resultingStringExpression
.- Parameters:
other
- the otherObject
- Returns:
- the new
StringExpression
-
isEqualTo
public BooleanBinding isEqualTo(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableStringValue
are equal.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isEqualTo
public BooleanBinding isEqualTo(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is equal to a constant value.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableStringValue
are not equal.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isNotEqualTo
public BooleanBinding isNotEqualTo(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is not equal to a constant value.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isEqualToIgnoreCase
public BooleanBinding isEqualToIgnoreCase(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableStringValue
are equal ignoring case.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the secondObservableStringValue
- Returns:
- the new
BooleanBinding
-
isEqualToIgnoreCase
public BooleanBinding isEqualToIgnoreCase(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is equal to a constant value ignoring case.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
isNotEqualToIgnoreCase
public BooleanBinding isNotEqualToIgnoreCase(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if this and anotherObservableStringValue
are not equal ignoring case.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the secondObservableStringValue
- Returns:
- the new
BooleanBinding
-
isNotEqualToIgnoreCase
public BooleanBinding isNotEqualToIgnoreCase(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is not equal to a constant value ignoring case.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThan
public BooleanBinding greaterThan(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is greater than anotherObservableStringValue
.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the secondObservableStringValue
- Returns:
- the new
BooleanBinding
-
greaterThan
public BooleanBinding greaterThan(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is greater than a constant value.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThan
public BooleanBinding lessThan(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is less than anotherObservableStringValue
.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the secondObservableStringValue
- Returns:
- the new
BooleanBinding
-
lessThan
public BooleanBinding lessThan(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is less than a constant value.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is greater than or equal to anotherObservableStringValue
.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the secondObservableStringValue
- Returns:
- the new
BooleanBinding
-
greaterThanOrEqualTo
public BooleanBinding greaterThanOrEqualTo(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is greater than or equal to a constant value.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- the new
BooleanBinding
-
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(ObservableStringValue other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is less than or equal to anotherObservableStringValue
.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the secondObservableStringValue
- Returns:
- the new
BooleanBinding
-
lessThanOrEqualTo
public BooleanBinding lessThanOrEqualTo(String other)
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is less than or equal to a constant value.Note: In this comparison a
String
that isnull
is considered equal to an emptyString
.- Parameters:
other
- the constant value- Returns:
- 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 newIntegerBinding
that holds the length of thisStringExpression
.Note: If the value of this
StringExpression
isnull
, the length is considered to be0
.- Returns:
- the new
IntegerBinding
- Since:
- JavaFX 8.0
-
isEmpty
public BooleanBinding isEmpty()
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is empty.Note: If the value of this
StringExpression
isnull
, it is considered to be empty.- Returns:
- the new
BooleanBinding
- Since:
- JavaFX 8.0
-
isNotEmpty
public BooleanBinding isNotEmpty()
Creates a newBooleanBinding
that holdstrue
if thisStringExpression
is not empty.Note: If the value of this
StringExpression
isnull
, it is considered to be empty.- Returns:
- the new
BooleanBinding
- Since:
- JavaFX 8.0
-
-