Record Class NestedLocation

java.lang.Object
java.lang.Record
org.springframework.boot.loader.net.protocol.nested.NestedLocation
Record Components:
path - the path to the zip that contains the nested entry
nestedEntryName - the nested entry name

public record NestedLocation(Path path, String nestedEntryName) extends Record
A location obtained from a nested: URL consisting of a jar file and an optional nested entry.

The syntax of a nested JAR URL is:

 nestedjar:<path>/!{entry}
 

for example:

nested:/home/example/my.jar/!BOOT-INF/lib/my-nested.jar

or:

nested:/home/example/my.jar/!BOOT-INF/classes/

The path must refer to a jar file on the file system. The entry refers to either an uncompressed entry that contains the nested jar, or a directory entry. The entry must not start with a '/'.

Since:
3.2.0
Author:
Phillip Webb, Andy Wilkinson
  • Constructor Details

    • NestedLocation

      public NestedLocation(Path path, String nestedEntryName)
      Creates an instance of a NestedLocation record class.
      Parameters:
      path - the value for the path record component
      nestedEntryName - the value for the nestedEntryName record component
  • Method Details

    • fromUrl

      public static NestedLocation fromUrl(URL url)
      Create a new NestedLocation from the given URL.
      Parameters:
      url - the nested URL
      Returns:
      a new NestedLocation instance
      Throws:
      IllegalArgumentException - if the URL is not valid
    • fromUri

      public static NestedLocation fromUri(URI uri)
      Create a new NestedLocation from the given URI.
      Parameters:
      uri - the nested URI
      Returns:
      a new NestedLocation instance
      Throws:
      IllegalArgumentException - if the URI is not valid
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • path

      public Path path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • nestedEntryName

      public String nestedEntryName()
      Returns the value of the nestedEntryName record component.
      Returns:
      the value of the nestedEntryName record component