Refactor construction of application objects
- Use a builder and make the constructors private for DefaultApplication
- Make DefaultApplication immutable
- Use a builder and make the constructors private for DefaultApplicationDescription
- Make DefaultApplicationDescription immutable
Change-Id: I9499981bd2c0f48aede40682260d51eeae2cab98
diff --git a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
index 532b279..c65d1aa 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
@@ -571,20 +571,10 @@
*/
private Application registerApp(ApplicationDescription appDesc) {
ApplicationId appId = idStore.registerApplication(appDesc.name());
- return new DefaultApplication(appId,
- appDesc.version(),
- appDesc.title(),
- appDesc.description(),
- appDesc.origin(),
- appDesc.category(),
- appDesc.url(),
- appDesc.readme(),
- appDesc.icon(),
- appDesc.role(),
- appDesc.permissions(),
- appDesc.featuresRepo(),
- appDesc.features(),
- appDesc.requiredApps());
+ return DefaultApplication
+ .builder(appDesc)
+ .withAppId(appId)
+ .build();
}
/**