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.voidAdds implementation types for containers (without the generic type).addEnumImports(boolean includeTypeAdapter, boolean includeObjects) Adds imports needed for rendering an enumeration.Adds import for Schema.voidaddPropertyImports(Collection<Property> properties) Add imports for the types referenced by properties.get()Returns a sorted set of classes to import.static ImportsnewApi(GeneratorOpts opts) Creates a new instance for API files.static ImportsnewDto(GeneratorOpts opts) Creates a new instance for DTO POJO files.static ImportsnewEnum(GeneratorOpts opts, boolean includeObjects) Creates a new instance for enumeration types.static ImportsnewExtras(GeneratorOpts opts, ExtraTemplate tmpl) Adds imports needed for extra templates.static ImportsnewInterface(GeneratorOpts opts) Adds imports needed for interface templates.static ImportsnewRecord(GeneratorOpts opts) Creates a new instance for DTO record files.voidRemove 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 POJO files. Adds common imports need by all DTOs.- Parameters:
opts- the generator options- Returns:
- a new imports instance loaded with enumeration imports
-
newRecord
Creates a new instance for DTO record files. Adds common imports need by all DTOs.- Parameters:
opts- the generator options- 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
-
addContainerImplementationType
Adds implementation types for containers (without the generic type). This is used for DTOs extending containers.- Parameters:
tc- the container type
-
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.
-