Class TypeFacts

java.lang.Object
com.vaadin.hilla.parser.plugins.backbone.TypeFacts

public final class TypeFacts extends Object
What the walk says about the type of a value: whether a value of it can be absent, the types it is given where it takes parameters, and whatever else a plugin has to say about it, which the plugin reading it back knows the shape of.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name the annotations of a value which a form model is told about are said under.
    static final String
    The name the plugin reading the annotations of the validation API says what they mean for a value under.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether the types this one is given are its own, which they are not for the types the browser has one of its own for: the value of an optional, the items of an iterable and the values of a map are the type the walk carries below it instead.
    boolean
    Whether a value of the type can be absent, which is what the generated TypeScript says with a union with undefined.
    void
    note(String name, List<?> values)
    Says something about the type under the given name, which the plugin reading it back knows the shape of the values of.
    <T> Stream<T>
    notes(String name, Class<T> type)
    What a plugin has said about the type under the given name as values of the given type, which is nothing at all where nothing was said.
    static TypeFacts
    of(SignatureModel type, boolean handleGenerics)
    What is known about a type before any plugin has said anything: whether a value of it can be absent, which is what Java says unless an annotation says otherwise, and whether the types it is given belong to it rather than to the value it holds.
    void
    setOptional(boolean optional)
     
    static TypeFacts
    What is known about a type nothing has been walked for.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CONSTRAINTS

      public static final String CONSTRAINTS
      The name the plugin reading the annotations of the validation API says what they mean for a value under. The notes are ValidationConstraints.
      See Also:
    • ANNOTATIONS

      public static final String ANNOTATIONS
      The name the annotations of a value which a form model is told about are said under. The notes are Annotations.
      See Also:
  • Method Details

    • of

      public static TypeFacts of(SignatureModel type, boolean handleGenerics)
      What is known about a type before any plugin has said anything: whether a value of it can be absent, which is what Java says unless an annotation says otherwise, and whether the types it is given belong to it rather than to the value it holds.
      Parameters:
      type - the type a value is of
      handleGenerics - whether a type variable stands for itself, which it does in an entity and does not in the signature of an endpoint method
    • unknown

      public static TypeFacts unknown()
      What is known about a type nothing has been walked for.
    • collectsTypeArguments

      public boolean collectsTypeArguments()
      Whether the types this one is given are its own, which they are not for the types the browser has one of its own for: the value of an optional, the items of an iterable and the values of a map are the type the walk carries below it instead.
    • isOptional

      public boolean isOptional()
      Whether a value of the type can be absent, which is what the generated TypeScript says with a union with undefined.
    • setOptional

      public void setOptional(boolean optional)
    • note

      public void note(String name, List<?> values)
      Says something about the type under the given name, which the plugin reading it back knows the shape of the values of. Saying it again replaces what was said before.
    • notes

      public <T> Stream<T> notes(String name, Class<T> type)
      What a plugin has said about the type under the given name as values of the given type, which is nothing at all where nothing was said.