Record Class ResolvedFilePath

java.lang.Object
java.lang.Record
ortus.boxlang.runtime.util.ResolvedFilePath

public record ResolvedFilePath(String mappingName, String mappingPath, String relativePath, Path absolutePath) extends Record
I represent the a file path that has been resolved to an absolute path. I track additional data such as what mapping was used to resolve the path.
  • Constructor Details

    • ResolvedFilePath

      public ResolvedFilePath(String mappingName, String mappingPath, String relativePath, Path absolutePath)
      Creates an instance of a ResolvedFilePath record class.
      Parameters:
      mappingName - the value for the mappingName record component
      mappingPath - the value for the mappingPath record component
      relativePath - the value for the relativePath record component
      absolutePath - the value for the absolutePath record component
  • Method Details

    • of

      public static ResolvedFilePath of(String mappingName, String mappingPath, String relativePath, Path absolutePath)
      Factor method to create a new ResolvedFilePath instance.
      Parameters:
      mappingName - The mapping name used to resolve the path.
      mappingPath - The mapping path used to resolve the path.
      relativePath - The relative path that was resolved
      absolutePath - The absolute path resolved.
      Returns:
      A new ResolvedFilePath instance.
    • of

      public static ResolvedFilePath of(String mappingName, String mappingPath, String relativePath, String absolutePath)
      Factory method to create a new ResolvedFilePath instance, but using a string for the absolute path.
      Parameters:
      mappingName - The mapping name used to resolve the path.
      mappingPath - The mapping path used to resolve the path.
      relativePath - The relative path that was resolved
      absolutePath - The absolute path resolved.
      Returns:
      A new ResolvedFilePath instance.
    • of

      public static ResolvedFilePath of(Path absolutePath)
      Factory method to create a new ResolvedFilePath instance using only an absolute path.
      Parameters:
      absolutePath - The absolute path resolved.
      Returns:
      A new ResolvedFilePath instance.
    • of

      public static ResolvedFilePath of(String absolutePath)
      Factory method to create a new ResolvedFilePath instance using only an absolute path which is a string
      Parameters:
      absolutePath - The absolute path resolved.
      Returns:
      A new ResolvedFilePath instance.
    • resolvedViaMapping

      public boolean resolvedViaMapping()
      Was the path resolved via a mapping?
      Returns:
      true if the path was resolved via a mapping.
    • getFQN

      public FQN getFQN(String prefix)
      Get the package of the resolved path, but with a prefix prepended in front
      Parameters:
      prefix - The prefix to prepend to the package.
      Returns:
      The package of the resolved path with the prefix prepended.
    • getFQN

      public FQN getFQN()
      Get the package of the resolved path.
      Returns:
      The package of the resolved path.
    • getBoxFQN

      public BoxFQN getBoxFQN()
      Get the Box package of the resolved path.
      Returns:
      The package of the resolved path.
    • getBoxFQN

      public BoxFQN getBoxFQN(String prefix)
      Get the Box package of the resolved path, but with a prefix prepended in front
      Parameters:
      prefix - The prefix to prepend to the package.
      Returns:
      The package of the resolved path with the prefix prepended.
    • newFromRelative

      public ResolvedFilePath newFromRelative(IBoxContext context, String relativePath)
      Create a new ResolvedFilePath instance from a path relative to the current path.
      Parameters:
      relativePath - The relative path to create a new ResolvedFilePath instance from.
      Returns:
      A new ResolvedFilePath instance.
    • 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.
    • mappingName

      public String mappingName()
      Returns the value of the mappingName record component.
      Returns:
      the value of the mappingName record component
    • mappingPath

      public String mappingPath()
      Returns the value of the mappingPath record component.
      Returns:
      the value of the mappingPath record component
    • relativePath

      public String relativePath()
      Returns the value of the relativePath record component.
      Returns:
      the value of the relativePath record component
    • absolutePath

      public Path absolutePath()
      Returns the value of the absolutePath record component.
      Returns:
      the value of the absolutePath record component