You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by ka...@apache.org on 2015/09/05 16:48:28 UTC
[1/2] storm git commit: STORM-1020 - Added Javadoc to Fields and
ITuple.
Repository: storm
Updated Branches:
refs/heads/master 8b7c11363 -> 895ba4251
STORM-1020 - Added Javadoc to Fields and ITuple.
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/62aa4687
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/62aa4687
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/62aa4687
Branch: refs/heads/master
Commit: 62aa468749255da409e7365b080e9a22f40ed58a
Parents: 8b7c113
Author: Rick Kellogg <rm...@comcast.net>
Authored: Fri Sep 4 16:55:58 2015 -0400
Committer: Jungtaek Lim <ka...@gmail.com>
Committed: Sat Sep 5 23:44:59 2015 +0900
----------------------------------------------------------------------
.../src/jvm/backtype/storm/tuple/Fields.java | 21 +++-
.../src/jvm/backtype/storm/tuple/ITuple.java | 126 +++++++++++++++----
2 files changed, 121 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/62aa4687/storm-core/src/jvm/backtype/storm/tuple/Fields.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/tuple/Fields.java b/storm-core/src/jvm/backtype/storm/tuple/Fields.java
index 9805ba6..3eed409 100644
--- a/storm-core/src/jvm/backtype/storm/tuple/Fields.java
+++ b/storm-core/src/jvm/backtype/storm/tuple/Fields.java
@@ -25,6 +25,9 @@ import java.util.List;
import java.util.Map;
import java.io.Serializable;
+/**
+ * Collection of unique named fields using in an ITuple
+ */
public class Fields implements Iterable<String>, Serializable {
private List<String> _fields;
private Map<String, Integer> _index = new HashMap<String, Integer>();
@@ -57,10 +60,20 @@ public class Fields implements Iterable<String>, Serializable {
return new ArrayList<String>(_fields);
}
+ /**
+ * Returns the number of fields in this collection.
+ */
public int size() {
return _fields.size();
}
+ /**
+ * Gets the field at position index in the collection.
+ *
+ * @param index index of the field to return
+ *
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
+ */
public String get(int index) {
return _fields.get(index);
}
@@ -70,7 +83,11 @@ public class Fields implements Iterable<String>, Serializable {
}
/**
- * Returns the position of the specified field.
+ * Returns the position of the specified named field.
+ *
+ * @param field Named field to evaluate
+ *
+ * @throws IllegalArgumentException - if field does not exist
*/
public int fieldIndex(String field) {
Integer ret = _index.get(field);
@@ -81,7 +98,7 @@ public class Fields implements Iterable<String>, Serializable {
}
/**
- * Returns true if this contains the specified name of the field.
+ * @returns true if this contains the specified name of the field.
*/
public boolean contains(String field) {
return _index.containsKey(field);
http://git-wip-us.apache.org/repos/asf/storm/blob/62aa4687/storm-core/src/jvm/backtype/storm/tuple/ITuple.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/tuple/ITuple.java b/storm-core/src/jvm/backtype/storm/tuple/ITuple.java
index c85848d..4d6292e 100644
--- a/storm-core/src/jvm/backtype/storm/tuple/ITuple.java
+++ b/storm-core/src/jvm/backtype/storm/tuple/ITuple.java
@@ -37,8 +37,10 @@ public interface ITuple {
public Fields getFields();
/**
- * Returns the position of the specified field in this tuple.
- */
+ * Returns the position of the specified field in this tuple.
+ *
+ * @throws IllegalArgumentException - if field does not exist
+ */
public int fieldIndex(String field);
/**
@@ -47,83 +49,161 @@ public interface ITuple {
public List<Object> select(Fields selector);
/**
- * Gets the field at position i in the tuple. Returns object since tuples are dynamically typed.
+ * Gets the field at position i in the tuple. Returns object since tuples are dynamically typed.
+ *
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public Object getValue(int i);
/**
- * Returns the String at position i in the tuple. If that field is not a String,
- * you will get a runtime error.
+ * Returns the String at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a String
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public String getString(int i);
/**
- * Returns the Integer at position i in the tuple. If that field is not an Integer,
- * you will get a runtime error.
+ * Returns the Integer at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a Integer
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public Integer getInteger(int i);
/**
- * Returns the Long at position i in the tuple. If that field is not a Long,
- * you will get a runtime error.
+ * Returns the Long at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a Long
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public Long getLong(int i);
/**
- * Returns the Boolean at position i in the tuple. If that field is not a Boolean,
- * you will get a runtime error.
+ * Returns the Boolean at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a Boolean
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public Boolean getBoolean(int i);
/**
- * Returns the Short at position i in the tuple. If that field is not a Short,
- * you will get a runtime error.
+ * Returns the Short at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a Short
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public Short getShort(int i);
/**
- * Returns the Byte at position i in the tuple. If that field is not a Byte,
- * you will get a runtime error.
+ * Returns the Byte at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a Byte
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public Byte getByte(int i);
/**
- * Returns the Double at position i in the tuple. If that field is not a Double,
- * you will get a runtime error.
+ * Returns the Double at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a Double
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public Double getDouble(int i);
/**
- * Returns the Float at position i in the tuple. If that field is not a Float,
- * you will get a runtime error.
+ * Returns the Float at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a Float
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public Float getFloat(int i);
/**
- * Returns the byte array at position i in the tuple. If that field is not a byte array,
- * you will get a runtime error.
+ * Returns the byte array at position i in the tuple.
+ *
+ * @throws ClassCastException If that field is not a byte array
+ * @throws IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
*/
public byte[] getBinary(int i);
-
+ /**
+ * Gets the field with a specific name. Returns object since tuples are dynamically typed.
+ *
+ * @throws IllegalArgumentException - if field does not exist
+ */
public Object getValueByField(String field);
+ /**
+ * Gets the String field with a specific name.
+ *
+ * @throws ClassCastException If that field is not a String
+ * @throws IllegalArgumentException - if field does not exist
+ */
public String getStringByField(String field);
+ /**
+ * Gets the Integer field with a specific name.
+ *
+ * @throws ClassCastException If that field is not an Integer
+ * @throws IllegalArgumentException - if field does not exist
+ */
public Integer getIntegerByField(String field);
+ /**
+ * Gets the Long field with a specific name.
+ *
+ * @throws ClassCastException If that field is not a Long
+ * @throws IllegalArgumentException - if field does not exist
+ */
public Long getLongByField(String field);
+ /**
+ * Gets the Boolean field with a specific name.
+ *
+ * @throws ClassCastException If that field is not a Boolean
+ * @throws IllegalArgumentException - if field does not exist
+ */
public Boolean getBooleanByField(String field);
+ /**
+ * Gets the Short field with a specific name.
+ *
+ * @throws ClassCastException If that field is not a Short
+ * @throws IllegalArgumentException - if field does not exist
+ */
public Short getShortByField(String field);
+ /**
+ * Gets the Byte field with a specific name.
+ *
+ * @throws ClassCastException If that field is not a Byte
+ * @throws IllegalArgumentException - if field does not exist
+ */
public Byte getByteByField(String field);
+ /**
+ * Gets the Double field with a specific name.
+ *
+ * @throws ClassCastException If that field is not a Double
+ * @throws IllegalArgumentException - if field does not exist
+ */
public Double getDoubleByField(String field);
+ /**
+ * Gets the Float field with a specific name.
+ *
+ * @throws ClassCastException If that field is not a Float
+ * @throws IllegalArgumentException - if field does not exist
+ */
public Float getFloatByField(String field);
+ /**
+ * Gets the Byte array field with a specific name.
+ *
+ * @throws ClassCastException If that field is not a byte array
+ * @throws IllegalArgumentException - if field does not exist
+ */
public byte[] getBinaryByField(String field);
/**
@@ -131,6 +211,4 @@ public interface ITuple {
*/
public List<Object> getValues();
-
-
}
[2/2] storm git commit: add STORM-1020 to CHANGELOG.md
Posted by ka...@apache.org.
add STORM-1020 to CHANGELOG.md
* also add Rick Kellogg to contributor list
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/895ba425
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/895ba425
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/895ba425
Branch: refs/heads/master
Commit: 895ba4251570ae4c8857ccd00b91af80cf51e957
Parents: 62aa468
Author: Jungtaek Lim <ka...@gmail.com>
Authored: Sat Sep 5 23:47:36 2015 +0900
Committer: Jungtaek Lim <ka...@gmail.com>
Committed: Sat Sep 5 23:47:36 2015 +0900
----------------------------------------------------------------------
CHANGELOG.md | 1 +
README.markdown | 1 +
2 files changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/895ba425/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 743c4d6..10ceee6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
## 0.11.0
+ * STORM-1020: Document exceptions in ITuple & Fields
* STORM-1025: Invalid links at https://storm.apache.org/about/multi-language.html
* STORM-1010: Each KafkaBolt could have a specified properties.
* STORM-1008: Isolate the code for metric collection and retrieval from DisruptorQueue
http://git-wip-us.apache.org/repos/asf/storm/blob/895ba425/README.markdown
----------------------------------------------------------------------
diff --git a/README.markdown b/README.markdown
index d831b79..dfe1666 100644
--- a/README.markdown
+++ b/README.markdown
@@ -225,6 +225,7 @@ under the License.
* Dean de Bree ([@ddebree](https://github.com/ddebree))
* Renkai Ge ([@Renkai](https://github.com/Renkai))
* Aaron Coburn ([@acoburn](https://github.com/acoburn))
+* Rick Kellogg ([@rmkellogg](https://github.com/rmkellogg))
## Acknowledgements