@FunctionalInterface public interface NamingStrategy
Provides various convenience methods for chaining several
implementations. For example if the Java name of your stored procedure
is "blitz" but the SQL name is "sp_Blitz" then you can
create this transformation using:
NamingStrategy.capitalize() // converts "blitz" to "Blitz"
.thenPrefix("sp_") // converts "Blitz" to "sp_Blitz"
| Modifier and Type | Field and Description |
|---|---|
static NamingStrategy |
IDENTITY
The identity transformation.
|
| Modifier and Type | Method and Description |
|---|---|
static NamingStrategy |
capitalize()
Creates a new transformation that converts the first character to
upper case.
|
static NamingStrategy |
lowerCase()
Creates a new transformation that converts the entire string to lower case.
|
static NamingStrategy |
prefix(String prefix)
Creates a new transformation that applies a prefix to the string.
|
static NamingStrategy |
snakeCase()
Creates a new transformation that converts the entire string to
snake case.
|
default NamingStrategy |
then(NamingStrategy next)
Applies another transformation after the current transformation.
|
default NamingStrategy |
thenCapitalize()
Applies an upper case transformation of the first character after the
current transformation.
|
default NamingStrategy |
thenLowerCase()
Applies a lower case transformation of the entire string after the current transformation.
|
default NamingStrategy |
thenPrefix(String prefix)
Appends a prefix after the current transformation.
|
default NamingStrategy |
thenSnakeCase()
Applies snake case
after the current transformation.
|
default NamingStrategy |
thenUpperCase()
Applies a upper case transformation of the entire string after the current transformation.
|
default NamingStrategy |
thenWithoutFirst(int skipped)
Skips a number of characters from the start of the name after the current
transformation.
|
String |
translateToDatabase(String javaName)
Derives a database name of an object from the Java name of an object.
|
static NamingStrategy |
upperCase()
Creates a new transformation that converts the entire string to upper case.
|
static NamingStrategy |
withoutFirst(int skipped)
Creates a new transformation that skips a given number of characters
from the start of the java name.
|
static final NamingStrategy IDENTITY
String translateToDatabase(String javaName)
javaName - the Java name of an object, never nullnullstatic NamingStrategy upperCase()
Only works reliably for characters from the US-ASCII latin alphabet.
static NamingStrategy lowerCase()
Only works reliably for characters from the US-ASCII latin alphabet.
static NamingStrategy capitalize()
Only works for characters from the US-ASCII latin alphabet.
static NamingStrategy snakeCase()
For example turns "procedureName" into "procedure_Name".
No case conversion is done so you'll likely want to combine this with
either thenUpperCase() or thenLowerCase().
static NamingStrategy prefix(String prefix)
prefix - the prefix to append, not nullstatic NamingStrategy withoutFirst(int skipped)
skipped - the number of characters from the startdefault NamingStrategy then(NamingStrategy next)
next - the transformation to apply after the current one, not nulldefault NamingStrategy thenUpperCase()
Only works reliably for characters from the US-ASCII latin alphabet.
default NamingStrategy thenLowerCase()
Only works reliably for characters from the US-ASCII latin alphabet.
default NamingStrategy thenCapitalize()
Only works for characters from the US-ASCII latin alphabet.
default NamingStrategy thenSnakeCase()
For example turns "procedureName" into "procedure_Name".
No case conversion is done so you'll likely want to combine this with
either thenUpperCase() or thenLowerCase().
default NamingStrategy thenPrefix(String prefix)
prefix - the prefix to append, not nulldefault NamingStrategy thenWithoutFirst(int skipped)
skipped - the number of characters from the startskipped characters after the current transformationCopyright © 2013–2016. All rights reserved.