Class Layers


  • public final class Layers
    extends java.lang.Object
    This class manage all the published layers.
    Author:
    javaito
    • Method Summary

      Modifier and Type Method Description
      static <L extends LayerInterface>
      L
      get​(java.lang.Class<? extends L> layerClass, java.lang.String implName)
      Return the layer interface implementation indexed by implName parameter.
      static <L extends LayerInterface>
      L
      get​(java.lang.Class<? extends L> layerClass, Layers.LayerMatcher<L> matcher)
      This method returns the first implementation of the specified layer class as parameter that match with the specified matcher as parameter.
      static <L extends LayerInterface>
      java.util.Set<L>
      getAll​(java.lang.Class<? extends L> layerClass, Layers.LayerMatcher<L> matcher)
      This method returns all the implementation of the specified layer class as parameter that match with the specified matcher as parameter.
      static java.util.Set<java.lang.Class<? extends LayerInterface>> getLayerInterfaceClass​(java.lang.Class<? extends Layer> layerClass)
      Return the layer interface that implements the layer class.
      static java.util.Set<Resource> getResources()
      Returns all the resources published into the system.
      static java.util.Set<Resource> getResources​(Layers.ResourcePredicate predicate)
      Returns the resources that meet the predicate.
      static java.lang.String publishLayer​(java.lang.Class<? extends Layer> layerClass)
      This method publish the layers in order to be used by anyone that has the credentials to use the layer.
      static <L extends Layer>
      java.lang.String
      publishLayer​(L layerInstance)
      This method publish the layers in order to be used by anyone that has the credentials to use the layer.
      static Plugin publishPlugin​(java.nio.ByteBuffer jarBuffer)
      This method publish all the layer into the plugin jar.
      • Methods inherited from class java.lang.Object

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

      • get

        public static <L extends LayerInterface> L get​(java.lang.Class<? extends L> layerClass,
                                                       java.lang.String implName)
        Return the layer interface implementation indexed by implName parameter.
        Type Parameters:
        L - Expected interface.
        Parameters:
        layerClass - Layer interface for the expected implementation.
        implName - Implementation name.
        Returns:
        Interface implementation.
        Throws:
        java.lang.IllegalArgumentException - If can't create the instance or the implementation does't exist.
      • getAll

        public static <L extends LayerInterface> java.util.Set<L> getAll​(java.lang.Class<? extends L> layerClass,
                                                                         Layers.LayerMatcher<L> matcher)
        This method returns all the implementation of the specified layer class as parameter that match with the specified matcher as parameter.
        Type Parameters:
        L - Expected layer interface type.
        Parameters:
        layerClass - King of layer founding.
        matcher - Matcher instance.
        Returns:
        Set with all the implementation of the layer, this set could be empty.
      • get

        public static <L extends LayerInterface> L get​(java.lang.Class<? extends L> layerClass,
                                                       Layers.LayerMatcher<L> matcher)
        This method returns the first implementation of the specified layer class as parameter that match with the specified matcher as parameter.
        Type Parameters:
        L - Expected layer implementation type.
        Parameters:
        layerClass - Kind of layer founding.
        matcher - Matcher instance.
        Returns:
        First implementation that match.
        Throws:
        java.lang.IllegalArgumentException - if any implementation of this kind of layer match.
      • publishLayer

        public static <L extends Layer> java.lang.String publishLayer​(L layerInstance)
        This method publish the layers in order to be used by anyone that has the credentials to use the layer.
        Type Parameters:
        L - Expected layer type.
        Parameters:
        layerInstance - Layer instance.
        Returns:
        Implementation name.
        Throws:
        java.lang.IllegalArgumentException - If the layer class is null.
      • publishLayer

        public static java.lang.String publishLayer​(java.lang.Class<? extends Layer> layerClass)
        This method publish the layers in order to be used by anyone that has the credentials to use the layer.
        Parameters:
        layerClass - Layer class.
        Returns:
        Implementation name.
        Throws:
        java.lang.IllegalArgumentException - If the layer class is null.
      • publishPlugin

        public static Plugin publishPlugin​(java.nio.ByteBuffer jarBuffer)
        This method publish all the layer into the plugin jar.
        Parameters:
        jarBuffer - Plugin jar.
        Returns:
        Plugin instance.
      • getLayerInterfaceClass

        public static java.util.Set<java.lang.Class<? extends LayerInterface>> getLayerInterfaceClass​(java.lang.Class<? extends Layer> layerClass)
        Return the layer interface that implements the layer class.
        Parameters:
        layerClass - Layer class.
        Returns:
        Layer interface implemented.
      • getResources

        public static java.util.Set<Resource> getResources()
        Returns all the resources published into the system.
        Returns:
        Set with all the resources.
      • getResources

        public static java.util.Set<Resource> getResources​(Layers.ResourcePredicate predicate)
        Returns the resources that meet the predicate.
        Parameters:
        predicate - Resource predicate.
        Returns:
        Set with the resources.