commit | 1aaa64d6c839fa8a684db054db9cd04dfbc43cbe | [log] [tgz] |
---|---|---|
author | Jian Li <pyguni@gmail.com> | Thu Dec 14 11:25:39 2017 +0900 |
committer | Thomas Vachuska <tom@opennetworking.org> | Tue Mar 06 17:25:06 2018 +0000 |
tree | 76ac5ac49ac75c97b2e26b0252361c304c162fd4 | |
parent | 40f4d6cd728ef669fd3166ed7a59e8bef5d67bc9 [diff] |
Refactor: specify the generic type for protobuf enum translator Change-Id: I5a1df0cc2ab2372b68d5851b7b2a449c5d958bfe
diff --git a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationEnumsProtoTranslator.java b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationEnumsProtoTranslator.java index d82f93e..6fe0319 100644 --- a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationEnumsProtoTranslator.java +++ b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationEnumsProtoTranslator.java
@@ -59,7 +59,7 @@ * @param roleProto gRPC message * @return {@link ApplicationRole} */ - public static Optional<Object> translate(ApplicationRoleProto roleProto) { + public static Optional<ApplicationRole> translate(ApplicationRoleProto roleProto) { switch (roleProto) { case USER: @@ -101,7 +101,7 @@ * @param stateProto gRPC message * @return {@link ApplicationState} */ - public static Optional<Object> translate(ApplicationStateProto stateProto) { + public static Optional<ApplicationState> translate(ApplicationStateProto stateProto) { switch (stateProto) { case ACTIVE:
diff --git a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationProtoTranslator.java b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationProtoTranslator.java index 568be18..25a95e4 100644 --- a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationProtoTranslator.java +++ b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/core/ApplicationProtoTranslator.java
@@ -17,7 +17,6 @@ import com.google.common.collect.Sets; import org.onosproject.core.Application; -import org.onosproject.core.ApplicationRole; import org.onosproject.core.DefaultApplication; import org.onosproject.grpc.core.models.ApplicationProtoOuterClass.ApplicationProto; import org.onosproject.incubator.protobuf.models.security.PermissionProtoTranslator; @@ -57,7 +56,7 @@ .withUrl(app.getUrl()) .withReadme(app.getReadme()) .withIcon(app.toByteArray()) - .withRole((ApplicationRole) ApplicationEnumsProtoTranslator.translate(app.getRole()).get()) + .withRole(ApplicationEnumsProtoTranslator.translate(app.getRole()).get()) .withPermissions(permissions) .withFeatures(app.getFeaturesList()) .withFeaturesRepo(Optional.empty()) // TODO: need to add features repo