From 6b01d11c037e98842a9c3b18a6a8866813d63dab Mon Sep 17 00:00:00 2001 From: BJ Hargrave Date: Wed, 15 Feb 2017 16:21:10 -0500 Subject: 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 --- bundles/org.eclipse.osgi/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java | 16 ++++++++++------ .../osgi/src/org/osgi/dto/package-info.java | 12 +++++------- 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. - * *

* 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. *

* 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. *

* 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. - * *

* Example import for consumers using the API in this package: *

- * {@code Import-Package: org.osgi.dto; version="[1.0,2.0)"} + * {@code Import-Package: org.osgi.dto; version="[1.1,2.0)"} *

* Example import for providers implementing the API in this package: *

- * {@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; -- cgit v1.2.3