Package ca.phon.extensions
Class ExtensionUtils
java.lang.Object
ca.phon.extensions.ExtensionUtils
Utility methods for working with extensions.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
getExtension
(Object obj, Class<T> ext) Get the specified extension if it existsstatic boolean
hasExtension
(Object obj, Class<?> ext) Check if the given object has the given extension.static boolean
isExtendable
(Object obj) Checks if the given object implementsIExtendable
static <T> T
putExtension
(Object obj, Class<T> ext, T impl) Put the specified extention in the given object.
-
Constructor Details
-
ExtensionUtils
public ExtensionUtils()
-
-
Method Details
-
isExtendable
Checks if the given object implementsIExtendable
- Returns:
true
if the object implementsIExtendable
,false
otherwise
-
hasExtension
Check if the given object has the given extension.- Parameters:
obj
-ext
-- Returns:
true
if the extension exists,false
otherwise
-
getExtension
Get the specified extension if it exists- Parameters:
obj
-ext
-- Returns:
- the specified extension or
null
if the extension is not available or the object is not extendable
-
putExtension
Put the specified extention in the given object.- Parameters:
obj
-ext
-extObj
-- Returns:
- the previous value of the ext or
null
if not found
-