Class InputLocation

java.lang.Object
org.apache.maven.api.model.InputLocation
All Implemented Interfaces:
Serializable, InputLocationTracker

public class InputLocation extends Object implements Serializable, InputLocationTracker
Represents the location of an element within a model source file.

This class tracks the line and column numbers of elements in source files like POM files. It's used for error reporting and debugging to help identify where specific model elements are defined in the source files.

Since:
4.0.0
See Also:
  • Constructor Details

    • InputLocation

      public InputLocation(InputSource source)
    • InputLocation

      public InputLocation(int lineNumber, int columnNumber)
    • InputLocation

      public InputLocation(int lineNumber, int columnNumber, InputSource source)
    • InputLocation

      public InputLocation(int lineNumber, int columnNumber, InputSource source, Object selfLocationKey)
    • InputLocation

      public InputLocation(int lineNumber, int columnNumber, InputSource source, Map<Object, InputLocation> locations)
    • InputLocation

      public InputLocation(InputLocation original)
  • Method Details

    • getLineNumber

      public int getLineNumber()
    • getColumnNumber

      public int getColumnNumber()
    • getSource

      public InputSource getSource()
    • getLocation

      public InputLocation getLocation(Object key)
      Specified by:
      getLocation in interface InputLocationTracker
    • getLocations

      public Map<Object, InputLocation> getLocations()
    • getImportedFrom

      public InputLocation getImportedFrom()
      Gets the parent InputLocation where this InputLocation may have been imported from. Can return null.
      Specified by:
      getImportedFrom in interface InputLocationTracker
      Returns:
      InputLocation
      Since:
      4.0.0
    • merge

      public static InputLocation merge(InputLocation target, InputLocation source, boolean sourceDominant)
      Merges the source location into the target location.
      Parameters:
      target - the target location
      source - the source location
      sourceDominant - the boolean indicating of source is dominant compared to target
      Returns:
      the merged location
    • merge

      public static InputLocation merge(InputLocation target, InputLocation source, Collection<Integer> indices)
      Merges the source location into the target location. This method is used when the locations refer to lists and also merges the indices.
      Parameters:
      target - the target location
      source - the source location
      indices - the list of integers for the indices
      Returns:
      the merged location
    • toString

      public String toString()
      Overrides:
      toString in class Object