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. Unlike SystemPropertyChangeEnvironmentFacet, 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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String
     
    private final String
     

    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

    Modifier and Type
    Method
    Description
    void
    Restores the original Environment, implying that the change performed in setup() method are restored to the state before the setup method was called.
    void
    Sets up this Environment, inferring temporary changes to environment variables or conditions.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • key

      private final String key
    • originalValue

      private final String originalValue
  • Constructor Details

    • 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 Details

    • restore

      public void restore()
      Restores the original Environment, implying that the change performed in setup() 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 the restore() method.
    • toString

      public String toString()
      Overrides:
      toString in class Object