Code Review
/
mdsal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Use Map.of() instead of Collections.emptyMap() in builders
[mdsal.git]
/
binding
/
mdsal-binding-java-api-generator
/
src
/
main
/
java
/
org
/
opendaylight
/
mdsal
/
binding
/
java
/
api
/
generator
/
BuilderTemplate.xtend
diff --git
a/binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderTemplate.xtend
b/binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderTemplate.xtend
index c0e4ef72edc0ae61ae0ef9e3bf32584cbe4add28..d920c519085644d984989c4c4ec6e30cef926bc9 100644
(file)
--- a/
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderTemplate.xtend
+++ b/
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderTemplate.xtend
@@
-70,7
+70,9
@@
class BuilderTemplate extends AbstractBuilderTemplate {
«constantsDeclarations()»
«IF augmentType !== null»
«constantsDeclarations()»
«IF augmentType !== null»
- «generateAugmentField()»
+ «val augmentTypeRef = augmentType.importedName»
+ «val mapTypeRef = JU_MAP.importedName»
+ «mapTypeRef»<«CLASS.importedName»<? extends «augmentTypeRef»>, «augmentTypeRef»> «AUGMENTATION_FIELD» = «mapTypeRef».of();
«ENDIF»
/**
«ENDIF»
/**
@@
-427,7
+429,6
@@
class BuilderTemplate extends AbstractBuilderTemplate {
«IF augmentType !== null»
«val augmentTypeRef = augmentType.importedName»
«IF augmentType !== null»
«val augmentTypeRef = augmentType.importedName»
- «val jlClassRef = CLASS.importedName»
«val hashMapRef = JU_HASHMAP.importedName»
/**
* Add an augmentation to this builder's product.
«val hashMapRef = JU_HASHMAP.importedName»
/**
* Add an augmentation to this builder's product.
@@
-437,12
+438,11
@@
class BuilderTemplate extends AbstractBuilderTemplate {
* @throws NullPointerException if {@code augmentation} is null
*/
public «type.name» addAugmentation(«augmentTypeRef» augmentation) {
* @throws NullPointerException if {@code augmentation} is null
*/
public «type.name» addAugmentation(«augmentTypeRef» augmentation) {
- «jlClassRef»<? extends «augmentTypeRef»> augmentationType = augmentation.«BINDING_CONTRACT_IMPLEMENTED_INTERFACE_NAME»();
if (!(this.«AUGMENTATION_FIELD» instanceof «hashMapRef»)) {
this.«AUGMENTATION_FIELD» = new «hashMapRef»<>();
}
if (!(this.«AUGMENTATION_FIELD» instanceof «hashMapRef»)) {
this.«AUGMENTATION_FIELD» = new «hashMapRef»<>();
}
- this.«AUGMENTATION_FIELD».put(augmentation
Type
, augmentation);
+ this.«AUGMENTATION_FIELD».put(augmentation
.«BINDING_CONTRACT_IMPLEMENTED_INTERFACE_NAME»()
, augmentation);
return this;
}
return this;
}
@@
-453,7
+453,7
@@
class BuilderTemplate extends AbstractBuilderTemplate {
* @param augmentationType augmentation type to be removed
* @return this builder
*/
* @param augmentationType augmentation type to be removed
* @return this builder
*/
- public «type.name» removeAugmentation(«
jlClassRef
»<? extends «augmentTypeRef»> augmentationType) {
+ public «type.name» removeAugmentation(«
CLASS.importedName
»<? extends «augmentTypeRef»> augmentationType) {
if (this.«AUGMENTATION_FIELD» instanceof «hashMapRef») {
this.«AUGMENTATION_FIELD».remove(augmentationType);
}
if (this.«AUGMENTATION_FIELD» instanceof «hashMapRef») {
this.«AUGMENTATION_FIELD».remove(augmentationType);
}