Skip to content

Add @AlphaStrings supplier annotation #21

Description

@ajoz

Scope:

  • Add @AlphaStrings annotation, it should allow:
    -- defining if an empty String is allowed
    -- defining the maximal length of the String
    -- defining the minimum length of the String (setting this to 0 allows for empty String? If yes then special argument for empty String is not necessary)
    -- if both maximal length and minimal length are set to the same value then generated strings should have the same length (worth to consider if a special argument is needed to mark that the size should be static)
    -- defining the alpha characters that are allowed (for example we would like to have alpha strings generated only from a, b, c
    -- defining the alpha character that not allowed (similar to the option above)
    -- if both allowed chars and not allowed chars are set then an exception should be thrown (we do not want to think about complex rules for handling such situations where both sets overlap)
    -- limit - how many Strings should be generated
  • Add AlphaStringsSupplier that will handle the arguments from the annotations and generate the Strings

Example API:

@Retention(AnnotationRetention.RUNTIME)
@ParametersSuppliedBy(AlphaStringsSupplier::class)
annotation class AlphaStrings(
        val minimalLength: Int = 3,
        val maximalLength: Int = 10,
        val allowed: CharArray = ['t', 'e', 'o', 'r', 'i', 'a'], // just an example
        val limit: Int = 1000
)

Minimal scope:

  • support maximalLength, this means that minimal length is 0 and empty strings are allowed
  • support limit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions