Package org.apache.cayenne.exp.property
Class StringProperty<E extends CharSequence>
java.lang.Object
org.apache.cayenne.exp.property.BaseProperty<E>
org.apache.cayenne.exp.property.StringProperty<E>
- All Implemented Interfaces:
- ComparableProperty<E>,- Property<E>
public class StringProperty<E extends CharSequence>
extends BaseProperty<E>
implements ComparableProperty<E>
Property that represents attributes mapped on string types
 
 String type is an any type inherited from CharSequence.
 
 Provides basic string functions like like(String), concat(Object...), upper()
 and contains(String)}.
 
Example:
 ObjectSelect.query(Artist.class)
      .where(Artist.FIRST_NAME.trim().concat(Artist.LAST_NAME.trim()).length().gt(30))
 - Since:
- 4.2
- See Also:
- 
Field SummaryFields inherited from class org.apache.cayenne.exp.property.BasePropertyexpressionSupplier, path, type
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedStringProperty(CayennePath path, Expression expression, Class<E> type) Constructs a new property with the given name and expression
- 
Method SummaryModifier and TypeMethodDescriptionCreates alias with different name for this propertyArguments will be converted as follows: if argument is aBasePropertythan its expression will be used if argument is aExpressionthan it will be used as is all other values will be converted to StringCreates an expression for a database "LIKE" query with the value converted to a pattern matching anywhere in the String.containsIgnoreCase(String value) Same ascontains(String), only using case-insensitive comparison.This operator allows to access properties of the enclosing query from the subquery.Creates an expression for a database "LIKE" query with the value converted to a pattern matching the tail of a String.endsWithIgnoreCase(String value) Same asendsWith(String), only using case-insensitive comparison.length()like(StringProperty<?> pattern) likeIgnoreCase(String pattern) likeIgnoreCase(StringProperty<?> pattern) locate(StringProperty<? extends String> property) lower()nlike(StringProperty<?> value) nlikeIgnoreCase(String value) nlikeIgnoreCase(StringProperty<?> value) startsWith(String value) Creates an expression for a database "LIKE" query with the value converted to a pattern matching the beginning of a String.startsWithIgnoreCase(String value) Same asstartsWith(String), only using case-insensitive comparison.substring(int offset, int length) substring(NumericProperty<?> offset, NumericProperty<?> length) trim()upper()Methods inherited from class org.apache.cayenne.exp.property.BasePropertyaggregate, asc, ascInsensitive, ascInsensitives, ascs, count, countDistinct, desc, descInsensitive, descInsensitives, descs, eq, eq, equals, function, function, getAlias, getExpression, getFrom, getFromAll, getName, getPath, getType, hashCode, in, in, in, isFalse, isNotNull, isNull, isTrue, ne, ne, nin, nin, nin, operator, operator, setIn, setInAllMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
StringPropertyConstructs a new property with the given name and expression- Parameters:
- path- of the property (will be used as alias for the expression)
- expression- expression for property
- type- of the property
- See Also:
 
 
- 
- 
Method Details- 
like- Parameters:
- pattern- a pattern matching property value. Pattern may include "_" and "%" wildcard symbols to match any single character or a sequence of characters. To prevent "_" and "%" from being treated as wildcards, they need to be escaped and escape char passed with- like(String, char)method.
- Returns:
- An expression for a Database "LIKE" query.
 
- 
like- Parameters:
- pattern- a pattern matching property value. Pattern may include "_" and "%" wildcard symbols to match any single character or a sequence of characters.
- Returns:
- An expression for a Database "LIKE" query.
 
- 
like- Parameters:
- pattern- a properly escaped pattern matching property value. Pattern may include "_" and "%" wildcard symbols to match any single character or a sequence of characters.
- escapeChar- an escape character used in the pattern to escape "%" and "_".
- Returns:
- An expression for a Database "LIKE" query.
 
- 
likeIgnoreCase- Returns:
- An expression for a case insensitive "LIKE" query.
 
- 
likeIgnoreCase- Returns:
- An expression for a case insensitive "LIKE" query.
 
- 
nlike- Returns:
- An expression for a Database "NOT LIKE" query.
 
- 
nlike- Returns:
- An expression for a Database "NOT LIKE" query.
 
- 
nlikeIgnoreCase- Returns:
- An expression for a case insensitive "NOT LIKE" query.
 
- 
nlikeIgnoreCase- Returns:
- An expression for a case insensitive "NOT LIKE" query.
 
- 
containsCreates an expression for a database "LIKE" query with the value converted to a pattern matching anywhere in the String.- Parameters:
- substring- a String to match against property value. "_" and "%" symbols are NOT treated as wildcards and are escaped when converted to a LIKE expression.
- Returns:
- a newly created expression.
 
- 
startsWithCreates an expression for a database "LIKE" query with the value converted to a pattern matching the beginning of a String.- Parameters:
- value- a String to match against property value. "_" and "%" symbols are NOT treated as wildcards and are escaped when converted to a LIKE expression.
- Returns:
- a newly created expression.
 
- 
endsWithCreates an expression for a database "LIKE" query with the value converted to a pattern matching the tail of a String.- Parameters:
- value- a String to match against property value. "_" and "%" symbols are NOT treated as wildcards and are escaped when converted to a LIKE expression.
- Returns:
- a newly created expression.
 
- 
containsIgnoreCaseSame ascontains(String), only using case-insensitive comparison.
- 
startsWithIgnoreCaseSame asstartsWith(String), only using case-insensitive comparison.
- 
endsWithIgnoreCaseSame asendsWith(String), only using case-insensitive comparison.
- 
length
- 
locate
- 
locate
- 
trim
- 
upper
- 
lower
- 
concatArguments will be converted as follows: - if argument is a BasePropertythan its expression will be used
- if argument is a Expressionthan it will be used as is
- all other values will be converted to String
 Usage: Property<String> fullName = Artist.FIRST_NAME.concat(" ", Artist.SECOND_NAME);
- if argument is a 
- 
substring
- 
substring
- 
aliasCreates alias with different name for this property- Overrides:
- aliasin class- BaseProperty<E extends CharSequence>
 
- 
enclosingDescription copied from class:BasePropertyThis operator allows to access properties of the enclosing query from the subquery. It allows multiple nesting levels to access a corresponding query in case of multiple levels of subqueries. Example:ObjectSelect.query(Artist.class) .where(ExpressionFactory.notExists(ObjectSelect.query(Painting.class) .where(Painting.TO_ARTIST.eq(Artist.ARTIST_ID_PK_PROPERTY.enclosing()))))- Overrides:
- enclosingin class- BaseProperty<E extends CharSequence>
- Returns:
- property that will be translated relative to a parent query
 
 
-