Class InputSource

java.lang.Object
org.apache.maven.api.toolchain.InputSource
All Implemented Interfaces:
Serializable

public final class InputSource extends Object implements 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 Details

  • Method Details

    • of

      public static InputSource of(String location)
      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
    • getLocation

      public String getLocation()
      Gets the path/URL of the input source or null if 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
    • getImportedFrom

      public InputLocation getImportedFrom()
      Gets the parent InputLocation where this InputLocation may have been imported from. Can return null.
      Returns:
      InputLocation
      Since:
      4.0.0
    • equals

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

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

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

      public static InputSource merge(InputSource src1, InputSource src2)
      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 merge
      src2 - the second input source to merge
      Returns:
      a new merged InputSource containing all distinct sources from both inputs