Package org.daisy.cli
Class ShortFormResolver
- java.lang.Object
-
- org.daisy.cli.ShortFormResolver
-
public class ShortFormResolver extends java.lang.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 Summary
Constructors Constructor Description ShortFormResolver(java.util.Collection<? extends Factory> obj)
Creates a new ShortFormResolver for the supplied collection of factory objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getShortForm(java.lang.String id)
Get the short form for the specified identifier.java.util.List<java.lang.String>
getShortForms()
Gets all short forms.java.lang.String
resolve(java.lang.String shortForm)
Resolves a short form.
-
-
-
Constructor Detail
-
ShortFormResolver
public ShortFormResolver(java.util.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 Detail
-
getShortForms
public java.util.List<java.lang.String> getShortForms()
Gets all short forms.- Returns:
- returns a list of short forms
-
getShortForm
public java.lang.String getShortForm(java.lang.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 java.lang.String resolve(java.lang.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
-
-