Package com.vaadin.copilot.javarewriter
Class ComponentInfoBuilder
java.lang.Object
com.vaadin.copilot.javarewriter.ComponentInfoBuilder
Builder pattern for
ComponentInfo class-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newComponentInfoinstance based on the values set in this builder.classSource(boolean classSource) Sets whether the component indicates the whole class file rather than instances in the classcomponentAttachInfo(ComponentAttachInfo componentAttachInfo) Sets the attachment information associated with the component.componentCreateInfo(ComponentCreateInfo componentCreateInfo) Sets the creation information associated with the component.containerComposite(boolean containerComposite) Specifies whether the component is part of a container composite structure.createAndAttachLocationsAreInSameFile(boolean createAndAttachLocationsAreInSameFile) Sets whether component create location and attach location are in the same file.createdInLoop(boolean createdInLoop) Sets whether the component is created inside a loop.customComponentInfo(CustomComponent customComponentInfo) Sets custom information associated with the component.Returns theComponentCreateInfoif present, or throws an exception if absent.isAnonymousComponent(boolean isAnonymousComponent) Sets whether the component is an anonymous component (i.e., without a named type).booleanReturns class source valueisReturnValue(boolean isReturnValue) Specifies whether the component is used as a return value from a method or constructor.routeConstructor(com.github.javaparser.ast.body.ConstructorDeclaration routeConstructor) Sets the constructor of the route where the component is created.Sets the type of the component.
-
Constructor Details
-
ComponentInfoBuilder
public ComponentInfoBuilder()
-
-
Method Details
-
type
Sets the type of the component.- Parameters:
type- theClassrepresenting the component type; must not benull.- Returns:
- the updated
ComponentInfoBuilderinstance
-
routeConstructor
public ComponentInfoBuilder routeConstructor(com.github.javaparser.ast.body.ConstructorDeclaration routeConstructor) Sets the constructor of the route where the component is created.- Parameters:
routeConstructor- theConstructorDeclarationassociated with the component- Returns:
- the updated
ComponentInfoBuilderinstance
-
containerComposite
Specifies whether the component is part of a container composite structure.- Parameters:
containerComposite-trueif it is a container composite,falseotherwise- Returns:
- the updated
ComponentInfoBuilderinstance
-
isAnonymousComponent
Sets whether the component is an anonymous component (i.e., without a named type).- Parameters:
isAnonymousComponent-trueif it is an anonymous component,falseotherwise- Returns:
- the updated
ComponentInfoBuilderinstance
-
isReturnValue
Specifies whether the component is used as a return value from a method or constructor.- Parameters:
isReturnValue-trueif the component is a return value,falseotherwise- Returns:
- the updated
ComponentInfoBuilderinstance
-
createdInLoop
Sets whether the component is created inside a loop.- Parameters:
createdInLoop-trueif created inside a loop,falseotherwise- Returns:
- the updated
ComponentInfoBuilderinstance
-
customComponentInfo
Sets custom information associated with the component.- Parameters:
customComponentInfo- aCustomComponentinstance with additional component metadata, ornullif none- Returns:
- the updated
ComponentInfoBuilderinstance
-
componentCreateInfo
Sets the creation information associated with the component.- Parameters:
componentCreateInfo- aComponentCreateInfoinstance containing creation details, ornullif none- Returns:
- the updated
ComponentInfoBuilderinstance
-
componentAttachInfo
Sets the attachment information associated with the component.- Parameters:
componentAttachInfo- aComponentAttachInfoinstance containing attachment details, ornullif none- Returns:
- the updated
ComponentInfoBuilderinstance
-
createAndAttachLocationsAreInSameFile
public ComponentInfoBuilder createAndAttachLocationsAreInSameFile(boolean createAndAttachLocationsAreInSameFile) Sets whether component create location and attach location are in the same file.- Parameters:
createAndAttachLocationsAreInSameFile- true when both refers to same file,falseotherwise.- Returns:
- the updated
ComponentInfoBuilderinstance
-
classSource
Sets whether the component indicates the whole class file rather than instances in the class- Parameters:
classSource-trueif component info refers to class, false otherwise.- Returns:
- the updated
ComponentInfoBuilderinstance
-
isClassSource
public boolean isClassSource()Returns class source value- Returns:
- true if component info refers to class, false otherwise.
-
getCreateInfoOrThrow
Returns theComponentCreateInfoif present, or throws an exception if absent.- Returns:
- the
ComponentCreateInfoassociated with the component - Throws:
IllegalStateException- if the create info is not present
-
getComponentAttachInfoOptional
-
build
Builds a newComponentInfoinstance based on the values set in this builder.- Returns:
- a new
ComponentInfoinstance
-