FromString (Groovy 4.0.15)

Package: groovy.transform.stc

## [Java] Class FromString

- groovy.transform.stc.FromString

-     public class FromString
      extends ClosureSignatureHint

  A closure parameter hint class that is convenient if you want to use a String representation of the signature. It makes use of the option strings, where each string corresponds to a single signature.

  The following example describes a closure as accepting a single signature (List<T> list ->):

  `public <T> T apply(T src, @ClosureParams(value=FromString.class, options="List<T>" Closure<T> cl)`

  The next example describes a closure as accepting two signatures (List<T> list ->) and (T t ->):

  `public <T> T apply(T src, @ClosureParams(value=FromString.class, options={"List<T>","T"} Closure<T> cl)`

  It is advisable not to use this hint as a replacement for the various FirstParam, SimpleType, ... hints because it is actually much slower. Using this hint should therefore be limited to cases where it's not possible to express the signature using the existing hints.

  Since:
    2.3.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public List<ClassNode>` | `getClosureSignatures(MethodNode node, SourceUnit sourceUnit, CompilationUnit compilationUnit, String[] options, ASTNode usage)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ClosureSignatureHint` | `findClassNode, getClosureSignatures, pickGenericType, pickGenericType`

- - ### Method Detail

    - #### @Override
      public List<ClassNode> getClosureSignatures(MethodNode node, SourceUnit sourceUnit, CompilationUnit compilationUnit, String[] options, ASTNode usage)