liquibase.configuration.core.ScopeValueProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
package liquibase.configuration.core;
import liquibase.Scope;
import liquibase.configuration.AbstractConfigurationValueProvider;
import liquibase.configuration.ProvidedValue;
import java.util.Properties;
/**
* Searches the {@link liquibase.Scope} for the given key.
* Does not perform any key smoothing/translating.
*/
public class ScopeValueProvider extends AbstractConfigurationValueProvider {
@Override
public int getPrecedence() {
return 400;
}
@Override
public ProvidedValue getProvidedValue(String... keyAndAliases) {
if (keyAndAliases == null || keyAndAliases.length == 0) {
return null;
}
for (String key : keyAndAliases) {
final Object value = Scope.getCurrentScope().get(key, Object.class);
if (value == null) {
continue;
}
return new ProvidedValue(keyAndAliases[0], key, value, "Scoped value", this);
}
return null;
}
protected Properties getSystemProperties() {
return System.getProperties();
}
}