Skip to content

Structs: Infer parameter members from functional method signature instead from solely annotations #2

@Treiblesschorle

Description

@Treiblesschorle

Currently, ParameterStructs utility class only check for @Parameter annotations in order to structify an object. Instead, members should be inferred from the signature of the functional method of the class of the passed object. This should have the following behavior:

  • If no @Parameter annotations are given, the type and the ItemIO should be inferred from the functional method signature. In doing so, the return type will always be ItemIO.Output and method parameters should be ItemIO.Input. If a method parameter is ItemIO.Both, it should be annotated with a @Mutable annotation. Methods to get the functional method types from a type and the @Mutable already exists.
  • Additionally, the @Parameter annotations may be given in order to specify the names and further metadata of the member (e.g. required status). Also, this enabled to do fail fast checks if the ItemIO or the number of parameters does not match the types inferred from the functional method.
  • A ItemIO.Auto was already added in order to indicate that the ItemIO should be automatically inferred from the functional method. ItemIO.Auto should be made the default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions