signature:
public class ColumnSnapshotGenerator { /** * Processes metadata of a column , e . g . name , type and default value . We start with the result of the JDBC
 * { @ link DatabaseMetaData } . getColumns ( ) method . Depending on Database , additional columns might be present .
 * @ param columnMetadataResultSet the result from the JDBC getColumns ( ) call for the column
 * @ param column logical definition of the column ( object form )
 * @ param database the database from which the column originates
 * @ return a DataType object with detailed information about the type
 * @ throws DatabaseException If an error occurs during processing ( mostly caused by Exceptions in JDBC calls ) */
protected DataType readDataType ( CachedRow columnMetadataResultSet , Column column , Database database ) throws DatabaseException { } }

implementation:
if ( database instanceof OracleDatabase ) { String dataType = columnMetadataResultSet . getString ( "DATA_TYPE_NAME" ) ; dataType = dataType . replace ( "VARCHAR2" , "VARCHAR" ) ; dataType = dataType . replace ( "NVARCHAR2" , "NVARCHAR" ) ; DataType type = new DataType ( dataType ) ; type . setDataTypeId ( columnMetadataResultSet . getInt ( "DATA_TYPE" ) ) ; if ( dataType . equalsIgnoreCase ( "NUMBER" ) ) { type . setColumnSize ( columnMetadataResultSet . getInt ( "DATA_PRECISION" ) ) ; // if ( type . getColumnSize ( ) = = null ) {
// type . setColumnSize ( 38 ) ;
type . setDecimalDigits ( columnMetadataResultSet . getInt ( "DATA_SCALE" ) ) ; // if ( type . getDecimalDigits ( ) = = null ) {
// type . setDecimalDigits ( 0 ) ;
// type . setRadix ( 10 ) ;
} else { type . setColumnSize ( columnMetadataResultSet . getInt ( "DATA_LENGTH" ) ) ; boolean isTimeStampDataType = dataType . toUpperCase ( ) . contains ( "TIMESTAMP" ) ; if ( isTimeStampDataType || dataType . equalsIgnoreCase ( "NCLOB" ) || dataType . equalsIgnoreCase ( "BLOB" ) || dataType . equalsIgnoreCase ( "CLOB" ) ) { type . setColumnSize ( null ) ; } else if ( dataType . equalsIgnoreCase ( "NVARCHAR" ) || dataType . equalsIgnoreCase ( "NCHAR" ) ) { type . setColumnSize ( columnMetadataResultSet . getInt ( "CHAR_LENGTH" ) ) ; type . setColumnSizeUnit ( DataType . ColumnSizeUnit . CHAR ) ; } else { String charUsed = columnMetadataResultSet . getString ( "CHAR_USED" ) ; DataType . ColumnSizeUnit unit = null ; if ( "C" . equals ( charUsed ) ) { unit = DataType . ColumnSizeUnit . CHAR ; type . setColumnSize ( columnMetadataResultSet . getInt ( "CHAR_LENGTH" ) ) ; } else if ( "B" . equals ( charUsed ) ) { unit = DataType . ColumnSizeUnit . BYTE ; } type . setColumnSizeUnit ( unit ) ; } } return type ; } String columnTypeName = ( String ) columnMetadataResultSet . get ( "TYPE_NAME" ) ; if ( database instanceof MSSQLDatabase ) { if ( "numeric() identity" . equalsIgnoreCase ( columnTypeName ) ) { columnTypeName = "numeric" ; } else if ( "decimal() identity" . equalsIgnoreCase ( columnTypeName ) ) { columnTypeName = "decimal" ; } else if ( "xml" . equalsIgnoreCase ( columnTypeName ) ) { columnMetadataResultSet . set ( "COLUMN_SIZE" , null ) ; columnMetadataResultSet . set ( "DECIMAL_DIGITS" , null ) ; } else if ( "datetimeoffset" . equalsIgnoreCase ( columnTypeName ) || "time" . equalsIgnoreCase ( columnTypeName ) ) { columnMetadataResultSet . set ( "COLUMN_SIZE" , columnMetadataResultSet . getInt ( "DECIMAL_DIGITS" ) ) ; columnMetadataResultSet . set ( "DECIMAL_DIGITS" , null ) ; } } if ( database instanceof FirebirdDatabase ) { if ( "BLOB SUB_TYPE 0" . equals ( columnTypeName ) ) { columnTypeName = "BLOB" ; } if ( "BLOB SUB_TYPE 1" . equals ( columnTypeName ) ) { columnTypeName = "CLOB" ; } } if ( ( database instanceof MySQLDatabase ) && ( "ENUM" . equalsIgnoreCase ( columnTypeName ) || "SET" . equalsIgnoreCase ( columnTypeName ) ) ) { try { String boilerLength ; if ( "ENUM" . equalsIgnoreCase ( columnTypeName ) ) { boilerLength = "7" ; } else { // SET
boilerLength = "6" ; } List < String > enumValues = ExecutorService . getInstance ( ) . getExecutor ( database ) . queryForList ( new RawSqlStatement ( "SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING(COLUMN_TYPE, " + boilerLength + ", LENGTH(COLUMN_TYPE) - " + boilerLength + " - 1 ), \"','\", 1 + units.i + tens.i * 10) , \"','\", -1)\n" + "FROM INFORMATION_SCHEMA.COLUMNS\n" + "CROSS JOIN (SELECT 0 AS i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 " + "UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) units\n" + "CROSS JOIN (SELECT 0 AS i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 " + "UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) tens\n" + "WHERE TABLE_NAME = '" + column . getRelation ( ) . getName ( ) + "' \n" + "AND COLUMN_NAME = '" + column . getName ( ) + "'" ) , String . class ) ; String enumClause = "" ; for ( String enumValue : enumValues ) { enumClause += "'" + enumValue + "', " ; } enumClause = enumClause . replaceFirst ( ", $" , "" ) ; return new DataType ( columnTypeName + "(" + enumClause + ")" ) ; } catch ( DatabaseException e ) { Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . warning ( LogType . LOG , "Error fetching enum values" , e ) ; } } DataType . ColumnSizeUnit columnSizeUnit = DataType . ColumnSizeUnit . BYTE ; int dataType = columnMetadataResultSet . getInt ( "DATA_TYPE" ) ; Integer columnSize = null ; Integer decimalDigits = null ; if ( ! database . dataTypeIsNotModifiable ( columnTypeName ) ) { // don ' t set size for types like int4 , int8 etc
columnSize = columnMetadataResultSet . getInt ( "COLUMN_SIZE" ) ; decimalDigits = columnMetadataResultSet . getInt ( "DECIMAL_DIGITS" ) ; if ( ( decimalDigits != null ) && decimalDigits . equals ( 0 ) ) { decimalDigits = null ; } } Integer radix = columnMetadataResultSet . getInt ( "NUM_PREC_RADIX" ) ; Integer characterOctetLength = columnMetadataResultSet . getInt ( "CHAR_OCTET_LENGTH" ) ; if ( database instanceof AbstractDb2Database ) { String typeName = columnMetadataResultSet . getString ( "TYPE_NAME" ) ; if ( ( "DBCLOB" . equalsIgnoreCase ( typeName ) || "GRAPHIC" . equalsIgnoreCase ( typeName ) || "VARGRAPHIC" . equalsIgnoreCase ( typeName ) ) && ( columnSize != null ) ) { // Stored as double length chars
columnSize = columnSize / 2 ; } if ( "TIMESTAMP" . equalsIgnoreCase ( columnTypeName ) && ( decimalDigits == null ) ) { // Actually a date
columnTypeName = "DATE" ; dataType = Types . DATE ; } } if ( ( database instanceof PostgresDatabase ) && ( columnSize != null ) && columnSize . equals ( Integer . MAX_VALUE ) ) { columnSize = null ; } // For SAP ( Sybase ) SQL ANywhere , JDBC returns " LONG ( 2147483647 ) binary " ( the number is 2 ^ 31-1)
// but when creating a column , LONG BINARY must not have parameters .
// The same applies to LONG ( . . . ) VARCHAR .
if ( database instanceof SybaseASADatabase && ( "LONG BINARY" . equalsIgnoreCase ( columnTypeName ) || "LONG VARCHAR" . equalsIgnoreCase ( columnTypeName ) ) ) { columnSize = null ; } DataType type = new DataType ( columnTypeName ) ; type . setDataTypeId ( dataType ) ; /* * According to the description of DatabaseMetaData . getColumns , the content of the " COLUMN _ SIZE " column is
 * pretty worthless for datetime / timestamp columns :
 * " For datetime datatypes , this is the length in characters of the String representation
 * ( assuming the maximum allowed precision of the fractional seconds component ) . "
 * In the case of TIMESTAMP columns , the information we are really looking for
 * ( the fractional digits ) is located in the column DECIMAL _ DIGITS . */
int jdbcType = columnMetadataResultSet . getInt ( "DATA_TYPE" ) ; // Java 8 compatibility notes : When upgrading this project to JDK8 and beyond , also execute this if - branch
// if jdbcType is TIMESTAMP _ WITH _ TIMEZONE ( does not exist yet in JDK7)
if ( jdbcType == Types . TIMESTAMP ) { if ( decimalDigits == null ) { type . setColumnSize ( null ) ; } else { type . setColumnSize ( ( decimalDigits != database . getDefaultFractionalDigitsForTimestamp ( ) ) ? decimalDigits : null ) ; } type . setDecimalDigits ( null ) ; } else { type . setColumnSize ( columnSize ) ; type . setDecimalDigits ( decimalDigits ) ; } type . setRadix ( radix ) ; type . setCharacterOctetLength ( characterOctetLength ) ; type . setColumnSizeUnit ( columnSizeUnit ) ; return type ;


signature:
public class UniqueConstraintSnapshotGenerator { /** * Method to map ' validate ' option for UC . This thing works only for ORACLE
 * @ param database - DB where UC will be created
 * @ param uniqueConstraint - UC object to persist validate option
 * @ param columnsMetadata - it ' s a cache - map to get metadata about UC */
private void setValidateOptionIfAvailable ( Database database , UniqueConstraint uniqueConstraint , Map < String , ? > columnsMetadata ) { } }

implementation: if ( ! ( database instanceof OracleDatabase ) ) { return ; } final Object constraintValidate = columnsMetadata . get ( "CONSTRAINT_VALIDATE" ) ; final String VALIDATE = "VALIDATED" ; if ( constraintValidate != null && ! constraintValidate . toString ( ) . trim ( ) . isEmpty ( ) ) { uniqueConstraint . setShouldValidate ( VALIDATE . equals ( cleanNameFromDatabase ( constraintValidate . toString ( ) . trim ( ) , database ) ) ) ; }


signature:
public class UniqueConstraintSnapshotGenerator { /** * Gets an SQL query that returns the constraint names and columns for all UNIQUE constraints .
 * @ param database A database object of the InformixDatabase type
 * @ param schema Name of the schema to examine ( or null for all )
 * @ param name Name of the constraint to examine ( or null for all )
 * @ return A lengthy SQL statement that fetches the constraint names and columns */
private String getUniqueConstraintsSqlInformix ( InformixDatabase database , Schema schema , String name ) { } }

implementation:
StringBuffer sqlBuf = new StringBuffer ( ) ; sqlBuf . append ( "SELECT * FROM (\n" ) ; // Yes , I am serious about this . It appears there are neither CTE / WITH clauses nor PIVOT / UNPIVOT operators
// in Informix SQL .
for ( int i = 1 ; i <= 16 ; i ++ ) { if ( i > 1 ) sqlBuf . append ( "UNION ALL\n" ) ; sqlBuf . append ( String . format ( "  SELECT\n" + "    CONS.owner,\n" + "    CONS.constrname AS constraint_name,\n" + "    COL.colname AS column_name,\n" + "    CONS.constrtype,\n" + "    %d               AS column_index\n" + "  FROM informix.sysconstraints CONS\n" + "    JOIN informix.sysindexes IDX ON CONS.idxname = IDX.idxname\n" + "    JOIN informix.syscolumns COL ON COL.tabid = CONS.tabid AND COL.colno = IDX.part%d\n" , i , i ) ) ; } // Finish the subquery and filter on the U ( NIQUE ) constraint type
sqlBuf . append ( "                ) SUBQ\n" + "WHERE constrtype='U' \n" ) ; String catalogName = database . correctObjectName ( schema . getCatalogName ( ) , Catalog . class ) ; String constraintName = database . correctObjectName ( name , UniqueConstraint . class ) ; // If possible , filter for catalog name and / or constraint name
if ( catalogName != null ) { sqlBuf . append ( "AND owner='" + catalogName + "'\n" ) ; } if ( constraintName != null ) { sqlBuf . append ( "AND constraint_name='" + constraintName + "'" ) ; } // For correct processing , it is important that we get all columns in order .
sqlBuf . append ( "ORDER BY owner, constraint_name, column_index" ) ; // Return the query
return sqlBuf . toString ( ) ;


