Package org.daisy.cli

Class ShortFormResolver

java.lang.Object
org.daisy.cli.ShortFormResolver

public class ShortFormResolver extends Object
Provides shorter names for factory identifiers, to be used in command line user interfaces. The short forms are guaranteed to be consistent between executions as long as the identifiers in the collection remains the same.
Author:
Joel HÃ¥kansson
  • Constructor Details

    • ShortFormResolver

      public ShortFormResolver(Collection<? extends Factory> obj)
      Creates a new ShortFormResolver for the supplied collection of factory objects.
      Parameters:
      obj - the factory objects to create short forms for
  • Method Details

    • getShortForms

      public List<String> getShortForms()
      Gets all short forms.
      Returns:
      returns a list of short forms
    • getShortForm

      public String getShortForm(String id)
      Get the short form for the specified identifier.
      Parameters:
      id - the identifier to get the short form for
      Returns:
      returns the short form for the identifier, or null if the identifier does not have a short form
    • resolve

      public String resolve(String shortForm)
      Resolves a short form.
      Parameters:
      shortForm - the short form to resolve
      Returns:
      returns the full id for the supplied short form, or null if the short form does not have an identifier