Module com.github.rvesse.airline
Class UserAliasesSource<C>
- java.lang.Object
-
- com.github.rvesse.airline.parser.aliases.UserAliasesSource<C>
-
- Type Parameters:
C
- Command type
public class UserAliasesSource<C> extends java.lang.Object
Represents the source of user defined aliases
-
-
Field Summary
Fields Modifier and Type Field Description static ResourceLocator[]
DEFAULT_LOCATORS
Default user alias source locatorsprivate java.lang.String
filename
private java.util.List<ResourceLocator>
locators
private java.lang.String
prefix
private java.util.List<java.lang.String>
searchLocations
-
Constructor Summary
Constructors Constructor Description UserAliasesSource(java.lang.String filename, java.lang.String prefix, java.lang.String... searchLocations)
UserAliasesSource(java.lang.String filename, java.lang.String prefix, java.util.List<ResourceLocator> locators, java.util.List<java.lang.String> searchLocations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getFilename()
Gets the filename of the configuration file that will be scanned for alias definitionsjava.util.List<ResourceLocator>
getLocators()
Gets the locators that are used to resolve search locations to actual usable locationsjava.lang.String
getPrefix()
Gets the prefix that is used to distinguish alias definitions from other property definitions in the configuration filejava.util.List<java.lang.String>
getSearchLocations()
Gets the search locations where the configuration file may be located in order of preferencejava.util.List<AliasMetadata>
load()
Loads the alias metadata based on the configured sources
-
-
-
Field Detail
-
DEFAULT_LOCATORS
public static final ResourceLocator[] DEFAULT_LOCATORS
Default user alias source locators
-
locators
private final java.util.List<ResourceLocator> locators
-
searchLocations
private final java.util.List<java.lang.String> searchLocations
-
filename
private final java.lang.String filename
-
prefix
private final java.lang.String prefix
-
-
Constructor Detail
-
UserAliasesSource
public UserAliasesSource(java.lang.String filename, java.lang.String prefix, java.lang.String... searchLocations)
-
UserAliasesSource
public UserAliasesSource(java.lang.String filename, java.lang.String prefix, java.util.List<ResourceLocator> locators, java.util.List<java.lang.String> searchLocations)
-
-
Method Detail
-
getFilename
public java.lang.String getFilename()
Gets the filename of the configuration file that will be scanned for alias definitions- Returns:
- Configuration file name
-
getSearchLocations
public java.util.List<java.lang.String> getSearchLocations()
Gets the search locations where the configuration file may be located in order of preference- Returns:
- Search locations in order of preference
-
getPrefix
public java.lang.String getPrefix()
Gets the prefix that is used to distinguish alias definitions from other property definitions in the configuration fileIf this is null/empty/blank then no prefix is in effect
- Returns:
- Prefix
-
getLocators
public java.util.List<ResourceLocator> getLocators()
Gets the locators that are used to resolve search locations to actual usable locations- Returns:
- User alias locators
-
load
public java.util.List<AliasMetadata> load() throws java.io.FileNotFoundException, java.io.IOException
Loads the alias metadata based on the configured sources- Returns:
- Alias metadata
- Throws:
java.io.FileNotFoundException
- Thrown if unable to find a properties filejava.io.IOException
- Thrown if unable to read a properties file
-
-