signature:
public class ChangeMetaData { /** * Return the parameters of the given change that are set to a non - null value . Will never return a null map , only an empty or populated map . */
public Map < String , ChangeParameterMetaData > getSetParameters ( Change change ) { } }

implementation: Map < String , ChangeParameterMetaData > returnMap = new HashMap < > ( ) ; for ( Map . Entry < String , ChangeParameterMetaData > entry : getParameters ( ) . entrySet ( ) ) { if ( entry . getValue ( ) . getCurrentValue ( change ) != null ) { returnMap . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } return Collections . unmodifiableMap ( returnMap ) ;


signature:
public class ChangeMetaData { /** * Returns the required parameters for this change for the given database . Will never return a null map , only an empty or populated map . */
public Map < String , ChangeParameterMetaData > getRequiredParameters ( Database database ) { } }

implementation: Map < String , ChangeParameterMetaData > returnMap = new HashMap < > ( ) ; for ( ChangeParameterMetaData metaData : parameters . values ( ) ) { if ( metaData . isRequiredFor ( database ) ) { returnMap . put ( metaData . getParameterName ( ) , metaData ) ; } } return returnMap ;


signature:
public class ChangeSet { /** * This method will actually execute each of the changes in the list against the
 * specified database .
 * @ return should change set be marked as ran */
public ExecType execute ( DatabaseChangeLog databaseChangeLog , ChangeExecListener listener , Database database ) throws MigrationFailedException { } }

implementation:
Logger log = Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) ; if ( validationFailed ) { return ExecType . MARK_RAN ; } long startTime = new Date ( ) . getTime ( ) ; ExecType execType = null ; boolean skipChange = false ; Executor executor = ExecutorService . getInstance ( ) . getExecutor ( database ) ; try { // set object quoting strategy
database . setObjectQuotingStrategy ( objectQuotingStrategy ) ; if ( database . supportsDDLInTransaction ( ) ) { database . setAutoCommit ( ! runInTransaction ) ; } executor . comment ( "Changeset " + toString ( false ) ) ; if ( StringUtil . trimToNull ( getComments ( ) ) != null ) { String comments = getComments ( ) ; String [ ] lines = comments . split ( "\\n" ) ; for ( int i = 0 ; i < lines . length ; i ++ ) { if ( i > 0 ) { lines [ i ] = database . getLineComment ( ) + " " + lines [ i ] ; } } executor . comment ( StringUtil . join ( Arrays . asList ( lines ) , "\n" ) ) ; } try { if ( preconditions != null ) { preconditions . check ( database , databaseChangeLog , this , listener ) ; } } catch ( PreconditionFailedException e ) { if ( listener != null ) { listener . preconditionFailed ( e , preconditions . getOnFail ( ) ) ; } StringBuffer message = new StringBuffer ( ) ; message . append ( StreamUtil . getLineSeparator ( ) ) ; for ( FailedPrecondition invalid : e . getFailedPreconditions ( ) ) { message . append ( "          " ) . append ( invalid . toString ( ) ) ; message . append ( StreamUtil . getLineSeparator ( ) ) ; } if ( preconditions . getOnFail ( ) . equals ( PreconditionContainer . FailOption . HALT ) ) { throw new MigrationFailedException ( this , message . toString ( ) , e ) ; } else if ( preconditions . getOnFail ( ) . equals ( PreconditionContainer . FailOption . CONTINUE ) ) { skipChange = true ; execType = ExecType . SKIPPED ; Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . info ( LogType . LOG , "Continuing past: " + toString ( ) + " despite precondition failure due to onFail='CONTINUE': " + message ) ; } else if ( preconditions . getOnFail ( ) . equals ( PreconditionContainer . FailOption . MARK_RAN ) ) { execType = ExecType . MARK_RAN ; skipChange = true ; log . info ( LogType . LOG , "Marking ChangeSet: " + toString ( ) + " ran despite precondition failure due to onFail='MARK_RAN': " + message ) ; } else if ( preconditions . getOnFail ( ) . equals ( PreconditionContainer . FailOption . WARN ) ) { execType = null ; // already warned
} else { throw new UnexpectedLiquibaseException ( "Unexpected precondition onFail attribute: " + preconditions . getOnFail ( ) , e ) ; } } catch ( PreconditionErrorException e ) { if ( listener != null ) { listener . preconditionErrored ( e , preconditions . getOnError ( ) ) ; } StringBuffer message = new StringBuffer ( ) ; message . append ( StreamUtil . getLineSeparator ( ) ) ; for ( ErrorPrecondition invalid : e . getErrorPreconditions ( ) ) { message . append ( "          " ) . append ( invalid . toString ( ) ) ; message . append ( StreamUtil . getLineSeparator ( ) ) ; } if ( preconditions . getOnError ( ) . equals ( PreconditionContainer . ErrorOption . HALT ) ) { throw new MigrationFailedException ( this , message . toString ( ) , e ) ; } else if ( preconditions . getOnError ( ) . equals ( PreconditionContainer . ErrorOption . CONTINUE ) ) { skipChange = true ; execType = ExecType . SKIPPED ; } else if ( preconditions . getOnError ( ) . equals ( PreconditionContainer . ErrorOption . MARK_RAN ) ) { execType = ExecType . MARK_RAN ; skipChange = true ; log . info ( LogType . LOG , "Marking ChangeSet: " + toString ( ) + " ran despite precondition error: " + message ) ; } else if ( preconditions . getOnError ( ) . equals ( PreconditionContainer . ErrorOption . WARN ) ) { execType = null ; // already logged
} else { throw new UnexpectedLiquibaseException ( "Unexpected precondition onError attribute: " + preconditions . getOnError ( ) , e ) ; } database . rollback ( ) ; } finally { database . rollback ( ) ; } if ( ! skipChange ) { for ( Change change : changes ) { try { change . finishInitialization ( ) ; } catch ( SetupException se ) { throw new MigrationFailedException ( this , se ) ; } } log . fine ( LogType . LOG , "Reading ChangeSet: " + toString ( ) ) ; for ( Change change : getChanges ( ) ) { if ( ( ! ( change instanceof DbmsTargetedChange ) ) || DatabaseList . definitionMatches ( ( ( DbmsTargetedChange ) change ) . getDbms ( ) , database , true ) ) { if ( listener != null ) { listener . willRun ( change , this , changeLog , database ) ; } if ( change . generateStatementsVolatile ( database ) ) { executor . comment ( "WARNING The following SQL may change each run and therefore is possibly incorrect and/or invalid:" ) ; } database . executeStatements ( change , databaseChangeLog , sqlVisitors ) ; log . info ( LogType . LOG , change . getConfirmationMessage ( ) ) ; if ( listener != null ) { listener . ran ( change , this , changeLog , database ) ; } } else { log . fine ( LogType . LOG , "Change " + change . getSerializedObjectName ( ) + " not included for database " + database . getShortName ( ) ) ; } } if ( runInTransaction ) { database . commit ( ) ; } log . info ( LogType . LOG , "ChangeSet " + toString ( false ) + " ran successfully in " + ( new Date ( ) . getTime ( ) - startTime + "ms" ) ) ; if ( execType == null ) { execType = ExecType . EXECUTED ; } } else { log . fine ( LogType . LOG , "Skipping ChangeSet: " + toString ( ) ) ; } } catch ( Exception e ) { try { database . rollback ( ) ; } catch ( Exception e1 ) { throw new MigrationFailedException ( this , e ) ; } if ( ( getFailOnError ( ) != null ) && ! getFailOnError ( ) ) { log . info ( LogType . LOG , "Change set " + toString ( false ) + " failed, but failOnError was false.  Error: " + e . getMessage ( ) ) ; log . fine ( LogType . LOG , "Failure Stacktrace" , e ) ; execType = ExecType . FAILED ; } else { // just log the message , dont log the stacktrace by appending exception . Its logged anyway to stdout
log . severe ( LogType . LOG , "Change Set " + toString ( false ) + " failed.  Error: " + e . getMessage ( ) ) ; if ( e instanceof MigrationFailedException ) { throw ( ( MigrationFailedException ) e ) ; } else { throw new MigrationFailedException ( this , e ) ; } } } finally { // restore auto - commit to false if this ChangeSet was not run in a transaction ,
// but only if the database supports DDL in transactions
if ( ! runInTransaction && database . supportsDDLInTransaction ( ) ) { try { database . setAutoCommit ( false ) ; } catch ( DatabaseException e ) { throw new MigrationFailedException ( this , "Could not resetInternalState autocommit" , e ) ; } } } return execType ;


signature:
public class OfflineConnection { /** * For debugging purposes : sets a DatabaseSnapshot object for this connection . Effectively ,
 * this simulates the content of the database in this OfflineConnection .
 * @ param snapshot the snapshot with the simulated database content */
public void setSnapshot ( DatabaseSnapshot snapshot ) { } }

implementation: this . snapshot = snapshot ; this . snapshot . getDatabase ( ) . setConnection ( this ) ; for ( Catalog catalog : this . snapshot . get ( Catalog . class ) ) { if ( catalog . isDefault ( ) ) { this . catalog = catalog . getName ( ) ; } }


signature:
public class InsertOrUpdateGeneratorInformix { /** * Copied and modified from liquibase . sqlgenerator . core . InsertOrUpdateGeneratorMySQL */
private String convertToString ( Object newValue , Database database ) { } }

implementation: String sqlString ; if ( newValue == null || newValue . toString ( ) . equals ( "" ) || newValue . toString ( ) . equalsIgnoreCase ( "NULL" ) ) { sqlString = "NULL::INTEGER" ; } else if ( newValue instanceof String && ! looksLikeFunctionCall ( ( ( String ) newValue ) , database ) ) { sqlString = "'" + database . escapeStringForDatabase ( newValue . toString ( ) ) + "'" ; } else if ( newValue instanceof Date ) { sqlString = database . getDateLiteral ( ( ( Date ) newValue ) ) ; } else if ( newValue instanceof Boolean ) { if ( ( ( Boolean ) newValue ) ) { sqlString = DataTypeFactory . getInstance ( ) . getTrueBooleanValue ( database ) ; } else { sqlString = DataTypeFactory . getInstance ( ) . getFalseBooleanValue ( database ) ; } } else { sqlString = newValue . toString ( ) ; } return sqlString ;


signature:
public class AbstractChange { /** * Generate the ChangeMetaData for this class . Default implementation reads from the @ { @ link DatabaseChange } annotation
 * and calls out to { @ link # createChangeParameterMetadata ( String ) } for each property .
 * @ throws UnexpectedLiquibaseException if no @ DatabaseChange annotation on this Change class */
@ Override public ChangeMetaData createChangeMetaData ( ) { } }

implementation:
try { DatabaseChange databaseChange = this . getClass ( ) . getAnnotation ( DatabaseChange . class ) ; if ( databaseChange == null ) { throw new UnexpectedLiquibaseException ( "No @DatabaseChange annotation for " + getClass ( ) . getName ( ) ) ; } Set < ChangeParameterMetaData > params = new HashSet < > ( ) ; for ( PropertyDescriptor property : PropertyUtils . getInstance ( ) . getDescriptors ( getClass ( ) ) ) { if ( isInvalidProperty ( property ) ) { continue ; } Method readMethod = property . getReadMethod ( ) ; Method writeMethod = property . getWriteMethod ( ) ; if ( readMethod == null ) { try { readMethod = this . getClass ( ) . getMethod ( "is" + StringUtil . upperCaseFirst ( property . getName ( ) ) ) ; } catch ( NoSuchMethodException | SecurityException ignore ) { // it was worth a try
} } if ( ( readMethod != null ) && ( writeMethod != null ) ) { DatabaseChangeProperty annotation = readMethod . getAnnotation ( DatabaseChangeProperty . class ) ; if ( ( annotation == null ) || annotation . isChangeProperty ( ) ) { params . add ( createChangeParameterMetadata ( property . getDisplayName ( ) ) ) ; } } } Map < String , String > notes = new HashMap < > ( ) ; for ( DatabaseChangeNote note : databaseChange . databaseNotes ( ) ) { notes . put ( note . database ( ) , note . notes ( ) ) ; } return new ChangeMetaData ( databaseChange . name ( ) , databaseChange . description ( ) , databaseChange . priority ( ) , databaseChange . appliesTo ( ) , notes , params ) ; } catch ( UnexpectedLiquibaseException | IntrospectionException e ) { throw new UnexpectedLiquibaseException ( e ) ; }


