public interface

IAddressableUnit

implements IUnit
com.pnfsoftware.jeb.core.units.IAddressableUnit
Known Indirect Subclasses

Class Overview

Addressable units allow the retrieval of unit objects via object identifiers and addresses.

Summary

Public Methods
abstract String getAddressLabel(String address)
Retrieve the label at a given address.
abstract Map<String, String> getAddressLabels()
Retrieve all labels.
abstract String getAddressOfItem(long id)
Attempt to determine the best address for a given item.
abstract String getCanonicalAddress(String address)
Convert the provided address to its canonical form.
abstract long getItemAtAddress(String address)
Attempt to determine the best item for a given address.
abstract Object getItemObject(long id)
Optionally provide an object associated with the given item.
abstract List<Long> getRelatedItems(long id)
Retrieve items related to the provided item id.
abstract Collection<String> getWellKnownAddresses(int maxCount, Predicate<String> validator)
Retrieve a collection of valid unit addresses.
abstract boolean isValidAddress(String address)
Determine if the provided address is a valid address for this unit.
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.IUnitCreator
From interface com.pnfsoftware.jeb.core.IUserDataSupport
From interface com.pnfsoftware.jeb.core.units.IUnit
From interface com.pnfsoftware.jeb.util.events.IEventSource

Public Methods

public abstract String getAddressLabel (String address)

Retrieve the label at a given address. The default implementation returns null.

Parameters
address mandatory address
Returns
  • the label, null if none

public abstract Map<String, String> getAddressLabels ()

Retrieve all labels. The default implementation returns an empty map.

Returns
  • a map of "address: label" value pairs

public abstract String getAddressOfItem (long id)

Attempt to determine the best address for a given item. Implementors may return null if a conversion is deemed impossible, inaccurate or irrelevant.

Clients use this method to provide navigation capability, for example, jumping from an item to the master (main) related item, that would be located at the resulting address.

Plugin developers are recommended to implement this method.

Parameters
id the item id
Returns
  • an address best representing or matching the provided item, null otherwise

public abstract String getCanonicalAddress (String address)

Convert the provided address to its canonical form. If the canonical form cannot be determined, the method is allowed to return the provided address.

public abstract long getItemAtAddress (String address)

Attempt to determine the best item for a given address. Implementors may return 0 if a conversion is deemed impossible, inaccurate or irrelevant.

Parameters
address the address
Returns
  • an item best representing or matching the provided address, 0 otherwise

public abstract Object getItemObject (long id)

Optionally provide an object associated with the given item. This method may return null, an opaque object, or an object defined by the contract of the implementing object or sub-interface. The SPI of sub-interfaces should specify the item id formats, if any, as well as types and semantics associated with the objects returned by this method.

Parameters
id the item id
Returns
  • an object, whose type is defined by contract, potentially null

public abstract List<Long> getRelatedItems (long id)

Retrieve items related to the provided item id. The definition and context of 'relation' is implementation dependent.

Parameters
id an item id
Returns
  • a list of related items (not containing the provided id), may be empty - never null

public abstract Collection<String> getWellKnownAddresses (int maxCount, Predicate<String> validator)

Retrieve a collection of valid unit addresses.

Parameters
maxCount optional maximum count of entries to return; use -1 to remove the cap
validator optional validator; only addresses that pass the test will be retrieved

public abstract boolean isValidAddress (String address)

Determine if the provided address is a valid address for this unit.