java.lang.Object
org.springframework.boot.buildpack.platform.docker.type.VolumeName

public final class VolumeName extends Object
A Docker volume name.
Since:
2.3.0
Author:
Phillip Webb
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • random

      public static VolumeName random(String prefix)
      Factory method to create a new VolumeName with a random name.
      Parameters:
      prefix - the prefix to use with the random name
      Returns:
      a randomly named volume
    • random

      public static VolumeName random(String prefix, int randomLength)
      Factory method to create a new VolumeName with a random name.
      Parameters:
      prefix - the prefix to use with the random name
      randomLength - the number of chars in the random part of the name
      Returns:
      a randomly volume reference
    • basedOn

      public static <S> VolumeName basedOn(S source, String prefix, String suffix, int digestLength)
      Factory method to create a new VolumeName based on an object. The resulting name will be based off a SHA-256 digest of the given object's toString() method.
      Type Parameters:
      S - the source object type
      Parameters:
      source - the source object
      prefix - the prefix to use with the volume name
      suffix - the suffix to use with the volume name
      digestLength - the number of chars in the digest part of the name
      Returns:
      a name based off the image reference
    • basedOn

      public static <S> VolumeName basedOn(S source, Function<S,String> nameExtractor, String prefix, String suffix, int digestLength)
      Factory method to create a new VolumeName based on an object. The resulting name will be based off a SHA-256 digest of the given object's name.
      Type Parameters:
      S - the source object type
      Parameters:
      source - the source object
      nameExtractor - a method to extract the name of the object
      prefix - the prefix to use with the volume name
      suffix - the suffix to use with the volume name
      digestLength - the number of chars in the digest part of the name
      Returns:
      a name based off the image reference
    • of

      public static VolumeName of(String value)
      Factory method to create a VolumeName with a specific value.
      Parameters:
      value - the volume reference value
      Returns:
      a new VolumeName instance