Package org.apache.maven.api.model
Class InputSource
java.lang.Object
org.apache.maven.api.model.InputSource
- All Implemented Interfaces:
Serializable
Represents the source of a model input, such as a POM file.
This class tracks the origin of model elements, providing location information used primarily for error reporting and debugging to help identify where specific model elements came from. The location typically represents a file path, URL, or other identifier that describes the source of the input.
InputSource instances are immutable and can be safely shared across threads. The class provides factory methods for convenient creation of instances.
- Since:
- 4.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInputSource(String modelId, String location) InputSource(String modelId, String location, InputLocation importedFrom) InputSource(Collection<InputSource> inputs) -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the parent InputLocation where this InputLocation may have been imported from.Gets the path/URL of the input source ornullif unknown.Get the identifier of the POM in the format<groupId>:<artifactId>:<version>.inthashCode()static InputSourcemerge(InputSource src1, InputSource src2) Merges two InputSource instances into a single merged InputSource.static InputSourceCreates a new InputSource with the specified location.static InputSourceCreates a new InputSource with the specified model ID and location.static InputSourceof(String modelId, String location, InputLocation importedFrom) Creates a new InputSource with the specified model ID, location, and imported from location.static InputSourceof(Collection<InputSource> inputs) Creates a new InputSource from a collection of input sources.toString()
-
Constructor Details
-
InputSource
-
InputSource
-
InputSource
-
-
Method Details
-
of
Creates a new InputSource with the specified location. The location typically represents a file path, URL, or other identifier that describes where the input originated from.- Parameters:
location- the path/URL of the input source, may be null- Returns:
- a new InputSource instance
-
of
Creates a new InputSource with the specified model ID and location. The created instance is processed through ModelObjectProcessor for optimization.- Parameters:
modelId- the model IDlocation- the location- Returns:
- a new InputSource instance
-
of
Creates a new InputSource with the specified model ID, location, and imported from location. The created instance is processed through ModelObjectProcessor for optimization.- Parameters:
modelId- the model IDlocation- the locationimportedFrom- the imported from location- Returns:
- a new InputSource instance
-
of
Creates a new InputSource from a collection of input sources. The created instance is processed through ModelObjectProcessor for optimization.- Parameters:
inputs- the collection of input sources- Returns:
- a new InputSource instance
-
getLocation
Gets the path/URL of the input source ornullif unknown.The location typically represents a file path, URL, or other identifier that describes where the input originated from. This information is primarily used for error reporting and debugging purposes.
- Returns:
- the location string, or null if unknown
-
getModelId
Get the identifier of the POM in the format<groupId>:<artifactId>:<version>.- Returns:
- the model id
-
getImportedFrom
Gets the parent InputLocation where this InputLocation may have been imported from. Can returnnull.- Returns:
- InputLocation
- Since:
- 4.0.0
-
equals
-
hashCode
public int hashCode() -
toString
-
merge
Merges two InputSource instances into a single merged InputSource. The resulting InputSource will contain all distinct sources from both inputs.- Parameters:
src1- the first input source to mergesrc2- the second input source to merge- Returns:
- a new merged InputSource containing all distinct sources from both inputs
-