Class PropertyContainer

java.lang.Object
io.spring.initializr.generator.buildsystem.PropertyContainer

public class PropertyContainer extends Object
A container for properties. Arbitrary properties can be specified as well as ones that refer to a version.
Author:
Stephane Nicoll
  • Constructor Details

    • PropertyContainer

      public PropertyContainer()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Specify if this container is empty.
      Returns:
      true if no property is registered
    • has

      public boolean has(String name)
      Specify if this container has a property with the specified name.
      Parameters:
      name - the name of a property
      Returns:
      true if a property with the specified name is registered
    • property

      public PropertyContainer property(String name, String value)
      Register a property with the specified name and value. If a property with that name already exists, its value is overridden by the specified value.
      Parameters:
      name - the name of a property
      value - the value of the property
      Returns:
      this container
      See Also:
    • version

      public PropertyContainer version(VersionProperty versionProperty, String version)
      Register a property that refers to the specified version. If a version with the same VersionProperty already exists, its value is overridden by the specified version.
      Parameters:
      versionProperty - the name of a version
      version - the version
      Returns:
      this container
    • version

      public PropertyContainer version(String name, String version)
      Register a public VersionProperty with the specified name. If a version with the same name already exists, its value is overridden by the specified version.
      Parameters:
      name - the public name of a version
      version - the version
      Returns:
      this container
      See Also:
    • values

      public Stream<Map.Entry<String,String>> values()
      Return the registered properties. Does not contain registered versions.
      Returns:
      the property entries
    • versions

      public Stream<Map.Entry<String,String>> versions(Function<VersionProperty,String> nameFactory)
      Return the registered versions using the specified nameFactory.
      Parameters:
      nameFactory - the factory to use to generate a version name based on a VersionProperty
      Returns:
      the version entries.