Introduce a new constructor to ResourceRepresentation
The new constructor is for support of unmarshalling operations
like PUT and POST.
Change-Id: I60a333ee451ddd2d385b49d101b9c1786485b365
Signed-off-by: Michael Ochmann <michael.ochmann@sap.com>
diff --git a/org.eclipse.skalli.api/src/main/java/org/eclipse/skalli/services/extension/rest/ResourceRepresentation.java b/org.eclipse.skalli.api/src/main/java/org/eclipse/skalli/services/extension/rest/ResourceRepresentation.java
index 274156f..8c919d5 100644
--- a/org.eclipse.skalli.api/src/main/java/org/eclipse/skalli/services/extension/rest/ResourceRepresentation.java
+++ b/org.eclipse.skalli.api/src/main/java/org/eclipse/skalli/services/extension/rest/ResourceRepresentation.java
@@ -102,21 +102,31 @@
}
/**
- * Creates a resource representation for converting a given object to
- * a specific media type, e.g. to XML or JSON format.
- * <p>
- * Allows to specify additional converters for the conversion of
- * certain properties of the object.
+ * Creates a resource representation for unmarshalling an input stream to
+ * an object using the given REST converter. The REST converter must implement
+ * {@link RestConverter#unmarshal(RestReader)}.
+ *
+ * @param context
+ * @param converter
+ */
+ public ResourceRepresentation(RequestContext context, RestConverter<T> converter) {
+ super(context.getMediaType());
+ this.context = context;
+ this.converter = converter;
+ }
+
+ /**
+ * Creates a resource representation for marshalling a given object to
+ * an output stream using the given REST converter. The REST converter must implement
+ * {@link RestConverter#marshal(Object, RestWriter)}.
*
* @param context the request context.
- * @param @param object the object to convert.
+ * @param object the object to convert.
* @param converter the converter to use.
*/
public ResourceRepresentation(RequestContext context, T object, RestConverter<T> converter) {
- super(context.getMediaType());
+ this(context, converter);
this.object = object;
- this.context = context;
- this.converter = converter;
}
@Override