Class Roles

java.lang.Object
org.eclipse.sisu.plexus.Roles

public final class Roles extends Object
Utility methods for dealing with Plexus roles.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Removes any dashes from the name and converts it to camelCase.
    static String
    Returns the canonical form of the given Plexus role-hint.
    static String
    canonicalRoleHint(org.codehaus.plexus.component.annotations.Component component)
    Returns the canonical role-hint for the given Plexus component.
    static <T> com.google.inject.Key<T>
    componentKey(com.google.inject.TypeLiteral<T> role, String hint)
    Returns the component binding Key for the given Plexus role-hint.
    static <T> com.google.inject.Key<T>
    componentKey(Class<T> role, String hint)
    Returns the component binding Key for the given Plexus role-hint.
    static com.google.inject.Key<?>
    componentKey(org.codehaus.plexus.component.annotations.Component component)
    Returns the component binding Key for the given Plexus component.
    static com.google.inject.TypeLiteral<?>
    roleType(org.codehaus.plexus.component.annotations.Requirement requirement, com.google.inject.TypeLiteral<?> asType)
    Deduces the role type based on the given @Requirement and expected type.
    static <T> T
    throwMissingComponentException(com.google.inject.TypeLiteral<T> role, String hint)
    Throws a ProvisionException detailing the missing Plexus component.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • canonicalRoleHint

      public static String canonicalRoleHint(String role, String hint)
      Returns the canonical form of the given Plexus role-hint.
      Parameters:
      role - The Plexus role
      hint - The Plexus hint
      Returns:
      Canonical role-hint denoting the same component as the given role-hint
    • canonicalRoleHint

      public static String canonicalRoleHint(org.codehaus.plexus.component.annotations.Component component)
      Returns the canonical role-hint for the given Plexus component.
      Parameters:
      component - The Plexus component
      Returns:
      Canonical role-hint denoting the given component
    • roleType

      public static com.google.inject.TypeLiteral<?> roleType(org.codehaus.plexus.component.annotations.Requirement requirement, com.google.inject.TypeLiteral<?> asType)
      Deduces the role type based on the given @Requirement and expected type.
      Parameters:
      requirement - The Plexus requirement
      asType - The expected type
      Returns:
      "Best-fit" role type
    • componentKey

      public static com.google.inject.Key<?> componentKey(org.codehaus.plexus.component.annotations.Component component)
      Returns the component binding Key for the given Plexus component.
      Parameters:
      component - The Plexus component
      Returns:
      Component binding key denoting the given component
    • componentKey

      public static <T> com.google.inject.Key<T> componentKey(Class<T> role, String hint)
      Returns the component binding Key for the given Plexus role-hint.
      Parameters:
      role - The Plexus role
      hint - The Plexus hint
      Returns:
      Component binding key denoting the given role-hint
    • componentKey

      public static <T> com.google.inject.Key<T> componentKey(com.google.inject.TypeLiteral<T> role, String hint)
      Returns the component binding Key for the given Plexus role-hint.
      Parameters:
      role - The Plexus role
      hint - The Plexus hint
      Returns:
      Component binding key denoting the given role-hint
    • throwMissingComponentException

      public static <T> T throwMissingComponentException(com.google.inject.TypeLiteral<T> role, String hint)
      Throws a ProvisionException detailing the missing Plexus component.
      Parameters:
      role - The Plexus role
      hint - The Plexus hint
    • camelizeName

      public static String camelizeName(String name)
      Removes any dashes from the name and converts it to camelCase.
      Parameters:
      name - The element name
      Returns:
      CamelCased name with no dashes