Class InputLocation

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

public final class InputLocation extends Object implements Serializable, Cloneable, InputLocationTracker
Class InputLocation.
Version:
$Revision$ $Date$
See Also:
  • Constructor Details

    • InputLocation

      public InputLocation(InputLocation location)
      Creates a new InputLocation from an API model InputLocation. This constructor is used for converting between the API model and the compat model.
      Parameters:
      location - the API model InputLocation to convert from
    • InputLocation

      public InputLocation(int lineNumber, int columnNumber)
    • InputLocation

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

    • clone

      public InputLocation clone()
      Method clone.
      Overrides:
      clone in class Object
      Returns:
      InputLocation
    • getColumnNumber

      public int getColumnNumber()
      Get the one-based column number. The value will be non-positive if unknown.
      Returns:
      int
    • getLineNumber

      public int getLineNumber()
      Get the one-based line number. The value will be non-positive if unknown.
      Returns:
      int
    • getLocation

      public InputLocation getLocation(Object key)
      Gets the InputLocation for a specific nested element key.
      Specified by:
      getLocation in interface InputLocationTracker
      Parameters:
      key - the key to look up
      Returns:
      the InputLocation for the specified key, or null if not found
    • getLocations

      public Map<Object,InputLocation> getLocations()
      Gets the map of nested element locations within this location.
      Returns:
      a map of keys to InputLocation instances for nested elements, or null if none
    • setLocation

      public void setLocation(Object key, InputLocation location)
      Sets the InputLocation for a specific nested element key.
      Specified by:
      setLocation in interface InputLocationTracker
      Parameters:
      key - the key to set the location for
      location - the InputLocation to associate with the key
    • setOtherLocation

      public void setOtherLocation(Object key, InputLocation location)
      Sets the InputLocation for a specific nested element key in the locations map. This is a helper method that manages the internal locations map.
      Parameters:
      key - the key to set the location for
      location - the InputLocation to associate with the key
    • getSource

      public InputSource getSource()
      Get the source field.
      Returns:
      InputSource
    • 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
    • setImportedFrom

      public void setImportedFrom(InputLocation importedFrom)
      Set the imported from location.
      Parameters:
      importedFrom -
    • merge

      public static InputLocation merge(InputLocation target, InputLocation source, boolean sourceDominant)
      Method merge.
      Parameters:
      target -
      source -
      sourceDominant -
      Returns:
      InputLocation
    • merge

      public static InputLocation merge(InputLocation target, InputLocation source, Collection<Integer> indices)
      Method merge.
      Parameters:
      target -
      source -
      indices -
      Returns:
      InputLocation
    • setLocations

      public void setLocations(Map<Object,InputLocation> locations)
      Parameters:
      locations -
    • toApiLocation

      public InputLocation toApiLocation()
      Converts this compat model InputLocation to an API model InputLocation. This method is used for converting between the compat model and the API model.
      Returns:
      the equivalent API model InputLocation
    • 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