Class PomEditor.Properties

java.lang.Object
eu.maveniverse.domtrip.maven.PomEditor.Properties
Enclosing class:
PomEditor

public class PomEditor.Properties extends Object
Since:
0.1
  • Constructor Details

    • Properties

      public Properties()
  • Method Details

    • addProperty

      public eu.maveniverse.domtrip.Element addProperty(eu.maveniverse.domtrip.Element propertiesElement, String propertyName, String propertyValue) throws eu.maveniverse.domtrip.DomTripException
      Adds a property to the properties section.
      Parameters:
      propertiesElement - the properties container element
      propertyName - the name of the property
      propertyValue - the value of the property
      Returns:
      the newly created property element
      Throws:
      eu.maveniverse.domtrip.DomTripException - if the property cannot be added
    • updateProperty

      public boolean updateProperty(boolean upsert, String key, String value) throws eu.maveniverse.domtrip.DomTripException
      Updates or inserts a property value in project/properties/key.

      If the property already exists, its value is updated. If upsert is true and the property doesn't exist, it will be created (along with the properties element if needed).

      Parameters:
      upsert - whether to create the property if it doesn't exist
      key - the property name
      value - the property value
      Returns:
      true if the property was updated or created, false otherwise
      Throws:
      eu.maveniverse.domtrip.DomTripException - if an error occurs during editing
    • deleteProperty

      public boolean deleteProperty(String key) throws eu.maveniverse.domtrip.DomTripException
      Removes a property from project/properties/key.
      Parameters:
      key - the property name
      Returns:
      true if the property was removed, false if it didn't exist
      Throws:
      eu.maveniverse.domtrip.DomTripException