signature:
public class AbstractChange { /** * Called by { @ link # createChangeMetaData ( ) } to create metadata for a given parameter . It finds the method that corresponds to the parameter
 * and calls the corresponding create * MetaData methods such as { @ link # createRequiredDatabasesMetaData ( String , DatabaseChangeProperty ) } to determine the
 * correct values for the ChangeParameterMetaData fields .
 * @ throws UnexpectedLiquibaseException if the passed parameter does not exist */
protected ChangeParameterMetaData createChangeParameterMetadata ( String parameterName ) { } }

implementation: try { String displayName = parameterName . replaceAll ( "([A-Z])" , " $1" ) ; displayName = displayName . substring ( 0 , 1 ) . toUpperCase ( ) + displayName . substring ( 1 ) ; PropertyDescriptor property = null ; for ( PropertyDescriptor prop : PropertyUtils . getInstance ( ) . getDescriptors ( getClass ( ) ) ) { if ( prop . getDisplayName ( ) . equals ( parameterName ) ) { property = prop ; break ; } } if ( property == null ) { throw new UnexpectedLiquibaseException ( "Could not find property " + parameterName ) ; } Method readMethod = property . getReadMethod ( ) ; if ( readMethod == null ) { readMethod = getClass ( ) . getMethod ( "is" + StringUtil . upperCaseFirst ( property . getName ( ) ) ) ; } Type type = readMethod . getGenericReturnType ( ) ; DatabaseChangeProperty changePropertyAnnotation = readMethod . getAnnotation ( DatabaseChangeProperty . class ) ; String mustEqualExisting = createMustEqualExistingMetaData ( parameterName , changePropertyAnnotation ) ; String description = createDescriptionMetaData ( parameterName , changePropertyAnnotation ) ; Map < String , Object > examples = createExampleValueMetaData ( parameterName , changePropertyAnnotation ) ; String since = createSinceMetaData ( parameterName , changePropertyAnnotation ) ; SerializationType serializationType = createSerializationTypeMetaData ( parameterName , changePropertyAnnotation ) ; String [ ] requiredForDatabase = createRequiredDatabasesMetaData ( parameterName , changePropertyAnnotation ) ; String [ ] supportsDatabase = createSupportedDatabasesMetaData ( parameterName , changePropertyAnnotation ) ; return new ChangeParameterMetaData ( this , parameterName , displayName , description , examples , since , type , requiredForDatabase , supportsDatabase , mustEqualExisting , serializationType ) ; } catch ( IntrospectionException | UnexpectedLiquibaseException | NoSuchMethodException | SecurityException e ) { throw new UnexpectedLiquibaseException ( e ) ; }


signature:
public class AbstractChange { /** * Create the { @ link ChangeParameterMetaData } " since " value . Uses the value on the DatabaseChangeProperty
 * annotation or returns null as a default . */
@ SuppressWarnings ( "UnusedParameters" ) protected String createSinceMetaData ( String parameterName , DatabaseChangeProperty changePropertyAnnotation ) { } }

implementation: if ( changePropertyAnnotation == null ) { return null ; } return StringUtil . trimToNull ( changePropertyAnnotation . since ( ) ) ;


signature:
public class AbstractChange { /** * Create the { @ link ChangeParameterMetaData } " description " value . Uses the value on the DatabaseChangeProperty
 * annotation or returns null as a default . */
@ SuppressWarnings ( "UnusedParameters" ) protected String createDescriptionMetaData ( String parameterName , DatabaseChangeProperty changePropertyAnnotation ) { } }

implementation: if ( changePropertyAnnotation == null ) { return null ; } return StringUtil . trimToNull ( changePropertyAnnotation . description ( ) ) ;


signature:
public class AbstractChange { /** * Create the { @ link ChangeParameterMetaData } " serializationType " value . Uses the value on the
 * DatabaseChangeProperty annotation or returns
 * { @ link liquibase . serializer . LiquibaseSerializable . SerializationType # NAMED _ FIELD } as a default . */
@ SuppressWarnings ( "UnusedParameters" ) protected liquibase . serializer . LiquibaseSerializable . SerializationType createSerializationTypeMetaData ( String parameterName , DatabaseChangeProperty changePropertyAnnotation ) { } }

implementation: if ( changePropertyAnnotation == null ) { return SerializationType . NAMED_FIELD ; } return changePropertyAnnotation . serializationType ( ) ;


signature:
public class AbstractChange { /** * Create the { @ link ChangeParameterMetaData } " mustEqual " value . Uses the value on the DatabaseChangeProperty
 * annotation or returns null as a default . */
@ SuppressWarnings ( "UnusedParameters" ) protected String createMustEqualExistingMetaData ( String parameterName , DatabaseChangeProperty changePropertyAnnotation ) { } }

implementation: if ( changePropertyAnnotation == null ) { return null ; } return changePropertyAnnotation . mustEqualExisting ( ) ;


signature:
public class AbstractChange { /** * Create the { @ link ChangeParameterMetaData } " example " value . Uses the value on the DatabaseChangeProperty annotation or returns null as a default .
 * Returns map with key = database short name , value = example . Use short - name " all " as the fallback . */
@ SuppressWarnings ( "UnusedParameters" ) protected Map < String , Object > createExampleValueMetaData ( String parameterName , DatabaseChangeProperty changePropertyAnnotation ) { } }

implementation: if ( changePropertyAnnotation == null ) { return null ; } Map < String , Object > examples = new HashMap < > ( ) ; examples . put ( "all" , StringUtil . trimToNull ( changePropertyAnnotation . exampleValue ( ) ) ) ; return examples ;


signature:
public class AbstractChange { /** * Create the { @ link ChangeParameterMetaData } " requiredDatabases " value .
 * Uses the value on the DatabaseChangeProperty annotation or returns an array containing the string " COMPUTE "
 * as a default . " COMPUTE " will cause ChangeParameterMetaData to attempt to determine the required databases based
 * on the generated Statements */
@ SuppressWarnings ( "UnusedParameters" ) protected String [ ] createRequiredDatabasesMetaData ( String parameterName , DatabaseChangeProperty changePropertyAnnotation ) { } }

implementation: if ( changePropertyAnnotation == null ) { return new String [ ] { ChangeParameterMetaData . COMPUTE } ; } else { return changePropertyAnnotation . requiredForDatabase ( ) ; }


signature:
public class AbstractChange { /** * Create the { @ link ChangeParameterMetaData } " supportedDatabase " value .
 * Uses the value on the DatabaseChangeProperty annotation or returns an array containing the string " COMPUTE "
 * as a default . " COMPUTE " will cause ChangeParameterMetaData to attempt to determine the required databases
 * based on the generated Statements */
@ SuppressWarnings ( "UnusedParameters" ) protected String [ ] createSupportedDatabasesMetaData ( String parameterName , DatabaseChangeProperty changePropertyAnnotation ) { } }

implementation: if ( changePropertyAnnotation == null ) { return new String [ ] { ChangeParameterMetaData . COMPUTE } ; } else { return changePropertyAnnotation . supportsDatabase ( ) ; }


signature:
public class AbstractChange { /** * Implementation delegates logic to the
 * { @ link liquibase . sqlgenerator . SqlGenerator # generateStatementsIsVolatile ( Database ) } method on the
 * { @ link SqlStatement } objects returned by { @ link # generateStatements } .
 * If zero or null SqlStatements are returned by generateStatements then this method returns false . */
@ Override public boolean generateStatementsVolatile ( Database database ) { } }

implementation: SqlStatement [ ] statements = generateStatements ( database ) ; if ( statements == null ) { return false ; } for ( SqlStatement statement : statements ) { if ( SqlGeneratorFactory . getInstance ( ) . generateStatementsVolatile ( statement , database ) ) { return true ; } } return false ;


signature:
public class AbstractChange { /** * Implementation delegates logic to the
 * { @ link liquibase . sqlgenerator . SqlGenerator # warn ( liquibase . statement . SqlStatement , liquibase . database . Database ,
 * liquibase . sqlgenerator . SqlGeneratorChain ) } method on the { @ link SqlStatement } objects returned by
 * { @ link # generateStatements } .
 * If a generated statement is not supported for the given database , no warning will be added since that is a
 * validation error . If no or null SqlStatements are returned by generateStatements then this method returns no
 * warnings . */
@ Override public Warnings warn ( Database database ) { } }

implementation: Warnings warnings = new Warnings ( ) ; if ( generateStatementsVolatile ( database ) ) { return warnings ; } SqlStatement [ ] statements = generateStatements ( database ) ; if ( statements == null ) { return warnings ; } for ( SqlStatement statement : statements ) { if ( SqlGeneratorFactory . getInstance ( ) . supports ( statement , database ) ) { warnings . addAll ( SqlGeneratorFactory . getInstance ( ) . warn ( statement , database ) ) ; } else if ( statement . skipOnUnsupported ( ) ) { warnings . addWarning ( statement . getClass ( ) . getName ( ) + " is not supported on " + database . getShortName ( ) + ", but " + Scope . getCurrentScope ( ) . getSingleton ( ChangeFactory . class ) . getChangeMetaData ( this ) . getName ( ) + " will still execute" ) ; } } return warnings ;


signature:
public class AbstractChange { /** * Implementation checks the ChangeParameterMetaData for declared required fields
 * and also delegates logic to the
 * { @ link liquibase . sqlgenerator . SqlGenerator # validate ( liquibase . statement . SqlStatement ,
 * liquibase . database . Database , liquibase . sqlgenerator . SqlGeneratorChain ) } method on the { @ link SqlStatement }
 * objects returned by { @ link # generateStatements } .
 * If no or null SqlStatements are returned by generateStatements then this method returns no errors .
 * If there are no parameters than this method returns no errors */
@ Override public ValidationErrors validate ( Database database ) { } }

implementation:
ValidationErrors changeValidationErrors = new ValidationErrors ( ) ; // Record an error if a parameter is not set , but that parameter is required by database .
for ( ChangeParameterMetaData param : Scope . getCurrentScope ( ) . getSingleton ( ChangeFactory . class ) . getChangeMetaData ( this ) . getParameters ( ) . values ( ) ) { if ( param . isRequiredFor ( database ) && ( param . getCurrentValue ( this ) == null ) ) { changeValidationErrors . addError ( param . getParameterName ( ) + " is required for " + Scope . getCurrentScope ( ) . getSingleton ( ChangeFactory . class ) . getChangeMetaData ( this ) . getName ( ) + " on " + database . getShortName ( ) ) ; } } // We cannot proceed to the next validation if we have missing parameters
if ( changeValidationErrors . hasErrors ( ) ) { return changeValidationErrors ; } // Record warnings if statements are unsupported on database
if ( ! generateStatementsVolatile ( database ) ) { String unsupportedWarning = Scope . getCurrentScope ( ) . getSingleton ( ChangeFactory . class ) . getChangeMetaData ( this ) . getName ( ) + " is not supported on " + database . getShortName ( ) ; boolean sawUnsupportedError = false ; SqlStatement [ ] statements = generateStatements ( database ) ; if ( statements != null ) { for ( SqlStatement statement : statements ) { boolean supported = SqlGeneratorFactory . getInstance ( ) . supports ( statement , database ) ; if ( ! supported && ! sawUnsupportedError ) { if ( ! statement . skipOnUnsupported ( ) ) { changeValidationErrors . addError ( unsupportedWarning ) ; sawUnsupportedError = true ; } } else { changeValidationErrors . addAll ( SqlGeneratorFactory . getInstance ( ) . validate ( statement , database ) ) ; } } } } return changeValidationErrors ;


signature:
public class AbstractChange { /** * Generates rollback statements from the inverse changes returned by createInverses ( ) .
 * Throws RollbackImpossibleException if the changes created by createInverses ( ) is not supported for the
 * passed database . */
private SqlStatement [ ] generateRollbackStatementsFromInverse ( Database database ) throws RollbackImpossibleException { } }

implementation: Change [ ] inverses = createInverses ( ) ; if ( inverses == null ) { throw new RollbackImpossibleException ( "No inverse to " + getClass ( ) . getName ( ) + " created" ) ; } List < SqlStatement > statements = new ArrayList < > ( ) ; try { for ( Change inverse : inverses ) { if ( ! inverse . supports ( database ) ) { throw new RollbackImpossibleException ( Scope . getCurrentScope ( ) . getSingleton ( ChangeFactory . class ) . getChangeMetaData ( inverse ) . getName ( ) + " is not supported on " + database . getShortName ( ) ) ; } statements . addAll ( Arrays . asList ( inverse . generateStatements ( database ) ) ) ; } } catch ( LiquibaseException e ) { throw new RollbackImpossibleException ( e ) ; } return statements . toArray ( new SqlStatement [ statements . size ( ) ] ) ;


signature:
public class AbstractChange { /** * Implementation delegates logic to the
 * { @ link liquibase . sqlgenerator . SqlGeneratorFactory # getAffectedDatabaseObjects ( liquibase . statement . SqlStatement ,
 * liquibase . database . Database ) } method on the { @ link SqlStatement } objects returned by { @ link # generateStatements }
 * Returns empty set if change is not supported for the passed database */
@ Override public Set < DatabaseObject > getAffectedDatabaseObjects ( Database database ) { } }

