Class ExtensionUtils

java.lang.Object
ca.phon.extensions.ExtensionUtils

public class ExtensionUtils extends Object
Utility methods for working with extensions.
  • Constructor Details

    • ExtensionUtils

      public ExtensionUtils()
  • Method Details

    • isExtendable

      public static boolean isExtendable(Object obj)
      Checks if the given object implements IExtendable
      Returns:
      true if the object implements IExtendable, false otherwise
    • hasExtension

      public static boolean hasExtension(Object obj, Class<?> ext)
      Check if the given object has the given extension.
      Parameters:
      obj -
      ext -
      Returns:
      true if the extension exists, false otherwise
    • getExtension

      public static <T> T getExtension(Object obj, Class<T> ext)
      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

      public static <T> T putExtension(Object obj, Class<T> ext, T impl)
      Put the specified extention in the given object.
      Parameters:
      obj -
      ext -
      extObj -
      Returns:
      the previous value of the ext or null if not found