org.apache.fop.area

## Class LinkResolver

- java.lang.Object
- - org.apache.fop.area.LinkResolver

- All Implemented Interfaces:
    Serializable, Resolvable

      public class LinkResolver
      extends Object
      implements Resolvable, Serializable

  Link resolving for resolving internal links.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LinkResolver()`
    `LinkResolver(String id, Area a)` Create a new link resolver.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDependent(Resolvable dependent)` Add dependent resolvable.
    `String[]` | `getIDRefs()` Get the references for this link.
    `boolean` | `isResolved()` Check if this area has been resolved.
    `void` | `resolveIDRef(String id, List<PageViewport> pages)` Resolve by adding an internal link to the first PageViewport in the list.
    `void` | `resolveIDRef(String id, PageViewport pv)` Resolve by adding an InternalLink trait to the area

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LinkResolver

          public LinkResolver()

    - #### LinkResolver

          public LinkResolver(String id,
                              Area a)

      Create a new link resolver.
      Parameters:
        `id` - the id to resolve
        `a` - the area that will have the link attribute

  - ### Method Detail

    - #### isResolved

          public boolean isResolved()

      Description copied from interface: `Resolvable`
      Check if this area has been resolved.
      Specified by:
        `isResolved` in interface `Resolvable`
      Returns:
        true if this link is resolved

    - #### getIDRefs

          public String[] getIDRefs()

      Get the references for this link.
      Specified by:
        `getIDRefs` in interface `Resolvable`
      Returns:
        the String array of references.

    - #### resolveIDRef

          public void resolveIDRef(String id,
                                   List<PageViewport> pages)

      Resolve by adding an internal link to the first PageViewport in the list. This method allows the Resolvable object to resolve one of its unresolved idrefs with the actual set of PageViewports containing the target ID. The Resolvable object initially identifies to the AreaTreeHandler which idrefs it needs resolved. After the idrefs are resolved, the ATH calls this method to allow the Resolvable object to update itself with the PageViewport information.
      Specified by:
        `resolveIDRef` in interface `Resolvable`
      Parameters:
        `id` - an ID matching one of the Resolvable object's unresolved idref's.
        `pages` - the list of PageViewports with the given ID

    - #### resolveIDRef

          public void resolveIDRef(String id,
                                   PageViewport pv)

      Resolve by adding an InternalLink trait to the area
      Parameters:
        `id` - the target id (should be equal to the object's idRef)
        `pv` - the PageViewport containing the first area with the given id

    - #### addDependent

          public void addDependent(Resolvable dependent)

      Add dependent resolvable. Used to resolve second-order resolvables that depend on resolution of this resolver.
      Parameters:
        `dependent` - resolvable

Copyright © 2025 Apache Software Foundation. All rights reserved.