implementation: if ( this . generateStatementsVolatile ( database ) ) { return new HashSet < > ( ) ; } Set < DatabaseObject > affectedObjects = new HashSet < > ( ) ; SqlStatement [ ] statements = generateStatements ( database ) ; if ( statements != null ) { for ( SqlStatement statement : statements ) { affectedObjects . addAll ( SqlGeneratorFactory . getInstance ( ) . getAffectedDatabaseObjects ( statement , database ) ) ; } } return affectedObjects ;


signature:
public class AbstractChange { /** * Returns the fields on this change that are serializable . */
@ Override public Set < String > getSerializableFields ( ) { } }

implementation: return Scope . getCurrentScope ( ) . getSingleton ( ChangeFactory . class ) . getChangeMetaData ( this ) . getParameters ( ) . keySet ( ) ;


signature:
public class FilenameUtils { /** * Does the work of getting the path .
 * @ param filename the filename
 * @ param includeSeparator true to include the end separator
 * @ return the path */
private static String doGetFullPath ( String filename , boolean includeSeparator ) { } }

implementation:
if ( filename == null ) { return null ; } int prefix = getPrefixLength ( filename ) ; if ( prefix < 0 ) { return null ; } if ( prefix >= filename . length ( ) ) { if ( includeSeparator ) { return getPrefix ( filename ) ; // add end slash if necessary
} else { return filename ; } } int index = indexOfLastSeparator ( filename ) ; if ( index < 0 ) { return filename . substring ( 0 , prefix ) ; } int end = index + ( includeSeparator ? 1 : 0 ) ; return filename . substring ( 0 , end ) ;


signature:
public class FilenameUtils { /** * Gets the name minus the path from a full filename .
 * This method will handle a file in either Unix or Windows format .
 * The text after the last forward or backslash is returned .
 * < pre >
 * a / b / c . txt - - > c . txt
 * a . txt - - > a . txt
 * a / b / c - - > c
 * a / b / c / - - > " "
 * < / pre >
 * The output will be the same irrespective of the machine that the code is running on .
 * @ param filename the filename to query , null returns null
 * @ return the name of the file without the path , or an empty string if none exists */
public static String getName ( String filename ) { } }

implementation: if ( filename == null ) { return null ; } int index = indexOfLastSeparator ( filename ) ; return filename . substring ( index + 1 ) ;


signature:
public class FilenameUtils { /** * Gets the extension of a filename .
 * This method returns the textual part of the filename after the last dot .
 * There must be no directory separator after the dot .
 * < pre >
 * foo . txt - - > " txt "
 * a / b / c . jpg - - > " jpg "
 * a / b . txt / c - - > " "
 * a / b / c - - > " "
 * < / pre >
 * The output will be the same irrespective of the machine that the code is running on .
 * @ param filename the filename to retrieve the extension of .
 * @ return the extension of the file or an empty string if none exists . */
public static String getExtension ( String filename ) { } }

implementation: if ( filename == null ) { return null ; } int index = indexOfExtension ( filename ) ; if ( index == - 1 ) { return "" ; } else { return filename . substring ( index + 1 ) ; }


signature:
public class FilenameUtils { /** * Removes the extension from a filename .
 * This method returns the textual part of the filename before the last dot .
 * There must be no directory separator after the dot .
 * < pre >
 * foo . txt - - > foo
 * a \ b \ c . jpg - - > a \ b \ c
 * a \ b \ c - - > a \ b \ c
 * a . b \ c - - > a . b \ c
 * < / pre >
 * The output will be the same irrespective of the machine that the code is running on .
 * @ param filename the filename to query , null returns null
 * @ return the filename minus the extension */
public static String removeExtension ( String filename ) { } }

implementation: if ( filename == null ) { return null ; } int index = indexOfExtension ( filename ) ; if ( index == - 1 ) { return filename ; } else { return filename . substring ( 0 , index ) ; }


signature:
public class FilenameUtils { /** * Checks whether two filenames are equal using the case rules of the system .
 * No processing is performed on the filenames other than comparison .
 * The check is case - sensitive on Unix and case - insensitive on Windows .
 * @ param filename1 the first filename to query , may be null
 * @ param filename2 the second filename to query , may be null
 * @ return true if the filenames are equal , null equals null
 * @ see IOCase # SYSTEM */
public static boolean equalsOnSystem ( String filename1 , String filename2 ) { } }

implementation: return equals ( filename1 , filename2 , false , IOCase . SYSTEM ) ;


signature:
public class FilenameUtils { /** * Checks whether two filenames are equal after both have been normalized .
 * Both filenames are first passed to { @ link # normalize ( String ) } .
 * The check is then performed in a case - sensitive manner .
 * @ param filename1 the first filename to query , may be null
 * @ param filename2 the second filename to query , may be null
 * @ return true if the filenames are equal , null equals null
 * @ see IOCase # SENSITIVE */
public static boolean equalsNormalized ( String filename1 , String filename2 ) { } }

implementation: return equals ( filename1 , filename2 , true , IOCase . SENSITIVE ) ;


signature:
public class FilenameUtils { /** * Checks whether the extension of the filename is one of those specified .
 * This method obtains the extension as the textual part of the filename
 * after the last dot . There must be no directory separator after the dot .
 * The extension check is case - sensitive on all platforms .
 * @ param filename the filename to query , null returns false
 * @ param extensions the extensions to check for , null checks for no extension
 * @ return true if the filename is one of the extensions */
public static boolean isExtension ( String filename , String [ ] extensions ) { } }

implementation: if ( filename == null ) { return false ; } if ( ( extensions == null ) || ( extensions . length == 0 ) ) { return ( indexOfExtension ( filename ) == - 1 ) ; } String fileExt = getExtension ( filename ) ; for ( int i = 0 ; i < extensions . length ; i ++ ) { if ( fileExt . equals ( extensions [ i ] ) ) { return true ; } } return false ;


signature:
public class FilenameUtils { /** * Checks whether the extension of the filename is one of those specified .
 * This method obtains the extension as the textual part of the filename
 * after the last dot . There must be no directory separator after the dot .
 * The extension check is case - sensitive on all platforms .
 * @ param filename the filename to query , null returns false
 * @ param extensions the extensions to check for , null checks for no extension
 * @ return true if the filename is one of the extensions */
public static boolean isExtension ( String filename , Collection extensions ) { } }

implementation: if ( filename == null ) { return false ; } if ( ( extensions == null ) || extensions . isEmpty ( ) ) { return ( indexOfExtension ( filename ) == - 1 ) ; } String fileExt = getExtension ( filename ) ; for ( Iterator it = extensions . iterator ( ) ; it . hasNext ( ) ; ) { if ( fileExt . equals ( it . next ( ) ) ) { return true ; } } return false ;


signature:
public class FilenameUtils { /** * Checks a filename to see if it matches the specified wildcard matcher
 * using the case rules of the system .
 * The wildcard matcher uses the characters ' ? ' and ' * ' to represent a
 * single or multiple wildcard characters .
 * This is the same as often found on Dos / Unix command lines .
 * The check is case - sensitive on Unix and case - insensitive on Windows .
 * < pre >
 * wildcardMatch ( " c . txt " , " * . txt " ) - - > true
 * wildcardMatch ( " c . txt " , " * . jpg " ) - - > false
 * wildcardMatch ( " a / b / c . txt " , " a / b / * " ) - - > true
 * wildcardMatch ( " c . txt " , " * . ? ? ? " ) - - > true
 * wildcardMatch ( " c . txt " , " * . ? ? ? ? " ) - - > false
 * < / pre >
 * @ param filename the filename to match on
 * @ param wildcardMatcher the wildcard string to match against
 * @ return true if the filename matches the wilcard string
 * @ see IOCase # SYSTEM */
public static boolean wildcardMatchOnSystem ( String filename , String wildcardMatcher ) { } }

implementation: return wildcardMatch ( filename , wildcardMatcher , IOCase . SYSTEM ) ;


signature:
public class FilenameUtils { /** * Checks a filename to see if it matches the specified wildcard matcher
 * allowing control over case - sensitivity .
 * The wildcard matcher uses the characters ' ? ' and ' * ' to represent a
 * single or multiple wildcard characters .
 * @ param filename the filename to match on
 * @ param wildcardMatcher the wildcard string to match against
 * @ param caseSensitivity what case sensitivity rule to use , null means case - sensitive
 * @ return true if the filename matches the wilcard string
 * @ since Commons IO 1.3 */
public static boolean wildcardMatch ( String filename , String wildcardMatcher , IOCase caseSensitivity ) { } }

implementation:
if ( ( filename == null ) && ( wildcardMatcher == null ) ) { return true ; } if ( ( filename == null ) || ( wildcardMatcher == null ) ) { return false ; } if ( caseSensitivity == null ) { caseSensitivity = IOCase . SENSITIVE ; } filename = caseSensitivity . convertCase ( filename ) ; wildcardMatcher = caseSensitivity . convertCase ( wildcardMatcher ) ; String [ ] wcs = splitOnTokens ( wildcardMatcher ) ; boolean anyChars = false ; int textIdx = 0 ; int wcsIdx = 0 ; Stack backtrack = new Stack ( ) ; // loop around a backtrack stack , to handle complex * matching
do { if ( ! backtrack . isEmpty ( ) ) { int [ ] array = ( int [ ] ) backtrack . pop ( ) ; wcsIdx = array [ 0 ] ; textIdx = array [ 1 ] ; anyChars = true ; } // loop whilst tokens and text left to process
label : while ( wcsIdx < wcs . length ) { switch ( wcs [ wcsIdx ] ) { case "?" : // ? so move to next text char
textIdx ++ ; anyChars = false ; break ; case "*" : // set any chars status
anyChars = true ; if ( wcsIdx == ( wcs . length - 1 ) ) { textIdx = filename . length ( ) ; } break ; default : // matching text token
if ( anyChars ) { // any chars then try to locate text token
textIdx = filename . indexOf ( wcs [ wcsIdx ] , textIdx ) ; if ( textIdx == - 1 ) { // token not found
break label ; } int repeat = filename . indexOf ( wcs [ wcsIdx ] , textIdx + 1 ) ; if ( repeat >= 0 ) { backtrack . push ( new int [ ] { wcsIdx , repeat } ) ; } } else { // matching from current position
if ( ! filename . startsWith ( wcs [ wcsIdx ] , textIdx ) ) { // couldnt match token
break label ; } } // matched text token , move text index to end of matched token
textIdx += wcs [ wcsIdx ] . length ( ) ; anyChars = false ; break ; } wcsIdx ++ ; } // full match
if ( ( wcsIdx == wcs . length ) && ( textIdx == filename . length ( ) ) ) { return true ; } } while ( ! backtrack . isEmpty ( ) ) ; return false ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Creates an index map of column names to column position .
 * @ param values - array of header values . */
protected void createIndexLookup ( String [ ] values ) { } }

implementation: if ( indexLookup . isEmpty ( ) ) { for ( int i = 0 ; i < values . length ; i ++ ) { indexLookup . put ( values [ i ] , i ) ; } }


signature:
public class HeaderColumnNameMappingStrategy { /** * Gets the column index that corresponds to a specific colum name .
 * If the CSV file doesn ' t have a header row , this method will always return
 * null .
 * @ param name the column name
 * @ return the column index , or null if the name doesn ' t exist */
@ Override public Integer getColumnIndex ( String name ) { } }

implementation: if ( null == header ) { throw new IllegalStateException ( "The header row hasn't been read yet." ) ; } createIndexLookup ( header ) ; return indexLookup . get ( name ) ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Gets the property descriptor for a given column position .
 * @ param col the column to find the description for
 * @ return - the property descriptor for the column position or null if one could not be found .
 * @ throws IntrospectionException - thrown on error retrieving the property description . */
@ Override public PropertyDescriptor findDescriptor ( int col ) throws IntrospectionException { } }

implementation: String columnName = getColumnName ( col ) ; return ( StringUtil . trimToNull ( columnName ) != null ) ? findDescriptor ( columnName ) : null ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Gets the field for a given column position .
 * @ param col the column to find the field for
 * @ return - BeanField containing the field - and whether it is mandatory - for a given column position , or null if
 * one could not be found */
@ Override public BeanField findField ( int col ) { } }

implementation: String columnName = getColumnName ( col ) ; return ( StringUtil . trimToNull ( columnName ) != null ) ? findField ( columnName ) : null ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Get the column name for a given column position .
 * @ param col - column position .
 * @ return - the column name or null if the position is larger than the header array or there is no headers defined . */
public String getColumnName ( int col ) { } }

