Record Class AppConfiguration

java.lang.Object
java.lang.Record
io.openems.edge.core.appmanager.AppConfiguration

public record AppConfiguration(List<Task<?>> tasks, List<DependencyDeclaration> dependencies) extends Record
  • Constructor Details

    • AppConfiguration

      public AppConfiguration(List<Task<?>> tasks, List<DependencyDeclaration> dependencies)
      Creates an instance of a AppConfiguration record class.
      Parameters:
      tasks - the value for the tasks record component
      dependencies - the value for the dependencies record component
  • Method Details

    • create

      Creates a builder for creating an AppConfiguration.
      Returns:
      the builder
    • empty

      public static AppConfiguration empty()
      Creates an empty AppConfiguration.
      Returns:
      the configuration
    • getComponents

      public List<EdgeConfig.Component> getComponents()
    • getConfiguration

      public <C, T extends AggregateTask<C>> C getConfiguration(Class<T> clazz)
      Gets the configuration for the given task class.

      e. g. if ComponentAggregateTask is given which is a AggregateTask of ComponentConfiguration then this configuration is returned if defined in the AppConfiguration else null.

      Type Parameters:
      C - the type of the configuration
      T - the type of the AggregateTask
      Parameters:
      clazz - the Class of the AggregateTask
      Returns:
      the found configuration or null if not defined
    • flatMap

      public static <C, T extends AggregateTask<C>, L> Stream<L> flatMap(List<AppConfiguration> configs, Class<T> clazz, Function<C,Collection<L>> mapper)
      Flat maps a attribute from a configuration to a single list.
      Type Parameters:
      C - the type of the Configuration
      T - the type of the AggregateTask
      L - the type of the list
      Parameters:
      configs - the configurations to map
      clazz - the Class of the Task
      mapper - the mapper from the configuration to the type of the list
      Returns:
      the list with all instances
    • getComponentsFromConfigs

      public static List<EdgeConfig.Component> getComponentsFromConfigs(List<AppConfiguration> configs)
      Collects all components from the AppConfigurations and returns them.
      Parameters:
      configs - the AppConfigurations to get the Components from
      Returns:
      the Components
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tasks

      public List<Task<?>> tasks()
      Returns the value of the tasks record component.
      Returns:
      the value of the tasks record component
    • dependencies

      public List<DependencyDeclaration> dependencies()
      Returns the value of the dependencies record component.
      Returns:
      the value of the dependencies record component