AliasRegistry
is used to provide access to the aliases used within
the application.
A an alias is simply an alternate logical name for a class, such that specifying this logical name in your source code, whether it be Javascript, HTML or CSS, will cause the class to be bundled and sent to the browser. It is therefore, at it's simplest, a mechanism for ensuring that all the code your app needs, and no more, is bundled and sent to the browser. Though class dependencies are usually specified by directly referring to other classes, there are times when this is inappropriate:
Another useful facet of aliases, is that they can be used to automatically discover all of the classes capable of implementing a particular interface, which makes it a good candidate for creating SPI type, auto-discovery mechanisms.
Attributes | Name and Description |
---|---|
|
caplin.core.AliasRegistry()
The |
Attributes | Name and Description |
---|---|
<static>
|
void
clear()
Resets the |
<static>
|
Array
getAliasesByInterface(Function fInterface)
Returns a filtered subset of the aliases provided by caplin.core.AliasRegistry.getAllAliases. |
<static>
|
Array
getAllAliases()
Returns an array containing the names of all aliases in use within the application. |
<static>
|
Function
getClass(String sAliasName)
Returns a class corresponding to the requested alias name. |
<static>
|
boolean
isAlias(String sAliasName)
Returns whether the given alias is defined. |
<static>
|
boolean
isAliasAssigned(String sAliasName)
Returns whether the given alias has been assigned a value — i.e. |
►
caplin.core.AliasRegistry()
The AliasRegistry
is a static class and does not need to be constructed.
►
<static>
void
clear()
Resets the AliasRegistry
back to its initial state.
This method isn't normally called within an application, but is called automatically before each test is run.
►
<static>
Array
getAliasesByInterface(Function fInterface)
Returns a filtered subset of the aliases provided by caplin.core.AliasRegistry.getAllAliases.
An alias is considered to be associated with an interface if the XML configuration for that alias specifically mentions the given interface, or if the class the alias points to happens to implement the given interface.
Function | fInterface | the interface being used to filter the aliases by. |
►
<static>
Array
getAllAliases()
Returns an array containing the names of all aliases in use within the application.
►
<static>
Function
getClass(String sAliasName)
Returns a class corresponding to the requested alias name.
String | sAliasName | alias name. |
►
<static>
boolean
isAlias(String sAliasName)
Returns whether the given alias is defined.
String | sAliasName | alias name. |
►
<static>
boolean
isAliasAssigned(String sAliasName)
Returns whether the given alias has been assigned a value — i.e. whether an alias has a class value.
String | sAliasName | alias name. |