implementation: return ( ( null != header ) && ( col < header . length ) ) ? header [ col ] : null ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Find the property descriptor for a given column .
 * @ param name - column name to look up .
 * @ return - the property descriptor for the column .
 * @ throws IntrospectionException - thrown on error loading the property descriptors . */
protected PropertyDescriptor findDescriptor ( String name ) throws IntrospectionException { } }

implementation:
if ( null == descriptorMap ) { descriptorMap = loadDescriptorMap ( ) ; // lazy load descriptors
} return descriptorMap . get ( name . toUpperCase ( ) . trim ( ) ) ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Find the field for a given column .
 * @ param name - the column name to look up .
 * @ return - BeanField containing the field - and whether it is mandatory - for the column . */
protected BeanField findField ( String name ) { } }

implementation:
if ( null == fieldMap ) { fieldMap = loadFieldMap ( ) ; // lazy load fields
} return fieldMap . get ( name . toUpperCase ( ) . trim ( ) ) ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Determines if the name of a property descriptor matches the column name .
 * Currently only used by unit tests .
 * @ param name - name of the column .
 * @ param desc - property descriptor to check against
 * @ return - true if the name matches the name in the property descriptor . */
protected boolean matches ( String name , PropertyDescriptor desc ) { } }

implementation: return desc . getName ( ) . equals ( name . trim ( ) ) ;


signature:
public class HeaderColumnNameMappingStrategy { /** * builds a map of property descriptors for the Bean .
 * @ return - map of property descriptors
 * @ throws IntrospectionException - thrown on error getting information about the bean . */
protected Map < String , PropertyDescriptor > loadDescriptorMap ( ) throws IntrospectionException { } }

