You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2015/12/01 02:35:24 UTC
[2/3] incubator-streams git commit: STREAMS-385: missing class
STREAMS-385: missing class
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/2b39e835
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/2b39e835
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/2b39e835
Branch: refs/heads/master
Commit: 2b39e8351e883cd11fce882baf2b1f080a1db757
Parents: 786f9ea
Author: Steve Blackmon (@steveblackmon) <sb...@apache.org>
Authored: Mon Nov 30 10:19:51 2015 -0600
Committer: Steve Blackmon (@steveblackmon) <sb...@apache.org>
Committed: Mon Nov 30 10:21:38 2015 -0600
----------------------------------------------------------------------
.../streams/data/ActivityObjectConverter.java | 65 ++++++++++++++++++++
1 file changed, 65 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/2b39e835/streams-pojo/src/main/java/org/apache/streams/data/ActivityObjectConverter.java
----------------------------------------------------------------------
diff --git a/streams-pojo/src/main/java/org/apache/streams/data/ActivityObjectConverter.java b/streams-pojo/src/main/java/org/apache/streams/data/ActivityObjectConverter.java
new file mode 100644
index 0000000..0d25d91
--- /dev/null
+++ b/streams-pojo/src/main/java/org/apache/streams/data/ActivityObjectConverter.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.streams.data;
+
+import org.apache.streams.exceptions.ActivityConversionException;
+import org.apache.streams.pojo.json.ActivityObject;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Converts non-ActivityObject documents to ActivityObjects and back.
+ *
+ * Each converter may return zero or one alternative representations.
+ *
+ */
+
+public interface ActivityObjectConverter<T> extends Serializable {
+
+ /**
+ * What class does this ActivityConverter require?
+ *
+ * @return The class the ActivityConverter requires. Should always return the templated class.
+ */
+ Class requiredClass();
+
+ /**
+ * Gets the supported content type that can be deserialized/serialized
+ *
+ * @return A string representing the format name. Can be an IETF MIME type or other
+ */
+ String serializationFormat();
+
+ /**
+ * Converts the activity to a POJO representation.
+ *
+ * @param deserialized the string
+ * @return a fully populated Activity object
+ */
+ T fromActivityObject(ActivityObject deserialized) throws ActivityConversionException;
+
+ /**
+ * Converts a POJO into an ActivityObject
+ * @param serialized the string representation
+ * @return a fully populated Activity object
+ */
+ ActivityObject toActivityObject(T serialized) throws ActivityConversionException;
+
+}