Package com.vaadin.hilla.generator.model
Class TypeModel.Builder
java.lang.Object
com.vaadin.hilla.generator.model.TypeModel.Builder
- Enclosing interface:
TypeModel
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 Summary
Modifier and TypeMethodDescriptionbooleanWhether 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.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.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.booleanWhether a value of the type can be absent, which is what the generated TypeScript says with a union with undefined.static TypeModel.Builderof(boolean optional, boolean collectsTypeArguments) What is known about a type before any plugin has said anything.scalar(TypeModel.ScalarKind kind, String javaType) voidsetAnnotations(List<AnnotationModel> annotations) voidsetConstraints(List<ConstraintModel> constraints) voidsetOptional(boolean optional) typeVariable(String name) static TypeModel.Builderunknown()What is known about a type nothing has been walked for.
-
Method Details
-
of
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 otherwisecollectsTypeArguments- whether the types it is given belong to it rather than to the value it holds
-
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
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
-
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
-
scalar
-
arrayOf
-
mapOf
-
entityRef
-
provided
-
typeVariable
-