implementation: Map < String , PropertyDescriptor > map = new HashMap < > ( ) ; PropertyDescriptor [ ] descriptors ; descriptors = loadDescriptors ( getType ( ) ) ; for ( PropertyDescriptor descriptor : descriptors ) { map . put ( descriptor . getName ( ) . toUpperCase ( ) . trim ( ) , descriptor ) ; } return map ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Builds a map of fields ( and whether they ' re mandatory ) for the Bean .
 * @ return - a map of fields ( and whether they ' re mandatory ) */
protected Map < String , BeanField > loadFieldMap ( ) { } }

implementation: Map < String , BeanField > map = new HashMap < > ( ) ; for ( Field field : loadFields ( getType ( ) ) ) { boolean required = field . getAnnotation ( CsvBind . class ) . required ( ) ; map . put ( field . getName ( ) . toUpperCase ( ) . trim ( ) , new BeanField ( field , required ) ) ; } return map ;


signature:
public class HeaderColumnNameMappingStrategy { /** * Determines whether the mapping strategy is driven by { @ link liquibase . util . csv . opencsv . bean . CsvBind } annotations .
 * @ return whether the mapping strategy is driven by annotations */
@ Override public boolean isAnnotationDriven ( ) { } }

implementation:
if ( ! determinedIfAnnotationDriven ) { // lazy load this , and only calculate it once
for ( Field field : type . getDeclaredFields ( ) ) { if ( field . isAnnotationPresent ( CsvBind . class ) ) { annotationDriven = true ; break ; } } determinedIfAnnotationDriven = true ; } return annotationDriven ;


signature:
public class SchemesTreeBuilder { /** * Builds a collection of schemes sorted according dependencies
 * @ param schemes All found Liquibase Schema annotations in ' war ' or ' ear ' type file .
 * @ return sorted collection of schemes */
public List < LiquibaseSchema > build ( final String id , Collection < LiquibaseSchema > schemes ) { } }

implementation:
log . fine ( LogType . LOG , String . format ( "[id = %s] build(%s)" , id , schemes ) ) ; log . info ( LogType . LOG , String . format ( "[id = %s] Sorting schemes according dependencies..." , id ) ) ; if ( schemes . isEmpty ( ) ) { return Collections . emptyList ( ) ; } SchemaNode root = null ; // first , copy schemes to no modify source collection
schemes = new ArrayList < > ( schemes ) ; Collection < LiquibaseSchema > availableSchemes = new ArrayList < > ( schemes ) ; // then find not dependent schemes - this will the roots of hierarchy .
List < LiquibaseSchema > notDependent = new ArrayList < > ( ) ; for ( LiquibaseSchema liquibaseSchema : schemes ) { String depends = liquibaseSchema . depends ( ) ; if ( depends . trim ( ) . isEmpty ( ) ) { notDependent . add ( liquibaseSchema ) ; } } log . info ( LogType . LOG , String . format ( "[id = %s] Found [%s] not dependent schemes." , id , notDependent . size ( ) ) ) ; if ( notDependent . isEmpty ( ) ) { // if there is no not - dependent schema , then there is a cyclic dependency .
throw new CyclicDependencyException ( String . format ( "[id = %s] Not independent schemes, possible cyclic dependencies discovered." , id ) ) ; } else { // take first of not - dependent and use it as root of hierarchy .
root = new SchemaNode ( notDependent . get ( 0 ) ) ; log . fine ( LogType . LOG , String . format ( "[id = %s] Selected dependencies tree root [%s]" , id , root . getItem ( ) ) ) ; availableSchemes . removeAll ( notDependent ) ; // we won ' t to check not - dependent schemes .
notDependent . remove ( root . getItem ( ) ) ; // remove root from not - dependent schemes
schemes . retainAll ( availableSchemes ) ; // remove not - dependent from all schemes
// now make all not - dependent schemes children to selected root .
for ( LiquibaseSchema liquibaseSchema : notDependent ) { root . addChild ( liquibaseSchema ) ; } log . fine ( LogType . LOG , String . format ( "[id = %s] Made other non-dependent schemes children of root. [%s] dependent schemes to resolve. Resolving..." , id , availableSchemes . size ( ) ) ) ; int cycles = 0 ; long start = System . currentTimeMillis ( ) ; // until we resolve all dependencies
while ( ! availableSchemes . isEmpty ( ) ) { cycles ++ ; log . fine ( LogType . LOG , String . format ( "[id = %s] Resolution cycle [%s] started." , id , cycles ) ) ; int additions = 0 ; // we will count dependencies resolution for each resolution cycle .
for ( LiquibaseSchema liquibaseSchema : schemes ) { log . fine ( LogType . LOG , String . format ( "[id = %s] LiquibaseSchema [name=%s] depends on liquibaseSchema [name=%s]." , id , liquibaseSchema . name ( ) , liquibaseSchema . depends ( ) ) ) ; SchemaNode parent = root . find ( liquibaseSchema . depends ( ) ) ; // we make the dependent liquibaseSchema as a child for it ' s dependency if found . If not , we just continue .
if ( parent == null ) { log . fine ( LogType . LOG , String . format ( "[id = %s] Dependency not found in resolved dependencies tree, skipping liquibaseSchema [name=%s] for a while." , id , liquibaseSchema . name ( ) ) ) ; boolean isDependencyMissed = true ; for ( LiquibaseSchema tmpLiquibaseSchema : availableSchemes ) { if ( tmpLiquibaseSchema . name ( ) . equalsIgnoreCase ( liquibaseSchema . depends ( ) ) ) { isDependencyMissed = false ; break ; } } if ( isDependencyMissed ) { throw new DependencyNotFoundException ( String . format ( "[id = %s][name=%s] depends on [name=%s], but it is not found!" , id , liquibaseSchema . name ( ) , liquibaseSchema . depends ( ) ) ) ; } } else { log . fine ( LogType . LOG , String . format ( "[id = %s] Dependency found for liquibaseSchema [name=%s], moving it to resolved dependencies tree." , id , liquibaseSchema . name ( ) ) ) ; parent . addChild ( liquibaseSchema ) ; availableSchemes . remove ( liquibaseSchema ) ; additions ++ ; } } log . fine ( LogType . LOG , String . format ( "[id = %s] Resolution cycle [%s] completed" , id , cycles ) ) ; // if not resolutions happened through resolution cycle , definitely there is a cyclic dependency .
if ( additions == 0 ) { throw new CyclicDependencyException ( String . format ( "[id = %s] Cyclic dependencies discovered!" , id ) ) ; } schemes . retainAll ( availableSchemes ) ; } log . info ( LogType . LOG , String . format ( "[id = %s] Dependencies resolved in [cycles=%s, millis=%s]" , id , cycles , System . currentTimeMillis ( ) - start ) ) ; } return root . toList ( ) ;


signature:
public class ColumnPositionMappingStrategy { /** * gets a column name .
 * @ param col - position of the column .
 * @ return - column name or null if col > number of mappings . */
@ Override public String getColumnName ( int col ) { } }

implementation: return ( col < columnMapping . length ) ? columnMapping [ col ] : null ;


signature:
public class ColumnPositionMappingStrategy { /** * Setter for the ColumnMappings .
 * @ param columnMapping - column names to be mapped . */
public void setColumnMapping ( String ... columnMapping ) { } }

implementation: this . columnMapping = ( columnMapping != null ) ? columnMapping . clone ( ) : new String [ ] { } ; resetIndexMap ( ) ; createIndexLookup ( this . columnMapping ) ;


signature:
public class XMLUtil { /** * Extracts the text from the given element .
 * Element . getTextContet ( ) is java5 specific , so we need to use this until we drop 1.4 support . */
public static String getTextContent ( Node element ) { } }

implementation: StringBuffer text = new StringBuffer ( ) ; NodeList childNodes = element . getChildNodes ( ) ; for ( int i = 0 ; i < childNodes . getLength ( ) ; i ++ ) { Node child = childNodes . item ( i ) ; if ( child instanceof Text ) { text . append ( child . getNodeValue ( ) ) ; } } return text . toString ( ) ;


signature: public class ViewSnapshotGenerator { @ Override protected DatabaseObject snapshotObject ( DatabaseObject example , DatabaseSnapshot snapshot ) throws DatabaseException { } }

implementation:
if ( ( ( View ) example ) . getDefinition ( ) != null ) { return example ; } Database database = snapshot . getDatabase ( ) ; Schema schema = example . getSchema ( ) ; List < CachedRow > viewsMetadataRs = null ; try { viewsMetadataRs = ( ( JdbcDatabaseSnapshot ) snapshot ) . getMetaDataFromCache ( ) . getViews ( ( ( AbstractJdbcDatabase ) database ) . getJdbcCatalogName ( schema ) , ( ( AbstractJdbcDatabase ) database ) . getJdbcSchemaName ( schema ) , example . getName ( ) ) ; if ( ! viewsMetadataRs . isEmpty ( ) ) { CachedRow row = viewsMetadataRs . get ( 0 ) ; String rawViewName = row . getString ( "TABLE_NAME" ) ; String rawSchemaName = StringUtil . trimToNull ( row . getString ( "TABLE_SCHEM" ) ) ; String rawCatalogName = StringUtil . trimToNull ( row . getString ( "TABLE_CAT" ) ) ; String remarks = row . getString ( "REMARKS" ) ; if ( remarks != null ) { remarks = remarks . replace ( "''" , "'" ) ; // come back escaped sometimes
} View view = new View ( ) . setName ( cleanNameFromDatabase ( rawViewName , database ) ) ; view . setRemarks ( remarks ) ; CatalogAndSchema schemaFromJdbcInfo = ( ( AbstractJdbcDatabase ) database ) . getSchemaFromJdbcInfo ( rawCatalogName , rawSchemaName ) ; view . setSchema ( new Schema ( schemaFromJdbcInfo . getCatalogName ( ) , schemaFromJdbcInfo . getSchemaName ( ) ) ) ; try { String definition = database . getViewDefinition ( schemaFromJdbcInfo , view . getName ( ) ) ; if ( definition . startsWith ( "FULL_DEFINITION: " ) ) { definition = definition . replaceFirst ( "^FULL_DEFINITION: " , "" ) ; view . setContainsFullDefinition ( true ) ; } // remove strange zero - termination seen on some Oracle view definitions
int length = definition . length ( ) ; if ( definition . charAt ( length - 1 ) == 0 ) { definition = definition . substring ( 0 , length - 1 ) ; } if ( database instanceof InformixDatabase ) { // Cleanup
definition = definition . trim ( ) ; definition = definition . replaceAll ( "\\s*,\\s*" , ", " ) ; definition = definition . replaceAll ( "\\s*;" , "" ) ; // Strip the schema definition because it can optionally be included in the tag attribute
definition = definition . replaceAll ( "(?i)\"" + view . getSchema ( ) . getName ( ) + "\"\\." , "" ) ; } view . setDefinition ( definition ) ; } catch ( DatabaseException e ) { throw new DatabaseException ( "Error getting " + database . getConnection ( ) . getURL ( ) + " view with " + new GetViewDefinitionStatement ( view . getSchema ( ) . getCatalogName ( ) , view . getSchema ( ) . getName ( ) , rawViewName ) , e ) ; } return view ; } else { return null ; } } catch ( SQLException e ) { throw new DatabaseException ( e ) ; }


signature:
public class CharType { /** * Return the size of this data type definition . If unknown or unspecified , return - 1 */
protected int getSize ( ) { } }

implementation: if ( getParameters ( ) . length == 0 ) { return - 1 ; } if ( getParameters ( ) [ 0 ] instanceof String ) { return Integer . parseInt ( ( String ) getParameters ( ) [ 0 ] ) ; } if ( getParameters ( ) [ 0 ] instanceof Number ) { return ( ( Number ) getParameters ( ) [ 0 ] ) . intValue ( ) ; } return - 1 ;


signature:
public class HsqlDatabase { /** * Checks to see if the string is an acceptable computed value for HSQL
 * " datetime " columns are the only columns for which HSQL supports computer values .
 * @ param columnType String of the column ' s data type
 * @ param defaultValue String to be checked for valid valueComputed in HSQL
 * @ return boolean True if the string represents a function supported by HSQL for default values */
public static boolean supportsDefaultValueComputed ( String columnType , String defaultValue ) { } }

implementation: HashSet < String > possibleComputedValues = SUPPORTED_DEFAULT_VALUE_COMPUTED_MAP . get ( columnType ) ; return ( possibleComputedValues != null ) && possibleComputedValues . contains ( defaultValue . toLowerCase ( ) ) ;


signature:
public class StatusVisitor { /** * Return the status of all changeSets , in the order they exist in the databasechangelog .
 * Any change sets not in the current change log but previously ran against the database will be at the front of the List
 * with a not run reason type of { @ link liquibase . changelog . filter . NotInChangeLogChangeSetFilter } */
public List < ChangeSetStatus > getStatuses ( ) { } }

implementation: ArrayList < ChangeSetStatus > returnList = new ArrayList < > ( ) ; for ( RanChangeSet changeSet : ranChangeSets ) { ChangeSetStatus status = new ChangeSetStatus ( new ChangeSet ( changeSet . getId ( ) , changeSet . getAuthor ( ) , false , false , changeSet . getChangeLog ( ) , null , null , null ) ) ; status . setPreviouslyRan ( true ) ; status . setDateLastExecuted ( changeSet . getDateExecuted ( ) ) ; status . setStoredCheckSum ( changeSet . getLastCheckSum ( ) ) ; status . setComments ( changeSet . getComments ( ) ) ; status . setDescription ( changeSet . getDescription ( ) ) ; status . setWillRun ( false ) ; status . setFilterResults ( new HashSet < > ( Arrays . asList ( new ChangeSetFilterResult ( false , "Change set is not in change log" , NotInChangeLogChangeSetFilter . class ) ) ) ) ; status . setRanChangeSet ( changeSet ) ; returnList . add ( status ) ; } returnList . addAll ( changeSetStatuses . values ( ) ) ; return returnList ;


signature:
public class StatusVisitor { /** * Return the change sets that will execute */
public List < ChangeSetStatus > getChangeSetsToRun ( ) { } }

implementation: ArrayList < ChangeSetStatus > returnList = new ArrayList < > ( ) ; for ( ChangeSetStatus status : changeSetStatuses . values ( ) ) { if ( status . getWillRun ( ) ) { returnList . add ( status ) ; } } return returnList ;


signature:
public class PostgresDatabase { /** * This has special case logic to handle NOT quoting column names if they are
 * of type ' LiquibaseColumn ' - columns in the DATABASECHANGELOG or DATABASECHANGELOGLOCK
 * tables . */
@ Override public String escapeObjectName ( String objectName , Class < ? extends DatabaseObject > objectType ) { } }

implementation: if ( ( quotingStrategy == ObjectQuotingStrategy . LEGACY ) && hasMixedCase ( objectName ) ) { return "\"" + objectName + "\"" ; } else if ( objectType != null && LiquibaseColumn . class . isAssignableFrom ( objectType ) ) { return ( objectName != null && ! objectName . isEmpty ( ) ) ? objectName . trim ( ) : objectName ; } return super . escapeObjectName ( objectName , objectType ) ;


signature:
public class PostgresDatabase { /** * Check if given string has case problems according to postgresql documentation .
 * If there are at least one characters with upper case while all other are in lower case ( or vice versa ) this
 * string should be escaped .
 * Note : This may make postgres support more case sensitive than normally is , but needs to be left in for backwards
 * compatibility .
 * Method is public so a subclass extension can override it to always return false . */
protected boolean hasMixedCase ( String tableName ) { } }

implementation: if ( tableName == null ) { return false ; } return StringUtil . hasUpperCase ( tableName ) && StringUtil . hasLowerCase ( tableName ) ;


signature:
public class ColumnConfig { /** * Set the number this column should be set to . Supports integers and decimals , and strips off any wrapping
 * parentheses . If the passed value cannot be parsed as a number in US locale , it is assumed to be a function
 * that returns a number . If the value " null " is passed , it will set a null value . */
public ColumnConfig setValueNumeric ( String valueNumeric ) { } }

implementation: if ( ( valueNumeric == null ) || "null" . equalsIgnoreCase ( valueNumeric ) ) { this . valueNumeric = null ; } else { String saved = valueNumeric ; if ( valueNumeric . startsWith ( "(" ) ) { valueNumeric = valueNumeric . replaceFirst ( "^\\(" , "" ) ; valueNumeric = valueNumeric . replaceFirst ( "\\)$" , "" ) ; } try { this . valueNumeric = ValueNumeric . of ( Locale . US , valueNumeric ) ; } catch ( ParseException e ) { this . valueComputed = new DatabaseFunction ( saved ) ; } } return this ;


signature:
public class ColumnConfig { /** * Set the valueBoolean based on a given string .
 * If the passed value cannot be parsed as a date , it is assumed to be a function that returns a boolean .
 * If the string " null " or an empty string is passed , it will set a null value .
 * If " 1 " is passed , defaultValueBoolean is set to true . If 0 is passed , defaultValueBoolean is set to false */
public ColumnConfig setValueBoolean ( String valueBoolean ) { } }

implementation: valueBoolean = StringUtil . trimToNull ( valueBoolean ) ; if ( ( valueBoolean == null ) || "null" . equalsIgnoreCase ( valueBoolean ) ) { this . valueBoolean = null ; } else { if ( "true" . equalsIgnoreCase ( valueBoolean ) || "1" . equals ( valueBoolean ) ) { this . valueBoolean = true ; } else if ( "false" . equalsIgnoreCase ( valueBoolean ) || "0" . equals ( valueBoolean ) ) { this . valueBoolean = false ; } else { this . valueComputed = new DatabaseFunction ( valueBoolean ) ; } } return this ;


signature:
public class ColumnConfig { /** * Set the date this column should be set to . Supports any of the date or datetime formats handled by { @ link ISODateFormat } .
 * If the passed value cannot be parsed as a date , it is assumed to be a function that returns a date .
 * If the string " null " is passed , it will set a null value .
 * @ param valueDate the Date Value to use ( may be null or " null " , or start with " now " or " today " .
 * @ throws DateParseException if the columnType isn ' t supported for " now " or " today " values . */
public ColumnConfig setValueDate ( String valueDate ) throws DateParseException { } }

implementation:
if ( ( valueDate == null ) || "null" . equalsIgnoreCase ( valueDate ) ) { this . valueDate = null ; } else if ( NowAndTodayUtil . isNowOrTodayFormat ( valueDate ) ) { this . valueDate = NowAndTodayUtil . doNowOrToday ( valueDate , this . getType ( ) ) ; } else { try { this . valueDate = new ISODateFormat ( ) . parse ( valueDate ) ; } catch ( ParseException e ) { // probably a function
this . valueComputed = new DatabaseFunction ( valueDate ) ; } } return this ;


signature:
public class ColumnConfig { /** * Return the value from whatever setValue * function was called . Will return null if none were set . */
public Object getValueObject ( ) { } }

implementation: if ( getValue ( ) != null ) { return getValue ( ) ; } else if ( getValueBoolean ( ) != null ) { return getValueBoolean ( ) ; } else if ( getValueNumeric ( ) != null ) { return getValueNumeric ( ) ; } else if ( getValueDate ( ) != null ) { return getValueDate ( ) ; } else if ( getValueComputed ( ) != null ) { return getValueComputed ( ) ; } else if ( getValueClobFile ( ) != null ) { return getValueClobFile ( ) ; } else if ( getValueBlobFile ( ) != null ) { return getValueBlobFile ( ) ; } else if ( getValueSequenceNext ( ) != null ) { return getValueSequenceNext ( ) ; } else if ( getValueSequenceCurrent ( ) != null ) { return getValueSequenceCurrent ( ) ; } return null ;


signature:
public class ColumnConfig { /** * Set the number this column should use as its default . Supports integers and decimals , and strips off any wrapping parentheses .
 * If the passed value cannot be parsed as a number , it is assumed to be a function that returns a number .
 * If the value " null " is passed , it will set a null value .
 * < p > < / p >
 * A special case is made for " GENERATED _ BY _ DEFAULT " which simply sets the ColumnConfig object to autoIncrement . */
public ColumnConfig setDefaultValueNumeric ( String defaultValueNumeric ) { } }

implementation: if ( ( defaultValueNumeric == null ) || "null" . equalsIgnoreCase ( defaultValueNumeric ) ) { this . defaultValueNumeric = null ; } else { if ( "GENERATED_BY_DEFAULT" . equals ( defaultValueNumeric ) ) { setAutoIncrement ( true ) ; } else { if ( defaultValueNumeric . startsWith ( "(" ) ) { defaultValueNumeric = defaultValueNumeric . replaceFirst ( "^\\(" , "" ) ; defaultValueNumeric = defaultValueNumeric . replaceFirst ( "\\)$" , "" ) ; } try { this . defaultValueNumeric = ValueNumeric . of ( Locale . US , defaultValueNumeric ) ; } catch ( ParseException e ) { this . defaultValueComputed = new DatabaseFunction ( defaultValueNumeric ) ; } } } return this ;


signature:
public class ColumnConfig { /** * Set the date this column should default to . Supports any of the date or datetime formats handled by { @ link ISODateFormat } .
 * If the passed value cannot be parsed as a date , it is assumed to be a function that returns a date .
 * If the string " null " or an empty string is passed , it will set a null value . */
public ColumnConfig setDefaultValueDate ( String defaultValueDate ) { } }

implementation:
defaultValueDate = StringUtil . trimToNull ( defaultValueDate ) ; if ( ( defaultValueDate == null ) || "null" . equalsIgnoreCase ( defaultValueDate ) ) { this . defaultValueDate = null ; } else { try { this . defaultValueDate = new ISODateFormat ( ) . parse ( defaultValueDate ) ; } catch ( ParseException e ) { // probably a computed date
this . defaultValueComputed = new DatabaseFunction ( defaultValueDate ) ; } } return this ;


signature:
public class ColumnConfig { /** * Set the defaultValueBoolean based on a given string .
 * If the passed value cannot be parsed as a date , it is assumed to be a function that returns a boolean .
 * If the string " null " or an empty string is passed , it will set a null value .
 * If " 1 " is passed , defaultValueBoolean is set to true . If 0 is passed , defaultValueBoolean is set to false */
public ColumnConfig setDefaultValueBoolean ( String defaultValueBoolean ) { } }

implementation: defaultValueBoolean = StringUtil . trimToNull ( defaultValueBoolean ) ; if ( ( defaultValueBoolean == null ) || "null" . equalsIgnoreCase ( defaultValueBoolean ) ) { this . defaultValueBoolean = null ; } else { if ( "true" . equalsIgnoreCase ( defaultValueBoolean ) || "1" . equals ( defaultValueBoolean ) ) { this . defaultValueBoolean = true ; } else if ( "false" . equalsIgnoreCase ( defaultValueBoolean ) || "0" . equals ( defaultValueBoolean ) ) { this . defaultValueBoolean = false ; } else { this . defaultValueComputed = new DatabaseFunction ( defaultValueBoolean ) ; } } return this ;


signature:
public class ColumnConfig { /** * Return the value to set this column ' s default to according to the setDefaultValue * function that was called .
 * If none were called , this function returns null . */
public Object getDefaultValueObject ( ) { } }

implementation: if ( getDefaultValue ( ) != null ) { return getDefaultValue ( ) ; } else if ( getDefaultValueBoolean ( ) != null ) { return getDefaultValueBoolean ( ) ; } else if ( getDefaultValueNumeric ( ) != null ) { return getDefaultValueNumeric ( ) ; } else if ( getDefaultValueDate ( ) != null ) { return getDefaultValueDate ( ) ; } else if ( getDefaultValueComputed ( ) != null ) { return getDefaultValueComputed ( ) ; } else if ( getDefaultValueSequenceNext ( ) != null ) { return getDefaultValueSequenceNext ( ) ; } return null ;


signature:
public class ColumnConfig { /** * Returns true if any of the setDefaultValue * functions have had a non - null value set */
public boolean hasDefaultValue ( ) { } }

implementation: return ( this . getDefaultValue ( ) != null ) || ( this . getDefaultValueBoolean ( ) != null ) || ( this . getDefaultValueDate ( ) != null ) || ( this . getDefaultValueNumeric ( ) != null ) || ( this . getDefaultValueComputed ( ) != null ) || ( this . getDefaultValueSequenceNext ( ) != null ) ;


signature:
public class ChangeFactory { /** * Unregister all instances of a given Change name . Normally used for testing , but can be called manually if needed . */
public void unregister ( String name ) { } }

implementation: for ( Change change : new ArrayList < > ( findAllInstances ( ) ) ) { if ( getChangeMetaData ( change ) . getName ( ) . equals ( name ) ) { this . removeInstance ( change ) ; } }


signature:
public class ChangeFactory { /** * Returns all defined changes in the registry . Returned set is not modifiable . */
public SortedSet < String > getDefinedChanges ( ) { } }

implementation: SortedSet < String > names = new TreeSet < > ( ) ; for ( Change change : findAllInstances ( ) ) { names . add ( getChangeMetaData ( change ) . getName ( ) ) ; } return Collections . unmodifiableSortedSet ( names ) ;


signature:
public class ChangeFactory { /** * Create a new Change implementation for the given change name . The class of the constructed object will be the Change implementation with the highest priority .
 * Each call to create will return a new instance of the Change . */
public Change create ( String name ) { } }

implementation: Change plugin = getPlugin ( name ) ; if ( plugin == null ) { return null ; } try { return plugin . getClass ( ) . getConstructor ( ) . newInstance ( ) ; } catch ( Exception e ) { throw new UnexpectedLiquibaseException ( e ) ; }


signature:
public class SwingUIFacade { /** * Displays swing - based dialog about running against a non - localhost database .
 * Returns true if the user selected that they are OK with that . */
@ Override public boolean promptForNonLocalDatabase ( Database database ) throws DatabaseException { } }

implementation: return JOptionPane . showConfirmDialog ( null , "You are running a database migration against a non-local database." + StreamUtil . getLineSeparator ( ) + "Database URL is: " + database . getConnection ( ) . getURL ( ) + StreamUtil . getLineSeparator ( ) + "Username is: " + database . getConnection ( ) . getConnectionUserName ( ) + StreamUtil . getLineSeparator ( ) + StreamUtil . getLineSeparator ( ) + "Are you sure you want to do this?" , "Confirm" , JOptionPane . YES_NO_OPTION , JOptionPane . WARNING_MESSAGE ) == JOptionPane . NO_OPTION ;


signature:
public class AbstractJdbcDatabase { /** * Overwrite this method to get the default schema name for the connection .
 * If you only need to change the statement that obtains the current schema then override
 * @ see AbstractJdbcDatabase # getConnectionSchemaNameCallStatement ( ) */
protected String getConnectionSchemaName ( ) { } }

implementation: if ( connection == null ) { return null ; } if ( connection instanceof OfflineConnection ) { return ( ( OfflineConnection ) connection ) . getSchema ( ) ; } try { SqlStatement currentSchemaStatement = getConnectionSchemaNameCallStatement ( ) ; return ExecutorService . getInstance ( ) . getExecutor ( this ) . queryForObject ( currentSchemaStatement , String . class ) ; } catch ( Exception e ) { Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . info ( LogType . LOG , "Error getting default schema" , e ) ; } return null ;


signature:
public class AbstractJdbcDatabase { /** * Return a date literal with the same value as a string formatted using ISO 8601.
 * Note : many databases accept date literals in ISO8601 format with the ' T ' replaced with
 * a space . Only databases which do not accept these strings should need to override this
 * method .
 * Implementation restriction :
 * Currently , only the following subsets of ISO8601 are supported :
 * yyyy - MM - dd
 * hh : mm : ss
 * yyyy - MM - ddThh : mm : ss */
@ Override public String getDateLiteral ( final String isoDate ) { } }

implementation: if ( isDateOnly ( isoDate ) || isTimeOnly ( isoDate ) ) { return "'" + isoDate + "'" ; } else if ( isDateTime ( isoDate ) ) { return "'" + isoDate . replace ( 'T' , ' ' ) + "'" ; } else { return "BAD_DATE_FORMAT:" + isoDate ; }


signature:
public class AbstractJdbcDatabase { /** * Default implementation , just look for " local " IPs . If the database returns a null URL we return false since we don ' t know it ' s safe to run the update .
 * @ throws liquibase . exception . DatabaseException */
@ Override public boolean isSafeToRunUpdate ( ) throws DatabaseException { } }

implementation: DatabaseConnection connection = getConnection ( ) ; if ( connection == null ) { return true ; } String url = connection . getURL ( ) ; if ( url == null ) { return false ; } return ( url . contains ( "localhost" ) ) || ( url . contains ( "127.0.0.1" ) ) ;


signature:
public class AbstractJdbcDatabase { /** * Executes the statements passed
 * @ param statements an array containing the SQL statements to be issued
 * @ param sqlVisitors a list of { @ link SqlVisitor } objects to be applied to the executed statements
 * @ throws DatabaseException if there were problems issuing the statements */
@ Override public void execute ( final SqlStatement [ ] statements , final List < SqlVisitor > sqlVisitors ) throws LiquibaseException { } }

implementation: for ( SqlStatement statement : statements ) { if ( statement . skipOnUnsupported ( ) && ! SqlGeneratorFactory . getInstance ( ) . supports ( statement , this ) ) { continue ; } Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . fine ( LogType . LOG , "Executing Statement: " + statement ) ; try { ExecutorService . getInstance ( ) . getExecutor ( this ) . execute ( statement , sqlVisitors ) ; } catch ( DatabaseException e ) { if ( statement . continueOnError ( ) ) { Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . severe ( LogType . LOG , "Error executing statement '" + statement . toString ( ) + "', but continuing" , e ) ; } else { throw e ; } } }


signature:
public class AbstractJdbcDatabase { /** * Takes a list of SqlVisitors and returns a new list with only the SqlVisitors set to apply to rollbacks */
protected List < SqlVisitor > filterRollbackVisitors ( final List < SqlVisitor > visitors ) { } }

implementation: final List < SqlVisitor > rollbackVisitors = new ArrayList < > ( ) ; if ( visitors != null ) { for ( SqlVisitor visitor : visitors ) { if ( visitor . isApplyToRollback ( ) ) { rollbackVisitors . add ( visitor ) ; } } } return rollbackVisitors ;


signature:
public class AbstractJdbcDatabase { /** * Most relational databases support 9 fractional digits , and subclasses must overwrite this method if they
 * support less than that .
 * @ return the maxmimum number of supported fractional digits in TIMESTAMP columns */
@ Override public int getMaxFractionalDigitsForTimestamp ( ) { } }

implementation:
if ( getConnection ( ) == null ) { // if no connection is there we cannot do anything . . .
Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . warning ( LogType . LOG , "No database connection available - specified" + " DATETIME/TIMESTAMP precision will be tried" ) ; return DEFAULT_MAX_TIMESTAMP_FRACTIONAL_DIGITS ; } return DEFAULT_MAX_TIMESTAMP_FRACTIONAL_DIGITS ;


signature:
public class XMLChangeLogSerializer { /** * Catch any characters that will cause problems when parsing the XML down the road .
 * @ throws UnexpectedLiquibaseException with the message { @ link # INVALID _ STRING _ ENCODING _ MESSAGE } if an issue is found . */
protected String checkString ( String text ) throws UnexpectedLiquibaseException { } }

implementation:
if ( null == text || text . isEmpty ( ) ) { return text ; } final int len = text . length ( ) ; char current ; int codePoint ; for ( int i = 0 ; i < len ; i ++ ) { current = text . charAt ( i ) ; if ( Character . isHighSurrogate ( current ) && i + 1 < len && Character . isLowSurrogate ( text . charAt ( i + 1 ) ) ) { codePoint = text . codePointAt ( i ++ ) ; } else { codePoint = current ; } if ( ( codePoint == '\n' ) || ( codePoint == '\r' ) || ( codePoint == '\t' ) || ( codePoint == 0xB ) || ( codePoint == 0xC ) || ( ( codePoint >= 0x20 ) && ( codePoint <= 0x7E ) ) || ( ( codePoint >= 0xA0 ) && ( codePoint <= 0xD7FF ) ) || ( ( codePoint >= 0xE000 ) && ( codePoint <= 0xFFFD ) ) || ( ( codePoint >= 0x10000 ) && ( codePoint <= 0x10FFFF ) ) ) { // ok
} else { throw new UnexpectedLiquibaseException ( INVALID_STRING_ENCODING_MESSAGE ) ; } } return text ;


signature:
public class XMLChangeLogSerializer { /** * create a XML node with nodeName and simple text content */
public Element createNode ( String nodeNamespace , String nodeName , String nodeContent ) { } }

implementation: Element element = currentChangeLogFileDOM . createElementNS ( nodeNamespace , nodeName ) ; element . setTextContent ( nodeContent ) ; return element ;


signature:
public class XMLChangeLogSerializer { /** * Creates a { @ link String } using the XML element representation of this
 * change
 * @ param node the { @ link Element } associated to this change
 * @ param buffer a { @ link StringBuffer } object used to hold the { @ link String }
 * representation of the change */
private void nodeToStringBuffer ( Node node , StringBuffer buffer , int indent ) { } }

implementation: if ( indent >= 0 ) { if ( indent > 0 ) { buffer . append ( "\n" ) ; } buffer . append ( StringUtil . repeat ( " " , indent ) ) ; } buffer . append ( "<" ) . append ( node . getNodeName ( ) ) ; SortedMap < String , String > attributeMap = new TreeMap < > ( ) ; NamedNodeMap attributes = node . getAttributes ( ) ; for ( int i = 0 ; i < attributes . getLength ( ) ; i ++ ) { Node attribute = attributes . item ( i ) ; attributeMap . put ( attribute . getNodeName ( ) , attribute . getNodeValue ( ) ) ; } boolean firstAttribute = true ; for ( Map . Entry entry : attributeMap . entrySet ( ) ) { String value = ( String ) entry . getValue ( ) ; if ( value != null ) { if ( ( indent >= 0 ) && ! firstAttribute && ( attributeMap . size ( ) > 2 ) ) { buffer . append ( "\n" ) . append ( StringUtil . repeat ( " " , indent ) ) . append ( "        " ) ; } else { buffer . append ( " " ) ; } buffer . append ( entry . getKey ( ) ) . append ( "=\"" ) . append ( value ) . append ( "\"" ) ; firstAttribute = false ; } } String textContent = StringUtil . trimToEmpty ( XMLUtil . getTextContent ( node ) ) ; buffer . append ( ">" ) . append ( textContent ) ; boolean sawChildren = false ; NodeList childNodes = node . getChildNodes ( ) ; for ( int i = 0 ; i < childNodes . getLength ( ) ; i ++ ) { Node childNode = childNodes . item ( i ) ; if ( childNode instanceof Element ) { int newIndent = indent ; if ( newIndent >= 0 ) { newIndent += 4 ; } nodeToStringBuffer ( childNode , buffer , newIndent ) ; sawChildren = true ; } } if ( indent >= 0 ) { if ( sawChildren ) { buffer . append ( "\n" ) . append ( StringUtil . repeat ( " " , indent ) ) ; } } if ( ! sawChildren && "" . equals ( textContent ) ) { buffer . replace ( buffer . length ( ) - 1 , buffer . length ( ) , "/>" ) ; } else { buffer . append ( "</" ) . append ( node . getNodeName ( ) ) . append ( ">" ) ; }


signature:
public class DataTypeFactory { /** * Registers an implementation of { @ link LiquibaseDataType } with both its name and all aliases for the data type
 * as a handler in the factory ' s registry . Classes implement the { @ link LiquibaseDataType # getPriority ( ) } , which will
 * cause the class with the highest priority to become the primary handler for the data type .
 * @ param type the implementation to register */
public void register ( LiquibaseDataType type ) { } }

implementation: try { List < String > names = new ArrayList < > ( ) ; names . add ( type . getName ( ) ) ; names . addAll ( Arrays . asList ( type . getAliases ( ) ) ) ; Comparator < Class < ? extends LiquibaseDataType > > comparator = ( o1 , o2 ) -> { try { return - 1 * Integer . compare ( o1 . getConstructor ( ) . newInstance ( ) . getPriority ( ) , o2 . getConstructor ( ) . newInstance ( ) . getPriority ( ) ) ; } catch ( Exception e ) { throw new UnexpectedLiquibaseException ( e ) ; } } ; for ( String name : names ) { name = name . toLowerCase ( Locale . US ) ; registry . computeIfAbsent ( name , k -> new ArrayList < > ( ) ) ; List < Class < ? extends LiquibaseDataType > > classes = registry . get ( name ) ; classes . add ( type . getClass ( ) ) ; classes . sort ( comparator ) ; } } catch ( Exception e ) { throw new UnexpectedLiquibaseException ( e ) ; }


signature:
public class DataTypeFactory { /** * Translates a column data type definition ( e . g . varchar ( 255 ) , java . sql . Types . NVARCHAR ( 10 ) ,
 * VARCHAR2(255 BYTE ) . . . ) into a normalized data type in object form . Note that , due to variety of allowed ways
 * to specify a data type ( SQL - Standard , Java type , native RDBMS type . . . ) , the dataTypeDefinition we receive for
 * processing may already be the native type for the target RDBMS .
 * @ param dataTypeDefinition the definition from the changeSet
 * @ param database the { @ link Database } object from for which the native definition is to be generated
 * @ return the corresponding Liquibase data type in object form . */
public LiquibaseDataType fromDescription ( String dataTypeDefinition , Database database ) { } }

implementation:
if ( dataTypeDefinition == null ) { return null ; } String dataTypeName = dataTypeDefinition ; // Remove the first occurrence of ( anything within parentheses ) . This will remove the size information from
// most data types , e . g . VARCHAR2(255 CHAR ) - > VARCHAR2 . We will retrieve that length information again later ,
// but for the moment , we are only interested in the " naked " data type name .
if ( dataTypeName . matches ( ".+\\(.*\\).*" ) ) { dataTypeName = dataTypeName . replaceFirst ( "\\s*\\(.*\\)" , "" ) ; } // Remove everything { after the first opening curly bracket
// e . g . int { autoIncrement : true } " - > " int "
if ( dataTypeName . matches ( ".+\\{.*" ) ) { dataTypeName = dataTypeName . replaceFirst ( "\\s*\\{.*" , "" ) ; } // If the remaining string ends with " identity " , then remove the " identity " and remember than we want
// to set the autoIncrement property later .
boolean autoIncrement = false ; if ( dataTypeName . toLowerCase ( Locale . US ) . endsWith ( " identity" ) ) { dataTypeName = dataTypeName . toLowerCase ( Locale . US ) . replaceFirst ( " identity$" , "" ) ; autoIncrement = true ; } // unquote delimited identifiers
final String [ ] [ ] quotePairs = new String [ ] [ ] { { "\"" , "\"" } , // double quotes
{ "[" , "]" } , // square brackets ( a la mssql )
{ "`" , "`" } , // backticks ( a la mysql )
{ "'" , "'" } // single quotes
} ; for ( String [ ] quotePair : quotePairs ) { String openQuote = quotePair [ 0 ] ; String closeQuote = quotePair [ 1 ] ; if ( dataTypeName . startsWith ( openQuote ) ) { int indexOfCloseQuote = dataTypeName . indexOf ( closeQuote , openQuote . length ( ) ) ; if ( ( indexOfCloseQuote != - 1 ) && ( dataTypeName . indexOf ( closeQuote , indexOfCloseQuote + closeQuote . length ( ) ) == - 1 ) ) { dataTypeName = dataTypeName . substring ( openQuote . length ( ) , indexOfCloseQuote ) + dataTypeName . substring ( indexOfCloseQuote + closeQuote . length ( ) , dataTypeName . length ( ) ) ; break ; } } } // record additional information that is still attached to the data type name
String additionalInfo = null ; if ( dataTypeName . toLowerCase ( Locale . US ) . startsWith ( "bit varying" ) || dataTypeName . toLowerCase ( Locale . US ) . startsWith ( "character varying" ) ) { // not going to do anything . Special case for postgres in our tests ,
// need to better support handling these types of differences
} else { // Heuristic : from what we now have left of the data type name , everything after the first space
// is counted as additional information .
String [ ] splitTypeName = dataTypeName . trim ( ) . split ( "\\s+" , 2 ) ; dataTypeName = splitTypeName [ 0 ] ; if ( splitTypeName . length > 1 ) { additionalInfo = splitTypeName [ 1 ] ; } } // try to find matching classes for the data type name in our registry
Collection < Class < ? extends LiquibaseDataType > > classes = registry . get ( dataTypeName . toLowerCase ( Locale . US ) ) ; LiquibaseDataType liquibaseDataType = null ; if ( classes == null ) { // Map ( date / time ) INTERVAL types to the UnknownType
if ( dataTypeName . toUpperCase ( Locale . US ) . startsWith ( "INTERVAL" ) ) { liquibaseDataType = new UnknownType ( dataTypeDefinition ) ; } else { liquibaseDataType = new UnknownType ( dataTypeName ) ; } } else { // Iterate through the list ( which is already sorted by priority ) until we find a class
// for this dataTypeName that supports the given database .
Iterator < Class < ? extends LiquibaseDataType > > iterator = classes . iterator ( ) ; do { try { liquibaseDataType = iterator . next ( ) . getConstructor ( ) . newInstance ( ) ; } catch ( Exception e ) { throw new UnexpectedLiquibaseException ( e ) ; } } while ( ( database != null ) && ! liquibaseDataType . supports ( database ) && iterator . hasNext ( ) ) ; } if ( ( database != null ) && ! liquibaseDataType . supports ( database ) ) { throw new UnexpectedLiquibaseException ( "Could not find type for " + liquibaseDataType . toString ( ) + " for DBMS " + database . getShortName ( ) ) ; } if ( liquibaseDataType == null ) { liquibaseDataType = new UnknownType ( dataTypeName ) ; } liquibaseDataType . setAdditionalInformation ( additionalInfo ) ; // Does the type string have the form " some _ data _ type ( additional , info , separated , by , commas ) " ?
// If so , process these as additional data type parameters .
if ( dataTypeDefinition . matches ( ".+\\s*\\(.*" ) ) { // Cut out the part between the first ( )
String paramStrings = dataTypeDefinition . replaceFirst ( ".*?\\(" , "" ) . replaceFirst ( "\\).*" , "" ) ; String [ ] params = paramStrings . split ( "," ) ; for ( String param : params ) { param = StringUtil . trimToNull ( param ) ; if ( param != null ) { if ( ( liquibaseDataType instanceof CharType ) && ! ( database instanceof OracleDatabase ) ) { // TODO this might lead to wrong snapshot results in Oracle Database , because it assumes
// NLS _ LENGTH _ SEMANTICS = BYTE . If NLS _ LENGTH _ SEMANTICS = CHAR , we need to trim " CHAR " instead .
// not sure what else supports it :
param = param . replaceFirst ( " BYTE" , "" ) ; // only use byte types on oracle ,
} liquibaseDataType . addParameter ( param ) ; } } } // Did the original definition have embedded information in curly braces , e . g .
// " int { autoIncrement : true } " ? If so , we will extract and process it now .
if ( dataTypeDefinition . matches ( ".*\\{.*" ) ) { String paramStrings = dataTypeDefinition . replaceFirst ( ".*?\\{" , "" ) . replaceFirst ( "\\}.*" , "" ) ; String [ ] params = paramStrings . split ( "," ) ; for ( String param : params ) { param = StringUtil . trimToNull ( param ) ; if ( param != null ) { String [ ] paramAndValue = param . split ( ":" , 2 ) ; // TODO : A run - time exception will occur here if the user writes a property name into the
// data type which does not exist - but what else could we do in this case , except aborting ?
ObjectUtil . setProperty ( liquibaseDataType , paramAndValue [ 0 ] , paramAndValue [ 1 ] ) ; } } } if ( autoIncrement && ( liquibaseDataType instanceof IntType ) ) { ( ( IntType ) liquibaseDataType ) . setAutoIncrement ( true ) ; } if ( autoIncrement && ( liquibaseDataType instanceof BigIntType ) ) { ( ( BigIntType ) liquibaseDataType ) . setAutoIncrement ( true ) ; } liquibaseDataType . finishInitialization ( dataTypeDefinition ) ; return liquibaseDataType ;


signature: public class DiffToReport { protected void printComparison ( String title , StringDiff string , PrintStream out ) { } }

implementation: out . print ( title + ":" ) ; if ( string == null ) { out . print ( "NULL" ) ; return ; } if ( string . areEqual ( ) ) { out . println ( " EQUAL" ) ; } else { String referenceVersion = string . getReferenceVersion ( ) ; if ( referenceVersion == null ) { referenceVersion = "NULL" ; } else { referenceVersion = "'" + referenceVersion + "'" ; } String targetVersion = string . getTargetVersion ( ) ; if ( targetVersion == null ) { targetVersion = "NULL" ; } else { targetVersion = "'" + targetVersion + "'" ; } out . println ( ) ; out . println ( "     Reference:   " + referenceVersion ) ; out . println ( "     Target: " + targetVersion ) ; }


signature:
public class DefaultLoggerConfiguration { /** * Transforms the strings DEBUG , INFO , WARNING , ERROR and OFF ( case - insensitive ) into the appropriate LogLevel .
 * @ return a value from the LogLevel enum */
public LogLevel getLogLevel ( ) { } }

implementation: String logLevel = getLogLevelName ( ) ; if ( "debug" . equalsIgnoreCase ( logLevel ) ) { return LogLevel . DEBUG ; } else if ( "info" . equalsIgnoreCase ( logLevel ) ) { return LogLevel . INFO ; } else if ( "warning" . equalsIgnoreCase ( logLevel ) ) { return LogLevel . WARNING ; } else if ( "error" . equalsIgnoreCase ( logLevel ) || "severe" . equalsIgnoreCase ( logLevel ) ) { return LogLevel . SEVERE ; } else if ( "off" . equalsIgnoreCase ( logLevel ) ) { return LogLevel . OFF ; } else { throw new UnexpectedLiquibaseException ( "Unknown log level: " + logLevel + ".  Valid levels are: debug, info, warning, error, off" ) ; }


signature:
public class Validate { /** * Throws exception if passed object is null */
public static void notNull ( Object object , String failMessage ) throws UnexpectedLiquibaseException { } }

implementation: if ( object == null ) { fail ( failMessage ) ; }


signature:
public class SybaseDatabase { /** * package private to facilitate testing */
boolean isSybaseProductName ( String dbProductName ) { } }

implementation: return PRODUCT_NAME . equals ( dbProductName ) || "Sybase SQL Server" . equals ( dbProductName ) || "sql server" . equals ( dbProductName ) || "ASE" . equals ( dbProductName ) ;


signature:
public class SqlVisitorFactory { /** * Create a new Change subclass based on the given tag name . */
public SqlVisitor create ( String tagName ) { } }

implementation: Class < ? > aClass = tagToClassMap . get ( tagName ) ; if ( aClass == null ) { return null ; } try { return ( SqlVisitor ) aClass . getConstructor ( ) . newInstance ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }


signature:
public class NetUtil { /** * Smarter way to get localhost than InetAddress . getLocalHost . See http : / / bugs . sun . com / bugdatabase / view _ bug . do ? bug _ id = 4665037 */
private static InetAddress getLocalHost ( ) throws UnknownHostException , SocketException { } }

implementation:
// Windows Vista returns the IPv6 InetAddress using this method , which is not
// particularly useful as it has no name or useful address , just " 0:0:0:0:0:0:0:1 " .
// That is why windows should be treated differently to linux / unix and use the
// default way of getting the localhost .
String osName = System . getProperty ( "os.name" ) ; if ( ( osName != null ) && osName . toLowerCase ( ) . contains ( "windows" ) ) { return InetAddress . getLocalHost ( ) ; } InetAddress loopback = null ; Enumeration < NetworkInterface > e = NetworkInterface . getNetworkInterfaces ( ) ; while ( e . hasMoreElements ( ) ) { NetworkInterface i = e . nextElement ( ) ; if ( i . isUp ( ) && ! i . isPointToPoint ( ) ) { Enumeration < InetAddress > ie = i . getInetAddresses ( ) ; while ( ie . hasMoreElements ( ) ) { InetAddress lch = ie . nextElement ( ) ; if ( lch . isLoopbackAddress ( ) ) { loopback = lch ; } else if ( ! lch . isLinkLocalAddress ( ) ) { return lch ; } } } } return loopback ;


signature:
public class NetUtil { /** * Returns Local Host IP Address
 * @ return local Host IP address
 * @ throws UnknownHostException
 * @ throws SocketException */
public static String getLocalHostAddress ( ) throws UnknownHostException , SocketException { } }

implementation: try { return getLocalHost ( ) . getHostAddress ( ) ; } catch ( Exception e ) { Scope . getCurrentScope ( ) . getLog ( NetUtil . class ) . fine ( LogType . LOG , "Error getting hostname" , e ) ; return "unknown" ; }