Class SystemPropertySaveEnvironmentFacet
- java.lang.Object
-
- org.codehaus.mojo.jaxb2.shared.environment.AbstractLogAwareFacet
-
- org.codehaus.mojo.jaxb2.shared.environment.sysprops.SystemPropertySaveEnvironmentFacet
-
- All Implemented Interfaces:
EnvironmentFacet
public final class SystemPropertySaveEnvironmentFacet extends AbstractLogAwareFacet
EnvironmentFacet which saves the value of a system property for the duration of executing a tool. This may be required for tools (such as the XJC tool) which may overwrite property values for its own purpose. UnlikeSystemPropertyChangeEnvironmentFacet
, this does not a set a new property value itself, just saves the old value and later restores or clears it. This facet accepts the key of the property to save.- Since:
- 2.5
- Author:
- Svein Elgstøen
-
-
Field Summary
-
Fields inherited from class org.codehaus.mojo.jaxb2.shared.environment.AbstractLogAwareFacet
log
-
-
Constructor Summary
Constructors Constructor Description SystemPropertySaveEnvironmentFacet(String key, org.apache.maven.plugin.logging.Log log)
Creates a SystemPropertySave which will remember the original value of the supplied system property for the duration of this SystemPropertySave.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
restore()
Restores the original Environment, implying that the change performed insetup()
method are restored to the state before the setup method was called.void
setup()
Sets up this Environment, inferring temporary changes to environment variables or conditions.String
toString()
-
-
-
Constructor Detail
-
SystemPropertySaveEnvironmentFacet
public SystemPropertySaveEnvironmentFacet(String key, org.apache.maven.plugin.logging.Log log)
Creates a SystemPropertySave which will remember the original value of the supplied system property for the duration of this SystemPropertySave.- Parameters:
key
- A non-null key.log
- The active Maven Log.
-
-
Method Detail
-
restore
public void restore()
Restores the original Environment, implying that the change performed insetup()
method are restored to the state before the setup method was called.
-
setup
public void setup()
Sets up this Environment, inferring temporary changes to environment variables or conditions. The changes must be reversible, and should be restored to their original values in therestore()
method.
-
-