Interface SqlIdentifier
- All Superinterfaces:
Iterable<SqlIdentifier>,Streamable<SqlIdentifier>,Supplier<Stream<SqlIdentifier>>
name with specifying whether the name should be quoted or unquoted.
SqlIdentifier renders its name using IdentifierProcessing rules. Use getReference() to refer
to an object using the identifier when e.g. obtaining values from a result or providing values for a prepared
statement. toSql(IdentifierProcessing) renders the identifier for SQL statement usage.
SqlIdentifier objects are immutable. Calling transformational methods such as
transform(UnaryOperator) creates a new instance.
SqlIdentifier are composable so an identifier may consist of a single identifier part or can be composed from
multiple parts. Composed identifier can be traversed with Streamable.stream() or Iterable.iterator(). The iteration
order depends on the actual composition ordering.
- Since:
- 2.0
- Author:
- Jens Schauder, Mark Paluch, Kurt Niemi
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SqlIdentifierfrom(SqlIdentifier... sqlIdentifiers) Create a new compositeSqlIdentifierfrom one or moreSqlIdentifiers.default StringThe reference name is used for programmatic access to the object identified by thisSqlIdentifier.static SqlIdentifierCreate a new quoted identifier givenname.toSql(IdentifierProcessing processing) Use this method when rendering an identifier in SQL statements as in:transform(UnaryOperator<String> transformationFunction) Transform the SQL identifier name by applying atransformation function.static SqlIdentifierCreate a new unquoted identifier givenname.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Field Details
-
EMPTY
Null-object.
-
-
Method Details
-
getReference
The reference name is used for programmatic access to the object identified by thisSqlIdentifier. Use this method whenever accessing a column in a ResultSet and we do not want any quoting applied.- Returns:
- the string representation of the identifier, which may be used to access columns in a
ResultSet - See Also:
-
toSql
Use this method when rendering an identifier in SQL statements as in:select yourColumn from someTableIdentifierProcessingrules are applied to the identifier.- Parameters:
processing- identifier processing rules.- Returns:
-
transform
Transform the SQL identifier name by applying atransformation function. The transformation function must return a valid, non-null identifierString.- Parameters:
transformationFunction- the transformation function. Must return a non-null identifierString.- Returns:
- a new
SqlIdentifierwith the transformation applied.
-
quoted
Create a new quoted identifier givenname.- Parameters:
name- the identifier.- Returns:
- a new quoted identifier given
name.
-
unquoted
Create a new unquoted identifier givenname.- Parameters:
name- the identifier.- Returns:
- a new unquoted identifier given
name.
-
from
Create a new compositeSqlIdentifierfrom one or moreSqlIdentifiers.Composite identifiers do not allow
transform(UnaryOperator)transformation.- Parameters:
sqlIdentifiers- the elements of the new identifier.- Returns:
- the new composite identifier.
-