Class Imports
java.lang.Object
dk.mada.jaxrs.generator.mpclient.imports.Imports
Keeps track of imports for a single template, taking generator options into consideration.
-
Method Summary
Modifier and TypeMethodDescriptionadd
(boolean active, TypedImport... classes) Optionally adds typed imports.add
(TypedImport... classes) Adds typed imports.Adds import for a reference - the type it references.Adds imports for a type.add
(Collection<TypedImport> classes) Adds typed imports.addEnumImports
(boolean includeTypeAdapter, boolean includeObjects) Adds imports needed for rendering an enumeration.Adds import for Schema.void
addPropertyImports
(Collection<Property> properties) Add imports for the types referenced by properties.get()
Returns a sorted set of classes to import.static Imports
newApi
(GeneratorOpts opts) Creates a new instance for API files.static Imports
newDto
(GeneratorOpts opts, boolean hasParams) Creates a new instance for DTO files.static Imports
newEnum
(GeneratorOpts opts, boolean includeObjects) Creates a new instance for enumeration types.static Imports
newExtras
(GeneratorOpts opts, ExtraTemplate tmpl) Adds imports needed for extra templates.static Imports
newInterface
(GeneratorOpts opts) Adds imports needed for interface templates.void
Remove container implementations (e.g.
-
Method Details
-
get
Returns a sorted set of classes to import.- Returns:
- a sorted set of classes to import
-
newApi
Creates a new instance for API files. Adds common imports need by all APIs.- Parameters:
opts
- the generator options- Returns:
- a new imports instance loaded with enumeration imports
-
newDto
Creates a new instance for DTO files. Adds common imports need by all DTOs.- Parameters:
opts
- the generator optionshasParams
- true if the DTO has any properties- Returns:
- a new imports instance loaded with enumeration imports
-
newEnum
Creates a new instance for enumeration types.- Parameters:
opts
- the generator optionsincludeObjects
- flag to include Objects- Returns:
- a new imports instance loaded with enumeration imports
-
newInterface
Adds imports needed for interface templates.- Parameters:
opts
- the generator options- Returns:
- a new imports instance
-
newExtras
Adds imports needed for extra templates.- Parameters:
opts
- the generator optionstmpl
- the template to add imports for- Returns:
- a new imports instance
-
addEnumImports
Adds imports needed for rendering an enumeration.- Parameters:
includeTypeAdapter
- flag to include typeAdaptorincludeObjects
- flag to include Objects- Returns:
- this
-
addPropertyImports
Add imports for the types referenced by properties.- Parameters:
properties
- the properties to add imports for
-
add
Adds typed imports.- Parameters:
classes
- the classes to add imports for- Returns:
- the imports instance
-
add
Adds typed imports.- Parameters:
classes
- the classes to add imports for- Returns:
- the imports instance
-
add
Optionally adds typed imports.- Parameters:
active
- option to control if the classes should be addedclasses
- the classes to add imports for- Returns:
- the imports instance
-
add
Adds import for a reference - the type it references.- Parameters:
typeRef
- the type reference- Returns:
- the imports instance
-
add
Adds imports for a type. If the type is externally mapped, just adds an import of the class. Otherwise adds imports for dependency and container-wrapper classes as well.- Parameters:
type
- the type to add imports for- Returns:
- the imports instance
-
addMicroProfileSchema
Adds import for Schema.- Returns:
- the imports instance
-
trimContainerImplementations
public void trimContainerImplementations()Remove container implementations (e.g. ArrayList) from imports for use in Api files. Maybe need a better way to handle this.
-