Class 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 java.lang.String key  
      private java.lang.String originalValue  
    • Constructor Summary

      Constructors 
      Constructor Description
      SystemPropertySaveEnvironmentFacet​(java.lang.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 in setup() 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.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • key

        private final java.lang.String key
      • originalValue

        private final java.lang.String originalValue
    • Constructor Detail

      • SystemPropertySaveEnvironmentFacet

        public SystemPropertySaveEnvironmentFacet​(java.lang.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 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object