3131
3232/**
3333 * Google BigQuery Table Field Value class. Objects of this class represent values of a BigQuery
34- * Table Field. A list of values forms a {@link TableRow} . Tables rows can be gotten as the result
35- * of a query or when listing table data.
34+ * Table Field. A list of values forms a table row . Tables rows can be gotten as the result of a
35+ * query or when listing table data.
3636 */
3737public class FieldValue implements Serializable {
3838
@@ -99,7 +99,8 @@ public boolean isNull() {
9999 }
100100
101101 /**
102- * Returns this field's value as an {@link Object}.
102+ * Returns this field's value as a {@link Object}. If {@link #isNull()} is {@code true} this
103+ * method returns {@code null}.
103104 */
104105 public Object value () {
105106 return value ;
@@ -112,9 +113,11 @@ public Object value() {
112113 * {@link Field.Type#timestamp()}).
113114 *
114115 * @throws ClassCastException if the field is not a primitive type
116+ * @throws NullPointerException if {@link #isNull()} returns {@code true}
115117 */
116118 @ SuppressWarnings ("unchecked" )
117119 public String stringValue () {
120+ checkNotNull (value );
118121 return (String ) value ;
119122 }
120123
@@ -155,7 +158,6 @@ public double doubleValue() {
155158 @ SuppressWarnings ("unchecked" )
156159 public boolean booleanValue () {
157160 String stringValue = stringValue ();
158- checkNotNull (stringValue );
159161 checkState (stringValue .equalsIgnoreCase ("true" ) || stringValue .equalsIgnoreCase ("false" ),
160162 "Field value is not of boolean type" );
161163 return Boolean .parseBoolean (stringValue );
@@ -183,9 +185,11 @@ public long timestampValue() {
183185 * {@link Attribute#REPEATED}).
184186 *
185187 * @throws ClassCastException if the field has not {@link Field.Mode#REPEATED} mode
188+ * @throws NullPointerException if {@link #isNull()} returns {@code true}
186189 */
187190 @ SuppressWarnings ("unchecked" )
188191 public List <FieldValue > repeatedValue () {
192+ checkNotNull (value );
189193 return (List <FieldValue >) value ;
190194 }
191195
@@ -195,9 +199,11 @@ public List<FieldValue> repeatedValue() {
195199 * is {@link Attribute#RECORD}).
196200 *
197201 * @throws ClassCastException if the field is not a {@link Field.Type#record(Field...)} type
202+ * @throws NullPointerException if {@link #isNull()} returns {@code true}
198203 */
199204 @ SuppressWarnings ("unchecked" )
200205 public List <FieldValue > recordValue () {
206+ checkNotNull (value );
201207 return (List <FieldValue >) value ;
202208 }
203209
0 commit comments