Package ortus.boxlang.runtime.util
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 Summary
ConstructorsConstructorDescriptionResolvedFilePath
(String mappingName, String mappingPath, String relativePath, Path absolutePath) Creates an instance of aResolvedFilePath
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theabsolutePath
record component.final boolean
Indicates whether some other object is "equal to" this one.Get the Box package of the resolved path.Get the Box package of the resolved path, but with a prefix prepended in frontgetFQN()
Get the package of the resolved path.Get the package of the resolved path, but with a prefix prepended in frontfinal int
hashCode()
Returns a hash code value for this object.Returns the value of themappingName
record component.Returns the value of themappingPath
record component.newFromRelative
(IBoxContext context, String relativePath) Create a new ResolvedFilePath instance from a path relative to the current path.static ResolvedFilePath
Factory method to create a new ResolvedFilePath instance using only an absolute path which is a stringstatic ResolvedFilePath
Factory method to create a new ResolvedFilePath instance, but using a string for the absolute path.static ResolvedFilePath
Factor method to create a new ResolvedFilePath instance.static ResolvedFilePath
Factory method to create a new ResolvedFilePath instance using only an absolute path.Returns the value of therelativePath
record component.boolean
Was the path resolved via a mapping?final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ResolvedFilePath
public ResolvedFilePath(String mappingName, String mappingPath, String relativePath, Path absolutePath) Creates an instance of aResolvedFilePath
record class.- Parameters:
mappingName
- the value for themappingName
record componentmappingPath
- the value for themappingPath
record componentrelativePath
- the value for therelativePath
record componentabsolutePath
- the value for theabsolutePath
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 resolvedabsolutePath
- 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 resolvedabsolutePath
- The absolute path resolved.- Returns:
- A new ResolvedFilePath instance.
-
of
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
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
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
Get the package of the resolved path.- Returns:
- The package of the resolved path.
-
getBoxFQN
Get the Box package of the resolved path.- Returns:
- The package of the resolved path.
-
getBoxFQN
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
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
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
mappingName
Returns the value of themappingName
record component.- Returns:
- the value of the
mappingName
record component
-
mappingPath
Returns the value of themappingPath
record component.- Returns:
- the value of the
mappingPath
record component
-
relativePath
Returns the value of therelativePath
record component.- Returns:
- the value of the
relativePath
record component
-
absolutePath
Returns the value of theabsolutePath
record component.- Returns:
- the value of the
absolutePath
record component
-