Package liquibase.util
Class StringClauses
java.lang.Object
liquibase.util.StringClauses
Defines a list of clauses that can be manipulated and rearranged based on keys associated with each.
On
Note: all keys and values passed in are trimmed.
NOTE: All keys are managed in a case INSENSITIVE manner
NOTE: Null or empty clauses and subclauses are skipped in
toString()
, the clauses will be joined by the separator passed at construction time and prepended/postpended by the start/end strings set at construction time.
Note: all keys and values passed in are trimmed.
NOTE: All keys are managed in a case INSENSITIVE manner
NOTE: Null or empty clauses and subclauses are skipped in
toString()
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static interface
static class
-
Constructor Summary
ConstructorDescriptionCreates a new StringClause with no start or end strings and a space separator.StringClauses
(String separator) Creates a new StringClause with no start or end strings and the given separator.StringClauses
(String start, String separator, String end) Creates a new StringClause with the given start, end and separator. -
Method Summary
Modifier and TypeMethodDescriptionConvenience method forappend(String, String)
when using enums.append
(Enum name, StringClauses subclauses) Convenience method forappend(String, StringClauses)
when using enums.Adds a new clause at the end of the list.Adds a new clause at the end of the list with the given key.append
(String key, StringClauses subclauses) Adds a new sub-clause at the end of the list with the given key.append
(StringClauses.LiteralClause literal) boolean
boolean
Convenience method forget(String)
when using enums.Retrieves the given key.getSubclause
(Enum exitingKey) Convenience method forgetSubclause(String)
when using enumsgetSubclause
(String exitingKey) Retrieves the given key.int
hashCode()
insertAfter
(Enum existingKey, String newValue) Convenience method forinsertAfter(String, String)
when using enumsinsertAfter
(String existingKey, String newValue) Convenience method forinsertAfter(String, String, String)
using the newValue as the newKey.insertAfter
(String existingKey, String newKey, String newValue) Inserts a new clause after the given key.insertAfter
(String existingKey, String newKey, StringClauses newValue) Inserts a new sub-clause after the given key.insertBefore
(Enum existingKey, Enum newKey, String newValue) Convenience method forinsertBefore(String, String)
when using enums.insertBefore
(Enum existingKey, String newValue) Convenience method forinsertBefore(String, String)
when using enums.insertBefore
(String existingKey, String newValue) Convenience method forinsertBefore(String, String, String)
where the new clause key is equal to the newValue.insertBefore
(String existingKey, String newKey, String newValue) Inserts a new clause before the given key.insertBefore
(String existingKey, String newKey, StringClauses newValue) Inserts a new sub-clause before the given key.boolean
isEmpty()
Convenience method forprepend(String, String)
when using enumsprepend
(Enum key, StringClauses clause) Convenience method forprepend(String, liquibase.util.StringClauses)
when using enumsConvenience method forprepend(String, String)
that uses the clause as the key.Adds a clause with the given key to the beginning of the list.prepend
(String key, StringClauses clause) Adds a sub-clause with the given key to the beginning of the list.prepend
(StringClauses.LiteralClause literal) Convenience method forremove(String)
when using enums.Removes the clause with the given key.Convenience method forreplace(String, String)
when using enums.replace
(Enum key, StringClauses newValue) Convenience method forreplace(String, liquibase.util.StringClauses)
when using enums.Replaces the given key with a new string.replace
(String key, StringClauses newValue) Replaces the given key with a new sub-clause.Object[]
toArray
(boolean stringify) toString()
-
Constructor Details
-
StringClauses
public StringClauses()Creates a new StringClause with no start or end strings and a space separator. -
StringClauses
Creates a new StringClause with no start or end strings and the given separator. -
StringClauses
Creates a new StringClause with the given start, end and separator.
-
-
Method Details
-
append
Adds a new clause at the end of the list with the given key. -
append
Adds a new sub-clause at the end of the list with the given key. -
append
Adds a new clause at the end of the list. The key is equal to the passed clause. There is no corresponding append with just a StringClauses because the subclause may not be fully created when appended and so the key may be an unexpected value. -
append
Convenience method forappend(String, StringClauses)
when using enums. -
append
Convenience method forappend(String, String)
when using enums. -
append
-
prepend
-
prepend
Adds a clause with the given key to the beginning of the list. -
prepend
Adds a sub-clause with the given key to the beginning of the list. -
prepend
Convenience method forprepend(String, String)
that uses the clause as the key. -
prepend
Convenience method forprepend(String, String)
when using enums -
prepend
Convenience method forprepend(String, liquibase.util.StringClauses)
when using enums -
remove
Removes the clause with the given key. Removes case insensitively. If key doesn't exist, operation is a no-op. -
remove
Convenience method forremove(String)
when using enums. -
replace
Replaces the given key with a new string. If the existing key does not exist, throws IllegalArgumentException- Throws:
IllegalArgumentException
-
contains
-
replace
Replaces the given key with a new sub-clause. If the existing key does not exist, throws IllegalArgumentException -
replace
Convenience method forreplace(String, liquibase.util.StringClauses)
when using enums. -
replace
Convenience method forreplace(String, String)
when using enums. -
insertBefore
public StringClauses insertBefore(String existingKey, String newKey, String newValue) throws IllegalArgumentException Inserts a new clause before the given key. Throws IllegalArgumentException if the existingKey does not exist.- Throws:
IllegalArgumentException
-
insertBefore
Inserts a new sub-clause before the given key. Throws IllegalArgumentException if the existingKey does not exist. -
insertBefore
Convenience method forinsertBefore(String, String, String)
where the new clause key is equal to the newValue. -
insertBefore
Convenience method forinsertBefore(String, String)
when using enums. -
insertBefore
Convenience method forinsertBefore(String, String)
when using enums. -
insertAfter
Inserts a new clause after the given key. Throws IllegalArgumentException if the existingKey does not exist. -
insertAfter
Inserts a new sub-clause after the given key. Throws IllegalArgumentException if the existingKey does not exist. -
insertAfter
Convenience method forinsertAfter(String, String)
when using enums -
insertAfter
Convenience method forinsertAfter(String, String, String)
using the newValue as the newKey. -
get
Retrieves the given key. Returns null if not set. If clause at key is a StringClause, return the string version of it. Will traverse sub-clauses to find the key. -
get
Convenience method forget(String)
when using enums. -
getSubclause
Retrieves the given key. Returns null if not set. If clause at key is a String, return a new StringClause version of it. Will traverse sub-clauses to find the key. -
getSubclause
Convenience method forgetSubclause(String)
when using enums -
getClauseIterator
-
equals
-
hashCode
public int hashCode() -
toString
-
toArray
-
isEmpty
public boolean isEmpty()
-