public class TrimExpressionStateObject extends AbstractSingleEncapsulatedExpressionStateObject
TRIM
function trims the specified character from a string. If the
character to be trimmed is not specified, it is assumed to be space (or blank). The optional
trim_character
is a single-character string literal or a character-valued input
parameter (i.e., char or Character
). If a trim specification is not provided,
BOTH
is assumed. The TRIM
function returns the trimmed
string.
expression ::= TRIM([[trim_specification] [trim_character] FROM] string_primary)
TrimExpression
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HAS_FROM_PROPERTY
Notifies the visibility of the
FROM identifier has changed. |
static java.lang.String |
SPECIFICATION_PROPERTY
Notifies the specification property has changed.
|
static java.lang.String |
TRIM_CHARACTER_PROPERTY
Notify the state object representing the trim character has changed.
|
STATE_OBJECT_PROPERTY
Constructor and Description |
---|
TrimExpressionStateObject(StateObject parent)
Creates a new
TrimExpressionStateObject . |
TrimExpressionStateObject(StateObject parent,
java.lang.String jpqlFragment)
Creates a new
TrimExpressionStateObject . |
TrimExpressionStateObject(StateObject parent,
TrimExpression.Specification specification,
StateObject stateObject)
Creates a new
TrimExpressionStateObject . |
TrimExpressionStateObject(StateObject parent,
TrimExpression.Specification specification,
StateObject trimCharacter,
StateObject stateObject)
Creates a new
TrimExpressionStateObject . |
Modifier and Type | Method and Description |
---|---|
void |
accept(StateObjectVisitor visitor)
Visits this
StateObject by the given visitor . |
TrimExpression |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
java.lang.String |
getIdentifier()
Returns the JPQL identifier of the expression represented by this
AbstractSingleEncapsulatedExpressionStateObject . |
TrimExpression.Specification |
getSpecification()
Returns the new trim specification.
|
StateObject |
getTrimCharacter()
Returns the
StateObject representing the trim character. |
boolean |
hasSpecification()
Determines whether the way the trim is trimmed was parsed.
|
boolean |
hasTrimCharacter()
Determines whether the character used to trim the string was specified.
|
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. |
void |
parse(java.lang.String jpqlFragment)
Parses the given JPQL fragment, which represents the encapsulated expression, and creates the
StateObject . |
void |
parseTrimCharacter(java.lang.CharSequence jpqlFragment)
Parses the given JPQL fragment, which represents either a single-character string literal or a
character-valued input parameter, the fragment will be parsed and converted into a
StateObject . |
void |
removeSpecification()
Removes the trim specification.
|
void |
removeTrimCharacter()
Removes the trim character if it is defined.
|
void |
setExpression(TrimExpression expression)
Keeps a reference of the
parsed object object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects . |
void |
setSpecification(TrimExpression.Specification specification)
Sets the new trim specification.
|
void |
setStateObject(StateObject stateObject)
Sets the given
StateObject to represent the new encapsulated expression. |
void |
setTrimCharacter(StateObject trimCharacter)
Sets the character to trim from the string.
|
getStateObject, hasStateObject
addPropertyChangeListener, children, decorate, equals, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, removePropertyChangeListener, setExpression, setParent, toString, toString, toText
public static final java.lang.String HAS_FROM_PROPERTY
FROM
identifier has changed.public static final java.lang.String SPECIFICATION_PROPERTY
public static final java.lang.String TRIM_CHARACTER_PROPERTY
public TrimExpressionStateObject(StateObject parent)
TrimExpressionStateObject
.parent
- The parent of this state object, which cannot be null
java.lang.NullPointerException
- The given parent cannot be null
public TrimExpressionStateObject(StateObject parent, TrimExpression.Specification specification, StateObject stateObject)
TrimExpressionStateObject
.parent
- The parent of this state object, which cannot be null
stateObject
- The StateObject
representing the encapsulated expressionspecification
- Defines the way the string is trimmed, or Specification.DEFAULT
when it is not presentjava.lang.NullPointerException
- The given parent cannot be null
public TrimExpressionStateObject(StateObject parent, TrimExpression.Specification specification, StateObject trimCharacter, StateObject stateObject)
TrimExpressionStateObject
.parent
- The parent of this state object, which cannot be null
specification
- Defines the way the string is trimmed, or Specification.DEFAULT
when it is not presenttrimCharacter
- The trim characterstateObject
- The StateObject
representing the encapsulated expressionjava.lang.NullPointerException
- The given parent cannot be null
public TrimExpressionStateObject(StateObject parent, java.lang.String jpqlFragment)
TrimExpressionStateObject
.parent
- The parent of this state object, which cannot be null
jpqlFragment
- The portion of the query representing the encapsulated expressionjava.lang.NullPointerException
- The given parent cannot be null
public void accept(StateObjectVisitor visitor)
StateObject
by the given visitor
.visitor
- The visitor
to visit this objectpublic TrimExpression getExpression()
StateObject
representation of the JPQL query
was created by parsing an existing JPQL query.getExpression
in interface StateObject
getExpression
in class AbstractSingleEncapsulatedExpressionStateObject
StateObject
or null
when the JPQL query is manually created (i.e. not from a string)public java.lang.String getIdentifier()
AbstractSingleEncapsulatedExpressionStateObject
.getIdentifier
in class AbstractEncapsulatedExpressionStateObject
public TrimExpression.Specification getSpecification()
null
public StateObject getTrimCharacter()
StateObject
representing the trim character.StateObject
representing the trim character or null
if it is
not presentpublic boolean hasSpecification()
true
if the query contained the way the trim needs to be trimmed;
false
otherwisepublic boolean hasTrimCharacter()
true
if the character used for trimming was specified; false
otherwisepublic boolean isEquivalent(StateObject stateObject)
StateObject
is equivalent to this one, i.e. the
information of both StateObject
is the same.isEquivalent
in interface StateObject
isEquivalent
in class AbstractSingleEncapsulatedExpressionStateObject
stateObject
- The StateObject
to compare its content to this onetrue
if both object are equivalent; false
otherwisepublic void parse(java.lang.String jpqlFragment)
StateObject
.parse
in class AbstractSingleEncapsulatedExpressionStateObject
jpqlFragment
- The portion of the query representing the encapsulated expressionpublic void parseTrimCharacter(java.lang.CharSequence jpqlFragment)
StateObject
.jpqlFragment
- The portion of the query to parsepublic void removeSpecification()
public void removeTrimCharacter()
public void setExpression(TrimExpression expression)
parsed object
object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects
.expression
- The parsed object
representing a TRIM
expressionpublic void setSpecification(TrimExpression.Specification specification)
specification
- The new trim specification; null
is not validpublic void setStateObject(StateObject stateObject)
StateObject
to represent the new encapsulated expression.stateObject
- The new encapsulated StateObject
public void setTrimCharacter(StateObject trimCharacter)
Character
).trimCharacter
- The trim character or null
to remove itEclipseLink 2.6.3, "build v20160428-59c81c5" API Reference