Class AbstractVersionProvider<T>
java.lang.Object
org.craftercms.commons.upgrade.impl.providers.AbstractVersionProvider<T>
- Type Parameters:
T
- The target type supported
- All Implemented Interfaces:
VersionProvider<T>
- Direct Known Subclasses:
AbstractFileVersionProvider
Base class for all
VersionProvider
implementations- Since:
- 3.1.5
- Author:
- joseross
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
The default value to use when no version is found, defaults toVersionProvider.SKIP
protected org.slf4j.Logger
Fields inherited from interface org.craftercms.commons.upgrade.VersionProvider
SKIP, VERSION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
doGetVersion
(UpgradeContext<T> context) protected abstract void
doSetVersion
(UpgradeContext<T> context, String version) getVersion
(UpgradeContext<T> context) Returns the current versionvoid
setDefaultValue
(String defaultValue) void
setVersion
(UpgradeContext<T> context, String version) Updates the current version
-
Field Details
-
logger
protected org.slf4j.Logger logger -
defaultValue
The default value to use when no version is found, defaults toVersionProvider.SKIP
-
-
Constructor Details
-
AbstractVersionProvider
public AbstractVersionProvider()
-
-
Method Details
-
setDefaultValue
-
getVersion
Description copied from interface:VersionProvider
Returns the current version- Specified by:
getVersion
in interfaceVersionProvider<T>
- Parameters:
context
- the upgrade context- Returns:
- version number
- Throws:
UpgradeException
- if there is any error getting the current version
-
doGetVersion
- Throws:
Exception
-
setVersion
Description copied from interface:VersionProvider
Updates the current version- Specified by:
setVersion
in interfaceVersionProvider<T>
- Parameters:
context
- the upgrade contextversion
- the new version- Throws:
UpgradeException
- if there is any error setting the current version
-
doSetVersion
- Throws:
Exception
-