Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBJ Hargrave2017-02-15 16:21:10 -0500
committerThomas Watson2017-06-16 08:38:08 -0400
commit6b01d11c037e98842a9c3b18a6a8866813d63dab (patch)
tree607a36a91705fd6b9204b626bc226bac9851cf15
parentda81ff3f6ba3536193be01974a56f8d40223b216 (diff)
downloadrt.equinox.framework-6b01d11c037e98842a9c3b18a6a8866813d63dab.tar.gz
rt.equinox.framework-6b01d11c037e98842a9c3b18a6a8866813d63dab.tar.xz
rt.equinox.framework-6b01d11c037e98842a9c3b18a6a8866813d63dab.zip
dto: Update org.osgi.dto package to 1.1
DTO 1.1 adds support for enum and Version field types. Signed-off-by: BJ Hargrave <hargrave@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java16
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/package-info.java12
3 files changed, 16 insertions, 14 deletions
diff --git a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
index e1d72cb93..aa41328a5 100644
--- a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
@@ -51,7 +51,7 @@ Export-Package: org.eclipse.core.runtime.adaptor;x-friends:="org.eclipse.core.ru
org.eclipse.osgi.storage.url.reference;x-internal:=true,
org.eclipse.osgi.storagemanager;version="1.0",
org.eclipse.osgi.util;version="1.1",
- org.osgi.dto;version="1.0",
+ org.osgi.dto;version="1.1",
org.osgi.framework;version="1.9",
org.osgi.framework.dto;version="1.8";uses:="org.osgi.dto",
org.osgi.framework.hooks.bundle;version="1.1";uses:="org.osgi.framework",
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java
index adaf574b3..53074a69b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,13 +26,11 @@ import java.util.Set;
/**
* Super type for Data Transfer Objects.
- *
* <p>
* A Data Transfer Object (DTO) is easily serializable having only public fields
- * of primitive types and their wrapper classes, Strings, and DTOs. List, Set,
- * Map and array aggregates may also be used. The aggregates must only hold
- * objects of the listed types or aggregates.
- *
+ * of primitive types and their wrapper classes, Strings, enums, Version, and
+ * DTOs. List, Set, Map, and array aggregates may also be used. The aggregates
+ * must only hold objects of the listed types or aggregates.
* <p>
* The object graph from a Data Transfer Object must be a tree to simplify
* serialization and deserialization.
@@ -120,6 +118,12 @@ public abstract class DTO {
if (value instanceof Number || value instanceof Boolean) {
return result.append(value.toString());
}
+ if (value instanceof Enum) {
+ return appendString(result, ((Enum< ? >) value).name());
+ }
+ if ("org.osgi.framework.Version".equals(value.getClass().getName())) {
+ return appendString(result, value.toString());
+ }
// Complex types
final String path = objectRefs.get(value);
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/package-info.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/package-info.java
index 1209bb5e6..d0d0ad127 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/package-info.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,27 +15,25 @@
*/
/**
- * OSGi Data Transfer Object Package Version 1.0.
- *
+ * OSGi Data Transfer Object Package Version 1.1.
* <p>
* Bundles wishing to use this package must list the package in the
* Import-Package header of the bundle's manifest. This package has two types of
* users: the consumers that use the API in this package and the providers that
* implement the API in this package.
- *
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.dto; version="[1.0,2.0)"}
+ * {@code Import-Package: org.osgi.dto; version="[1.1,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.dto; version="[1.0,1.1)"}
+ * {@code Import-Package: org.osgi.dto; version="[1.1,1.2)"}
*
* @author $Id$
*/
-@Version("1.0")
+@Version("1.1")
package org.osgi.dto;
import org.osgi.annotation.versioning.Version;

Back to the top