本文整理汇总了Java中liquibase.util.StringUtils.splitAndTrim方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.splitAndTrim方法的具体用法?Java StringUtils.splitAndTrim怎么用?Java StringUtils.splitAndTrim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类liquibase.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.splitAndTrim方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateAlterStatement
import liquibase.util.StringUtils; //导入方法依赖的package包/类
@Override
public String generateAlterStatement(Database database) {
StringBuilder alter = new StringBuilder();
alter.append("ADD ");
if (StringUtil.isNotEmpty(getConstraintName())) {
alter.append("CONSTRAINT ");
alter.append(database.escapeConstraintName(getConstraintName()));
alter.append(" ");
}
alter.append("UNIQUE (");
List<String> columns = StringUtils.splitAndTrim(getColumnNames(), ",");
if (columns == null) columns = Collections.emptyList();
alter.append(database.escapeColumnNameList(StringUtils.join(columns, ", ")));
alter.append(")");
return alter.toString();
}
示例2: generateSql
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public Sql[] generateSql(DropIndexStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
List<String> associatedWith = StringUtils.splitAndTrim(statement.getAssociatedWith(), ",");
if (associatedWith != null) {
if (associatedWith.contains(Index.MARK_PRIMARY_KEY)|| associatedWith.contains(Index.MARK_UNIQUE_CONSTRAINT)) {
return new Sql[0];
} else if (associatedWith.contains(Index.MARK_FOREIGN_KEY) ) {
if (!(database instanceof OracleDatabase || database instanceof MSSQLDatabase)) {
return new Sql[0];
}
}
}
String schemaName = statement.getTableSchemaName();
if (database instanceof MySQLDatabase) {
return new Sql[] {new UnparsedSql("DROP INDEX " + database.escapeIndexName(null, statement.getIndexName()) + " ON " + database.escapeTableName(schemaName, statement.getTableName())) };
} else if (database instanceof MSSQLDatabase) {
return new Sql[] {new UnparsedSql("DROP INDEX " + database.escapeTableName(schemaName, statement.getTableName()) + "." + database.escapeIndexName(null, statement.getIndexName())) };
} else if (database instanceof PostgresDatabase) {
return new Sql[]{new UnparsedSql("DROP INDEX " + database.escapeIndexName(schemaName, statement.getIndexName()))};
}
return new Sql[] {new UnparsedSql("DROP INDEX " + database.escapeIndexName(schemaName, statement.getIndexName())) };
}
示例3: calculateCheckSum
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public final CheckSum calculateCheckSum(final String changeSetIdentifier) throws LiquibaseException {
if (changeSetIdentifier == null) {
throw new LiquibaseException(new IllegalArgumentException("changeSetIdentifier"));
}
final List<String> parts = StringUtils.splitAndTrim(changeSetIdentifier, "::");
if (parts == null || parts.size() < 3) {
throw new LiquibaseException(new IllegalArgumentException("Invalid changeSet identifier: " + changeSetIdentifier));
}
return this.calculateCheckSum(parts.get(0), parts.get(1), parts.get(2));
}
示例4: generateAlterStatement
import liquibase.util.StringUtils; //导入方法依赖的package包/类
@Override
public String generateAlterStatement(Database database) {
StringBuilder alter = new StringBuilder();
alter.append("ADD CONSTRAINT ");
if (StringUtil.isNotEmpty(getConstraintName())) {
alter.append(database.escapeConstraintName(getConstraintName())).append(" ");
}
alter.append("FOREIGN KEY ");
alter.append("(");
List<String> baseColumns = StringUtils.splitAndTrim(getBaseColumnNames(), ",");
if (baseColumns == null) baseColumns = Collections.emptyList();
alter.append(database.escapeColumnNameList(StringUtils.join(baseColumns, ", ")));
alter.append(") ");
alter.append("REFERENCES ");
String referencedTable = PerconaChangeUtil.resolveReferencedPerconaTableName(getBaseTableName(), getReferencedTableName());
alter.append(database.escapeTableName(getReferencedTableCatalogName(), getReferencedTableSchemaName(), referencedTable)).append(" ");
alter.append("(");
List<String> referencedColumns = StringUtils.splitAndTrim(getReferencedColumnNames(), ",");
if (referencedColumns == null) referencedColumns = Collections.emptyList();
alter.append(database.escapeColumnNameList(StringUtils.join(referencedColumns, ", ")));
alter.append(")");
if (getOnDelete() != null) {
alter.append(" ON DELETE ").append(getOnDelete());
}
if (getOnUpdate() != null) {
alter.append(" ON UPDATE ").append(getOnUpdate());
}
if (getDeferrable() != null && getDeferrable()) {
alter.append(" DEFERRABLE");
}
if (getInitiallyDeferred() != null && getInitiallyDeferred()) {
alter.append(" INITIALLY DEFERRED");
}
return alter.toString();
}
示例5: generateSql
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public Sql[] generateSql(CreateIndexStatement statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
// Default filter of index creation:
// creation of all indexes with associations are switched off.
List<String> associatedWith = StringUtils.splitAndTrim(statement.getAssociatedWith(), ",");
if (associatedWith != null && (associatedWith.contains(Index.MARK_PRIMARY_KEY) ||
associatedWith.contains(Index.MARK_UNIQUE_CONSTRAINT) ||
associatedWith.contains(Index.MARK_FOREIGN_KEY))) {
return new Sql[0];
}
StringBuilder buffer = new StringBuilder();
buffer.append("CREATE ");
if (statement.isUnique() != null && statement.isUnique()) {
buffer.append("UNIQUE ");
}
buffer.append("INDEX ");
if (statement.getIndexName() != null) {
String indexSchema = statement.getTableSchemaName();
buffer.append(database.escapeIndexName(null, statement.getIndexName())).append(" ");
}
buffer.append("ON ");
buffer.append(database.escapeTableName(statement.getTableSchemaName(), statement.getTableName())).append("(");
Iterator<String> iterator = Arrays.asList(statement.getColumns()).iterator();
while (iterator.hasNext()) {
String column = iterator.next();
buffer.append(database.escapeColumnName(statement.getTableSchemaName(), statement.getTableName(), column));
if (iterator.hasNext()) {
buffer.append(", ");
}
}
buffer.append(")");
if (StringUtils.trimToNull(statement.getTablespace()) != null && database.supportsTablespaces()) {
if (database instanceof MSSQLDatabase || database instanceof SybaseASADatabase) {
buffer.append(" ON ").append(statement.getTablespace());
} else if (database instanceof DB2Database || database instanceof InformixDatabase) {
buffer.append(" IN ").append(statement.getTablespace());
} else {
buffer.append(" TABLESPACE ").append(statement.getTablespace());
}
}
return new Sql[]{new UnparsedSql(buffer.toString())};
}
示例6: ChangeLogParameter
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public ChangeLogParameter(String key, Object value, String validContexts, String validDatabases) {
this(key, value, StringUtils.splitAndTrim(validContexts, ","), StringUtils.splitAndTrim(validDatabases, ","));
}
示例7: setOs
import liquibase.util.StringUtils; //导入方法依赖的package包/类
public void setOs(String os) {
this.os = StringUtils.splitAndTrim(os, ",");
}