Class TypeModel.Builder

java.lang.Object
com.vaadin.hilla.generator.model.TypeModel.Builder
Enclosing interface:
TypeModel

public static final class TypeModel.Builder extends Object
What the walk says about a type while it is still walking it, which is the target of the node standing for the type. The plugins of the parser say whether a value of it can be absent and what its annotations say about it, and the type is built from that once the walk leaves the node, when the types it refers to are known and decide which kind of type it is.

A builder can be the target of more than one node: the walk hands the one of a type argument, a type variable or an optional up to the node written from it, since what is said about the one is said about the other.

  • Method Details

    • of

      public static TypeModel.Builder of(boolean optional, boolean collectsTypeArguments)
      What is known about a type before any plugin has said anything.
      Parameters:
      optional - whether a value of the type can be absent, which is what Java says unless an annotation says otherwise
      collectsTypeArguments - whether the types it is given belong to it rather than to the value it holds
    • unknown

      public static TypeModel.Builder 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)
    • getConstraints

      public List<ConstraintModel> getConstraints()
      What the annotations of the validation API say a value of the type has to satisfy, which is nothing at all where none is written on it.
    • setConstraints

      public void setConstraints(List<ConstraintModel> constraints)
    • getAnnotations

      public List<AnnotationModel> getAnnotations()
      The annotations of the value which a form model is told about, such as the one saying that a value is the id of an entity.
    • setAnnotations

      public void setAnnotations(List<AnnotationModel> annotations)
    • scalar

      public TypeModel.Scalar scalar(TypeModel.ScalarKind kind, String javaType)
    • arrayOf

      public TypeModel.ArrayOf arrayOf(TypeModel items, String javaType)
    • mapOf

      public TypeModel.MapOf mapOf(TypeModel values, String javaType)
    • entityRef

      public TypeModel.EntityRef entityRef(String javaClass, List<TypeModel> typeArguments)
    • provided

      public TypeModel.Provided provided(String name, String module, List<TypeModel> typeArguments)
    • typeVariable

      public TypeModel.TypeVariable typeVariable(String name)