Class Components

    • Constructor Summary

      Constructors 
      Constructor Description
      Components()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static IResourceHandle componentHandle​(java.lang.String componentName)
      Get the IResourceHandle facet of the named component.
      static java.util.Collection<java.lang.String> findComponents​(X propertyExpression)
      Find all components by query expression on their properties.
      static <T> T getComponentAs​(java.lang.String componentName, TypeRef<T> typeRef)
      Get a component facet by lookup through
      static <T> T getComponentAs​(java.lang.String componentName, TypeRef<T> typeRef, boolean required)
      Get a component facet by lookup through
      static <T> T getComponentAs​(java.lang.String componentName, java.lang.Class<T> clz)
      Get a component facet by lookup through
      static <T> T getComponentAs​(java.lang.String componentName, java.lang.Class<T> clz, boolean required)
      Get a component facet by lookup through
      static java.util.Properties getComponentProperties​(IResourceHandle component)
      Get the component descriptor properties for the component supplied by IResourceHandle.
      static java.util.Properties getComponentProperties​(java.lang.String componentName)
      Get the component descriptor properties for the component supplied by name.
      static <T> T getDependencyComponentAs​(IResourceHandle dependant, java.lang.String name, TypeRef<T> typeRef, boolean required)
      Add a dependency by component name and retrieve a facet of the dependency.
      static <T> T getDependencyComponentAs​(IResourceHandle dependant, java.lang.String name, java.lang.Class<T> clz, boolean required)
      Add a dependency by component name and retrieve a facet of the dependency.
      static java.io.File retrieve​(java.lang.String componentName)
      Get the resource folder of a component, if any.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Components

        public Components()
    • Method Detail

      • getComponentAs

        public static <T> T getComponentAs​(java.lang.String componentName,
                                           java.lang.Class<T> clz,
                                           boolean required)
        Get a component facet by lookup through
        
         IComponentsLookup.INSTANCE.lookup(...)
         
        optionally requiring support of the facet.
        Type Parameters:
        T - Generic type of the facet
        Parameters:
        componentName - Name of the component
        clz - Class of the generic type
        required - if true the lookup must result in a non-null result or an IllegalStateException will be thrown
        Returns:
        The facet as implemented by the component
      • getComponentAs

        public static <T> T getComponentAs​(java.lang.String componentName,
                                           TypeRef<T> typeRef,
                                           boolean required)
        Get a component facet by lookup through
        
         IComponentsLookup.INSTANCE.lookup(...)
         
        optionally requiring support of the facet.
        Type Parameters:
        T - Generic type of the facet
        Parameters:
        componentName - Name of the component
        typeRef - TypeRef of the generic type
        required - if true the lookup must result in a non-null result or an IllegalStateException will be thrown
        Returns:
        The facet as implemented by the component
      • getComponentAs

        public static <T> T getComponentAs​(java.lang.String componentName,
                                           java.lang.Class<T> clz)
        Get a component facet by lookup through
        
         getComponentAs(componentName, clz, false)
         
        i.e. with a non-required result.
        Type Parameters:
        T - Generic type of the facet
        Parameters:
        componentName - Name of the component
        clz - Class of the generic type
        Returns:
        The facet as implemented by the component
      • getComponentAs

        public static <T> T getComponentAs​(java.lang.String componentName,
                                           TypeRef<T> typeRef)
        Get a component facet by lookup through
        
         getComponentAs(componentName, clz, false)
         
        i.e. with a non-required result.
        Type Parameters:
        T - Generic type of the facet
        Parameters:
        componentName - Name of the component
        typeRef - TypeRef of the generic type
        Returns:
        The facet as implemented by the component
      • componentHandle

        public static IResourceHandle componentHandle​(java.lang.String componentName)
        Get the IResourceHandle facet of the named component. Note: This lookup is generically supported by the system and always returns a non-null result.
        Parameters:
        componentName - Name of the component
        Returns:
        The component's resource handle
      • getDependencyComponentAs

        public static <T> T getDependencyComponentAs​(IResourceHandle dependant,
                                                     java.lang.String name,
                                                     java.lang.Class<T> clz,
                                                     boolean required)
        Add a dependency by component name and retrieve a facet of the dependency.
        Type Parameters:
        T - Generic type of the facet
        Parameters:
        dependant - Handle of the component that will receive the dependency
        name - Name of the dependency component that will be added as a dependency
        clz - Class of the generic type
        required - if true the lookup via the dependency must result in a non-null result or an IllegalStateException will be thrown
        Returns:
        The facet as implemented by the dependency component
      • getDependencyComponentAs

        public static <T> T getDependencyComponentAs​(IResourceHandle dependant,
                                                     java.lang.String name,
                                                     TypeRef<T> typeRef,
                                                     boolean required)
        Add a dependency by component name and retrieve a facet of the dependency.
        Type Parameters:
        T - Generic type of the facet
        Parameters:
        dependant - Handle of the component that will receive the dependency
        name - Name of the dependency component that will be added as a dependency
        typeRef - TypeRef of the generic type
        required - if true the lookup via the dependency must result in a non-null result or an IllegalStateException will be thrown
        Returns:
        The facet as implemented by the dependency component
      • getComponentProperties

        public static java.util.Properties getComponentProperties​(IResourceHandle component)
        Get the component descriptor properties for the component supplied by IResourceHandle.
        Parameters:
        component - Resource handle of the component to retrieve properties for
        Returns:
        Properties of the supplied component
      • getComponentProperties

        public static java.util.Properties getComponentProperties​(java.lang.String componentName)
        Get the component descriptor properties for the component supplied by name.
        Parameters:
        componentName - Name of the component to retrieve properties for
        Returns:
        Properties of the supplied component
      • retrieve

        public static java.io.File retrieve​(java.lang.String componentName)
                                     throws java.io.IOException
        Get the resource folder of a component, if any. See also IComponentsRepository.retrieve(String)
        Parameters:
        componentName - Name of the component
        Returns:
        Resource folder as File, or null, if the component has no resource folder
        Throws:
        java.io.IOException
      • findComponents

        public static java.util.Collection<java.lang.String> findComponents​(X propertyExpression)
                                                                     throws java.io.IOException
        Find all components by query expression on their properties.
        Parameters:
        propertyExpression - Search query for components. See IComponentsRepository.findComponents(X)
        Returns:
        Query result
        Throws:
        java.io.IOException