Committed by
Thomas Vachuska
[ONOS-2499]update accordingly for ONOS-2408's review recommendation
Change-Id: I24e7c4acbe38e4286b994c5bf50d22def945fb29
Showing
31 changed files
with
81 additions
and
69 deletions
... | @@ -42,9 +42,9 @@ public final class MonitorRequest { | ... | @@ -42,9 +42,9 @@ public final class MonitorRequest { |
42 | */ | 42 | */ |
43 | public MonitorRequest(String tableName, Set<String> columns, | 43 | public MonitorRequest(String tableName, Set<String> columns, |
44 | MonitorSelect select) { | 44 | MonitorSelect select) { |
45 | - checkNotNull(tableName, "tableName is not null"); | 45 | + checkNotNull(tableName, "table name cannot be null"); |
46 | - checkNotNull(columns, "columns is not null"); | 46 | + checkNotNull(columns, "columns cannot be null"); |
47 | - checkNotNull(select, "select is not null"); | 47 | + checkNotNull(select, "select cannot be null"); |
48 | this.tableName = tableName; | 48 | this.tableName = tableName; |
49 | this.columns = columns; | 49 | this.columns = columns; |
50 | this.select = select; | 50 | this.select = select; | ... | ... |
... | @@ -50,7 +50,7 @@ public final class OperationResult { | ... | @@ -50,7 +50,7 @@ public final class OperationResult { |
50 | * @param rows List of Row entity | 50 | * @param rows List of Row entity |
51 | */ | 51 | */ |
52 | public OperationResult(List<Row> rows) { | 52 | public OperationResult(List<Row> rows) { |
53 | - checkNotNull(rows, "rows is not null"); | 53 | + checkNotNull(rows, "rows cannot be null"); |
54 | this.rows = rows; | 54 | this.rows = rows; |
55 | } | 55 | } |
56 | 56 | ||
... | @@ -64,10 +64,10 @@ public final class OperationResult { | ... | @@ -64,10 +64,10 @@ public final class OperationResult { |
64 | */ | 64 | */ |
65 | public OperationResult(int count, UUID uuid, List<Row> rows, String error, | 65 | public OperationResult(int count, UUID uuid, List<Row> rows, String error, |
66 | String details) { | 66 | String details) { |
67 | - checkNotNull(uuid, "uuid is not null"); | 67 | + checkNotNull(uuid, "uuid cannot be null"); |
68 | - checkNotNull(rows, "rows is not null"); | 68 | + checkNotNull(rows, "rows cannot be null"); |
69 | - checkNotNull(error, "error is not null"); | 69 | + checkNotNull(error, "error cannot be null"); |
70 | - checkNotNull(details, "details is not null"); | 70 | + checkNotNull(details, "details cannot be null"); |
71 | this.count = count; | 71 | this.count = count; |
72 | this.uuid = uuid; | 72 | this.uuid = uuid; |
73 | this.rows = rows; | 73 | this.rows = rows; |
... | @@ -105,7 +105,7 @@ public final class OperationResult { | ... | @@ -105,7 +105,7 @@ public final class OperationResult { |
105 | * @param uuid the Operation message of uuid | 105 | * @param uuid the Operation message of uuid |
106 | */ | 106 | */ |
107 | public void setUuid(String uuid) { | 107 | public void setUuid(String uuid) { |
108 | - checkNotNull(uuid, "uuid is not null"); | 108 | + checkNotNull(uuid, "uuid cannot be null"); |
109 | this.uuid = UUID.uuid(uuid); | 109 | this.uuid = UUID.uuid(uuid); |
110 | } | 110 | } |
111 | 111 | ||
... | @@ -122,7 +122,7 @@ public final class OperationResult { | ... | @@ -122,7 +122,7 @@ public final class OperationResult { |
122 | * @param rows the Operation message of rows | 122 | * @param rows the Operation message of rows |
123 | */ | 123 | */ |
124 | public void setRows(List<Row> rows) { | 124 | public void setRows(List<Row> rows) { |
125 | - checkNotNull(rows, "rows is not null"); | 125 | + checkNotNull(rows, "rows cannot be null"); |
126 | this.rows = rows; | 126 | this.rows = rows; |
127 | } | 127 | } |
128 | 128 | ||
... | @@ -139,7 +139,7 @@ public final class OperationResult { | ... | @@ -139,7 +139,7 @@ public final class OperationResult { |
139 | * @param error the Operation message of error | 139 | * @param error the Operation message of error |
140 | */ | 140 | */ |
141 | public void setError(String error) { | 141 | public void setError(String error) { |
142 | - checkNotNull(error, "error is not null"); | 142 | + checkNotNull(error, "error cannot be null"); |
143 | this.error = error; | 143 | this.error = error; |
144 | } | 144 | } |
145 | 145 | ||
... | @@ -156,7 +156,7 @@ public final class OperationResult { | ... | @@ -156,7 +156,7 @@ public final class OperationResult { |
156 | * @param details the Operation message of details | 156 | * @param details the Operation message of details |
157 | */ | 157 | */ |
158 | public void setDetails(String details) { | 158 | public void setDetails(String details) { |
159 | - checkNotNull(details, "details is not null"); | 159 | + checkNotNull(details, "details cannot be null"); |
160 | this.details = details; | 160 | this.details = details; |
161 | } | 161 | } |
162 | } | 162 | } | ... | ... |
... | @@ -40,7 +40,7 @@ public final class RowUpdate { | ... | @@ -40,7 +40,7 @@ public final class RowUpdate { |
40 | * @param newRow present for "initial", "insert", and "modify" updates | 40 | * @param newRow present for "initial", "insert", and "modify" updates |
41 | */ | 41 | */ |
42 | public RowUpdate(UUID uuid, Row oldRow, Row newRow) { | 42 | public RowUpdate(UUID uuid, Row oldRow, Row newRow) { |
43 | - checkNotNull(uuid, "uuid is not null"); | 43 | + checkNotNull(uuid, "uuid cannot be null"); |
44 | this.uuid = uuid; | 44 | this.uuid = uuid; |
45 | this.oldRow = oldRow; | 45 | this.oldRow = oldRow; |
46 | this.newRow = newRow; | 46 | this.newRow = newRow; | ... | ... |
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | package org.onosproject.ovsdb.rfc.message; | 16 | package org.onosproject.ovsdb.rfc.message; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
19 | 20 | ||
20 | import java.util.Map; | 21 | import java.util.Map; |
21 | import java.util.Objects; | 22 | import java.util.Objects; |
... | @@ -44,6 +45,7 @@ public final class TableUpdate { | ... | @@ -44,6 +45,7 @@ public final class TableUpdate { |
44 | * @return TableUpdate entity | 45 | * @return TableUpdate entity |
45 | */ | 46 | */ |
46 | public static TableUpdate tableUpdate(Map<UUID, RowUpdate> rows) { | 47 | public static TableUpdate tableUpdate(Map<UUID, RowUpdate> rows) { |
48 | + checkNotNull(rows, "rows cannot be null"); | ||
47 | return new TableUpdate(rows); | 49 | return new TableUpdate(rows); |
48 | } | 50 | } |
49 | 51 | ... | ... |
... | @@ -44,7 +44,7 @@ public final class TableUpdates { | ... | @@ -44,7 +44,7 @@ public final class TableUpdates { |
44 | * @return TableUpdates | 44 | * @return TableUpdates |
45 | */ | 45 | */ |
46 | public static TableUpdates tableUpdates(Map<String, TableUpdate> result) { | 46 | public static TableUpdates tableUpdates(Map<String, TableUpdate> result) { |
47 | - checkNotNull(result, "result is not null"); | 47 | + checkNotNull(result, "result cannot be null"); |
48 | return new TableUpdates(result); | 48 | return new TableUpdates(result); |
49 | } | 49 | } |
50 | 50 | ... | ... |
... | @@ -41,8 +41,8 @@ public final class UpdateNotification { | ... | @@ -41,8 +41,8 @@ public final class UpdateNotification { |
41 | * @param tbUpdatesJsonNode the "table-updates" in "params" of the result JsonNode | 41 | * @param tbUpdatesJsonNode the "table-updates" in "params" of the result JsonNode |
42 | */ | 42 | */ |
43 | public UpdateNotification(Object context, JsonNode tbUpdatesJsonNode) { | 43 | public UpdateNotification(Object context, JsonNode tbUpdatesJsonNode) { |
44 | - checkNotNull(context, "context is not null"); | 44 | + checkNotNull(context, "context cannot be null"); |
45 | - checkNotNull(tbUpdatesJsonNode, "tbUpdatesJsonNode is not null"); | 45 | + checkNotNull(tbUpdatesJsonNode, "tablebUpdates JsonNode cannot be null"); |
46 | this.context = context; | 46 | this.context = context; |
47 | this.tbUpdatesJsonNode = tbUpdatesJsonNode; | 47 | this.tbUpdatesJsonNode = tbUpdatesJsonNode; |
48 | } | 48 | } | ... | ... |
... | @@ -38,8 +38,8 @@ public final class Column { | ... | @@ -38,8 +38,8 @@ public final class Column { |
38 | * @param obj the data of the column | 38 | * @param obj the data of the column |
39 | */ | 39 | */ |
40 | public Column(ColumnSchema schema, Object obj) { | 40 | public Column(ColumnSchema schema, Object obj) { |
41 | - checkNotNull(schema, "schema is not null"); | 41 | + checkNotNull(schema, "schema cannot be null"); |
42 | - checkNotNull(obj, "data is not null"); | 42 | + checkNotNull(obj, "data cannot be null"); |
43 | this.schema = schema; | 43 | this.schema = schema; |
44 | this.data = obj; | 44 | this.data = obj; |
45 | } | 45 | } | ... | ... |
... | @@ -64,9 +64,9 @@ public final class Condition { | ... | @@ -64,9 +64,9 @@ public final class Condition { |
64 | * @param value column data | 64 | * @param value column data |
65 | */ | 65 | */ |
66 | public Condition(String column, Function function, Object value) { | 66 | public Condition(String column, Function function, Object value) { |
67 | - checkNotNull(column, "column is not null"); | 67 | + checkNotNull(column, "column cannot be null"); |
68 | - checkNotNull(function, "function is not null"); | 68 | + checkNotNull(function, "function cannot be null"); |
69 | - checkNotNull(value, "value is not null"); | 69 | + checkNotNull(value, "value cannot be null"); |
70 | this.column = column; | 70 | this.column = column; |
71 | this.function = function; | 71 | this.function = function; |
72 | this.value = value; | 72 | this.value = value; | ... | ... |
... | @@ -65,9 +65,9 @@ public final class Mutation { | ... | @@ -65,9 +65,9 @@ public final class Mutation { |
65 | * @param value column data | 65 | * @param value column data |
66 | */ | 66 | */ |
67 | public Mutation(String column, Mutator mutator, Object value) { | 67 | public Mutation(String column, Mutator mutator, Object value) { |
68 | - checkNotNull(column, "column is not null"); | 68 | + checkNotNull(column, "column cannot be null"); |
69 | - checkNotNull(mutator, "mutator is not null"); | 69 | + checkNotNull(mutator, "mutator cannot be null"); |
70 | - checkNotNull(value, "value is not null"); | 70 | + checkNotNull(value, "value cannot be null"); |
71 | this.column = column; | 71 | this.column = column; |
72 | this.mutator = mutator; | 72 | this.mutator = mutator; |
73 | this.value = value; | 73 | this.value = value; | ... | ... |
... | @@ -38,7 +38,7 @@ public final class OvsdbMap { | ... | @@ -38,7 +38,7 @@ public final class OvsdbMap { |
38 | * @param map java.util.Map | 38 | * @param map java.util.Map |
39 | */ | 39 | */ |
40 | private OvsdbMap(Map map) { | 40 | private OvsdbMap(Map map) { |
41 | - checkNotNull(map, "map is not null"); | 41 | + checkNotNull(map, "map cannot be null"); |
42 | this.map = map; | 42 | this.map = map; |
43 | } | 43 | } |
44 | 44 | ... | ... |
... | @@ -40,7 +40,7 @@ public final class OvsdbSet { | ... | @@ -40,7 +40,7 @@ public final class OvsdbSet { |
40 | * @param set java.util.Set | 40 | * @param set java.util.Set |
41 | */ | 41 | */ |
42 | private OvsdbSet(Set set) { | 42 | private OvsdbSet(Set set) { |
43 | - checkNotNull(set, "set is not null"); | 43 | + checkNotNull(set, "set cannot be null"); |
44 | this.set = set; | 44 | this.set = set; |
45 | } | 45 | } |
46 | 46 | ... | ... |
... | @@ -36,8 +36,8 @@ public final class RefTableRow { | ... | @@ -36,8 +36,8 @@ public final class RefTableRow { |
36 | * @param jsonNode JsonNode | 36 | * @param jsonNode JsonNode |
37 | */ | 37 | */ |
38 | public RefTableRow(String refTable, JsonNode jsonNode) { | 38 | public RefTableRow(String refTable, JsonNode jsonNode) { |
39 | - checkNotNull(refTable, "refTable is not null"); | 39 | + checkNotNull(refTable, "refTable cannot be null"); |
40 | - checkNotNull(jsonNode, "jsonNode is not null"); | 40 | + checkNotNull(jsonNode, "jsonNode cannot be null"); |
41 | this.refTable = refTable; | 41 | this.refTable = refTable; |
42 | this.jsonNode = jsonNode; | 42 | this.jsonNode = jsonNode; |
43 | } | 43 | } | ... | ... |
... | @@ -49,7 +49,7 @@ public final class Row { | ... | @@ -49,7 +49,7 @@ public final class Row { |
49 | * @param tableSchema TableSchema entity | 49 | * @param tableSchema TableSchema entity |
50 | */ | 50 | */ |
51 | public Row(TableSchema tableSchema) { | 51 | public Row(TableSchema tableSchema) { |
52 | - checkNotNull(tableSchema, "tableSchema is not null"); | 52 | + checkNotNull(tableSchema, "tableSchema cannot be null"); |
53 | this.tableSchema = tableSchema; | 53 | this.tableSchema = tableSchema; |
54 | this.columns = Maps.newHashMap(); | 54 | this.columns = Maps.newHashMap(); |
55 | } | 55 | } |
... | @@ -60,8 +60,8 @@ public final class Row { | ... | @@ -60,8 +60,8 @@ public final class Row { |
60 | * @param columns List of Column entity | 60 | * @param columns List of Column entity |
61 | */ | 61 | */ |
62 | public Row(TableSchema tableSchema, List<Column> columns) { | 62 | public Row(TableSchema tableSchema, List<Column> columns) { |
63 | - checkNotNull(tableSchema, "tableSchema is not null"); | 63 | + checkNotNull(tableSchema, "tableSchema cannot be null"); |
64 | - checkNotNull(columns, "columns is not null"); | 64 | + checkNotNull(columns, "columns cannot be null"); |
65 | this.tableSchema = tableSchema; | 65 | this.tableSchema = tableSchema; |
66 | this.columns = Maps.newHashMap(); | 66 | this.columns = Maps.newHashMap(); |
67 | for (Column column : columns) { | 67 | for (Column column : columns) { | ... | ... |
... | @@ -36,7 +36,7 @@ public final class UUID { | ... | @@ -36,7 +36,7 @@ public final class UUID { |
36 | * @param value UUID value | 36 | * @param value UUID value |
37 | */ | 37 | */ |
38 | private UUID(String value) { | 38 | private UUID(String value) { |
39 | - checkNotNull(value, "value is not null"); | 39 | + checkNotNull(value, "value cannot be null"); |
40 | this.value = value; | 40 | this.value = value; |
41 | } | 41 | } |
42 | 42 | ... | ... |
... | @@ -20,7 +20,6 @@ import java.io.IOException; | ... | @@ -20,7 +20,6 @@ import java.io.IOException; |
20 | import org.onosproject.ovsdb.rfc.notation.UUID; | 20 | import org.onosproject.ovsdb.rfc.notation.UUID; |
21 | 21 | ||
22 | import com.fasterxml.jackson.core.JsonGenerator; | 22 | import com.fasterxml.jackson.core.JsonGenerator; |
23 | -import com.fasterxml.jackson.core.JsonProcessingException; | ||
24 | import com.fasterxml.jackson.databind.JsonSerializer; | 23 | import com.fasterxml.jackson.databind.JsonSerializer; |
25 | import com.fasterxml.jackson.databind.SerializerProvider; | 24 | import com.fasterxml.jackson.databind.SerializerProvider; |
26 | 25 | ||
... | @@ -30,13 +29,12 @@ import com.fasterxml.jackson.databind.SerializerProvider; | ... | @@ -30,13 +29,12 @@ import com.fasterxml.jackson.databind.SerializerProvider; |
30 | public class UUIDSerializer extends JsonSerializer<UUID> { | 29 | public class UUIDSerializer extends JsonSerializer<UUID> { |
31 | @Override | 30 | @Override |
32 | public void serialize(UUID value, JsonGenerator generator, | 31 | public void serialize(UUID value, JsonGenerator generator, |
33 | - SerializerProvider provider) | 32 | + SerializerProvider provider) throws IOException { |
34 | - throws IOException, JsonProcessingException { | ||
35 | generator.writeStartArray(); | 33 | generator.writeStartArray(); |
36 | - try { | 34 | + String reg = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"; |
37 | - java.util.UUID.fromString(value.value()); | 35 | + if (value.value().matches(reg)) { |
38 | generator.writeString("uuid"); | 36 | generator.writeString("uuid"); |
39 | - } catch (IllegalArgumentException ex) { | 37 | + } else { |
40 | generator.writeString("named-uuid"); | 38 | generator.writeString("named-uuid"); |
41 | } | 39 | } |
42 | generator.writeString(value.value()); | 40 | generator.writeString(value.value()); | ... | ... |
... | @@ -32,7 +32,7 @@ public final class Assert implements Operation { | ... | @@ -32,7 +32,7 @@ public final class Assert implements Operation { |
32 | * @param lock the lock member of assert operation | 32 | * @param lock the lock member of assert operation |
33 | */ | 33 | */ |
34 | public Assert(String lock) { | 34 | public Assert(String lock) { |
35 | - checkNotNull(lock, "lock is not null"); | 35 | + checkNotNull(lock, "lock cannot be null"); |
36 | this.op = Operations.ASSERT.op(); | 36 | this.op = Operations.ASSERT.op(); |
37 | this.lock = lock; | 37 | this.lock = lock; |
38 | } | 38 | } | ... | ... |
... | @@ -32,7 +32,7 @@ public final class Comment implements Operation { | ... | @@ -32,7 +32,7 @@ public final class Comment implements Operation { |
32 | * @param comment the comment member of comment operation | 32 | * @param comment the comment member of comment operation |
33 | */ | 33 | */ |
34 | public Comment(String comment) { | 34 | public Comment(String comment) { |
35 | - checkNotNull(comment, "comment is not null"); | 35 | + checkNotNull(comment, "comment cannot be null"); |
36 | this.op = Operations.COMMENT.op(); | 36 | this.op = Operations.COMMENT.op(); |
37 | this.comment = comment; | 37 | this.comment = comment; |
38 | } | 38 | } | ... | ... |
... | @@ -32,7 +32,7 @@ public final class Commit implements Operation { | ... | @@ -32,7 +32,7 @@ public final class Commit implements Operation { |
32 | * @param durable the durable member of commit operation | 32 | * @param durable the durable member of commit operation |
33 | */ | 33 | */ |
34 | public Commit(Boolean durable) { | 34 | public Commit(Boolean durable) { |
35 | - checkNotNull(durable, "durable is not null"); | 35 | + checkNotNull(durable, "durable cannot be null"); |
36 | this.op = Operations.COMMIT.op(); | 36 | this.op = Operations.COMMIT.op(); |
37 | this.durable = durable; | 37 | this.durable = durable; |
38 | } | 38 | } | ... | ... |
... | @@ -41,7 +41,7 @@ public final class Delete implements Operation { | ... | @@ -41,7 +41,7 @@ public final class Delete implements Operation { |
41 | * @param where the List of Condition entity | 41 | * @param where the List of Condition entity |
42 | */ | 42 | */ |
43 | public Delete(TableSchema schema, List<Condition> where) { | 43 | public Delete(TableSchema schema, List<Condition> where) { |
44 | - checkNotNull(schema, "TableSchema is not null"); | 44 | + checkNotNull(schema, "TableSchema cannot be null"); |
45 | checkNotNull(where, "where is not null"); | 45 | checkNotNull(where, "where is not null"); |
46 | this.tableSchema = schema; | 46 | this.tableSchema = schema; |
47 | this.op = Operations.DELETE.op(); | 47 | this.op = Operations.DELETE.op(); | ... | ... |
... | @@ -49,9 +49,9 @@ public final class Insert implements Operation { | ... | @@ -49,9 +49,9 @@ public final class Insert implements Operation { |
49 | * @param row Row entity | 49 | * @param row Row entity |
50 | */ | 50 | */ |
51 | public Insert(TableSchema schema, String uuidName, Row row) { | 51 | public Insert(TableSchema schema, String uuidName, Row row) { |
52 | - checkNotNull(schema, "TableSchema is not null"); | 52 | + checkNotNull(schema, "TableSchema cannot be null"); |
53 | - checkNotNull(uuidName, "uuidName is not null"); | 53 | + checkNotNull(uuidName, "uuid name cannot be null"); |
54 | - checkNotNull(row, "row is not null"); | 54 | + checkNotNull(row, "row cannot be null"); |
55 | this.tableSchema = schema; | 55 | this.tableSchema = schema; |
56 | this.op = Operations.INSERT.op(); | 56 | this.op = Operations.INSERT.op(); |
57 | this.uuidName = uuidName; | 57 | this.uuidName = uuidName; | ... | ... |
... | @@ -45,9 +45,9 @@ public final class Mutate implements Operation { | ... | @@ -45,9 +45,9 @@ public final class Mutate implements Operation { |
45 | */ | 45 | */ |
46 | public Mutate(TableSchema schema, List<Condition> where, | 46 | public Mutate(TableSchema schema, List<Condition> where, |
47 | List<Mutation> mutations) { | 47 | List<Mutation> mutations) { |
48 | - checkNotNull(schema, "TableSchema is not null"); | 48 | + checkNotNull(schema, "TableSchema cannot be null"); |
49 | - checkNotNull(mutations, "mutations is not null"); | 49 | + checkNotNull(mutations, "mutations cannot be null"); |
50 | - checkNotNull(where, "where is not null"); | 50 | + checkNotNull(where, "where cannot be null"); |
51 | this.tableSchema = schema; | 51 | this.tableSchema = schema; |
52 | this.op = Operations.MUTATE.op(); | 52 | this.op = Operations.MUTATE.op(); |
53 | this.where = where; | 53 | this.where = where; | ... | ... |
... | @@ -43,9 +43,9 @@ public final class Select implements Operation { | ... | @@ -43,9 +43,9 @@ public final class Select implements Operation { |
43 | * @param columns the List of column name | 43 | * @param columns the List of column name |
44 | */ | 44 | */ |
45 | public Select(TableSchema schema, List<Condition> where, List<String> columns) { | 45 | public Select(TableSchema schema, List<Condition> where, List<String> columns) { |
46 | - checkNotNull(schema, "TableSchema is not null"); | 46 | + checkNotNull(schema, "TableSchema cannot be null"); |
47 | - checkNotNull(where, "where is not null"); | 47 | + checkNotNull(where, "where cannot be null"); |
48 | - checkNotNull(columns, "columns is not null"); | 48 | + checkNotNull(columns, "columns cannot be null"); |
49 | this.tableSchema = schema; | 49 | this.tableSchema = schema; |
50 | this.op = Operations.SELECT.op(); | 50 | this.op = Operations.SELECT.op(); |
51 | this.where = where; | 51 | this.where = where; | ... | ... |
... | @@ -50,9 +50,9 @@ public final class Update implements Operation { | ... | @@ -50,9 +50,9 @@ public final class Update implements Operation { |
50 | * @param where the List of Condition entity | 50 | * @param where the List of Condition entity |
51 | */ | 51 | */ |
52 | public Update(TableSchema schema, Row row, List<Condition> where) { | 52 | public Update(TableSchema schema, Row row, List<Condition> where) { |
53 | - checkNotNull(schema, "TableSchema is not null"); | 53 | + checkNotNull(schema, "TableSchema cannot be null"); |
54 | - checkNotNull(row, "row is not null"); | 54 | + checkNotNull(row, "row cannot be null"); |
55 | - checkNotNull(where, "where is not null"); | 55 | + checkNotNull(where, "where cannot be null"); |
56 | this.tableSchema = schema; | 56 | this.tableSchema = schema; |
57 | this.op = Operations.UPDATE.op(); | 57 | this.op = Operations.UPDATE.op(); |
58 | this.row = Maps.newHashMap(); | 58 | this.row = Maps.newHashMap(); | ... | ... |
... | @@ -35,8 +35,8 @@ public final class ColumnSchema { | ... | @@ -35,8 +35,8 @@ public final class ColumnSchema { |
35 | * @param columnType the column type | 35 | * @param columnType the column type |
36 | */ | 36 | */ |
37 | public ColumnSchema(String name, ColumnType columnType) { | 37 | public ColumnSchema(String name, ColumnType columnType) { |
38 | - checkNotNull(name, "name is not null"); | 38 | + checkNotNull(name, "name cannot be null"); |
39 | - checkNotNull(columnType, "columnType is not null"); | 39 | + checkNotNull(columnType, "column type cannot be null"); |
40 | this.name = name; | 40 | this.name = name; |
41 | this.type = columnType; | 41 | this.type = columnType; |
42 | } | 42 | } | ... | ... |
... | @@ -40,9 +40,9 @@ public final class DatabaseSchema { | ... | @@ -40,9 +40,9 @@ public final class DatabaseSchema { |
40 | */ | 40 | */ |
41 | public DatabaseSchema(String name, String version, | 41 | public DatabaseSchema(String name, String version, |
42 | Map<String, TableSchema> tableSchemas) { | 42 | Map<String, TableSchema> tableSchemas) { |
43 | - checkNotNull(name, "name is not null"); | 43 | + checkNotNull(name, "name cannot be null"); |
44 | - checkNotNull(version, "version is not null"); | 44 | + checkNotNull(version, "version cannot be null"); |
45 | - checkNotNull(tableSchemas, "tableSchemas is not null"); | 45 | + checkNotNull(tableSchemas, "tableSchemas cannot be null"); |
46 | this.name = name; | 46 | this.name = name; |
47 | this.version = version; | 47 | this.version = version; |
48 | this.tableSchemas = tableSchemas; | 48 | this.tableSchemas = tableSchemas; | ... | ... |
... | @@ -40,8 +40,8 @@ public final class TableSchema { | ... | @@ -40,8 +40,8 @@ public final class TableSchema { |
40 | * @param columnSchemas a map of ColumnSchema | 40 | * @param columnSchemas a map of ColumnSchema |
41 | */ | 41 | */ |
42 | public TableSchema(String name, Map<String, ColumnSchema> columnSchemas) { | 42 | public TableSchema(String name, Map<String, ColumnSchema> columnSchemas) { |
43 | - checkNotNull(name, "name is not null"); | 43 | + checkNotNull(name, "name cannot be null"); |
44 | - checkNotNull(columnSchemas, "columnSchemas is not null"); | 44 | + checkNotNull(columnSchemas, "columnSchemas cannot be null"); |
45 | this.name = name; | 45 | this.name = name; |
46 | this.columnSchemas = columnSchemas; | 46 | this.columnSchemas = columnSchemas; |
47 | } | 47 | } | ... | ... |
... | @@ -34,7 +34,7 @@ public final class AtomicColumnType implements ColumnType { | ... | @@ -34,7 +34,7 @@ public final class AtomicColumnType implements ColumnType { |
34 | * @param baseType BaseType entity | 34 | * @param baseType BaseType entity |
35 | */ | 35 | */ |
36 | public AtomicColumnType(BaseType baseType) { | 36 | public AtomicColumnType(BaseType baseType) { |
37 | - checkNotNull(baseType, "BaseType is not null"); | 37 | + checkNotNull(baseType, "BaseType cannot be null"); |
38 | this.baseType = baseType; | 38 | this.baseType = baseType; |
39 | this.min = 1; | 39 | this.min = 1; |
40 | this.max = 1; | 40 | this.max = 1; |
... | @@ -47,7 +47,7 @@ public final class AtomicColumnType implements ColumnType { | ... | @@ -47,7 +47,7 @@ public final class AtomicColumnType implements ColumnType { |
47 | * @param max max constraint | 47 | * @param max max constraint |
48 | */ | 48 | */ |
49 | public AtomicColumnType(BaseType baseType, int min, int max) { | 49 | public AtomicColumnType(BaseType baseType, int min, int max) { |
50 | - checkNotNull(baseType, "BaseType is not null"); | 50 | + checkNotNull(baseType, "BaseType cannot be null"); |
51 | this.baseType = baseType; | 51 | this.baseType = baseType; |
52 | this.min = min; | 52 | this.min = min; |
53 | this.max = max; | 53 | this.max = max; | ... | ... |
... | @@ -39,8 +39,8 @@ public final class KeyValuedColumnType implements ColumnType { | ... | @@ -39,8 +39,8 @@ public final class KeyValuedColumnType implements ColumnType { |
39 | */ | 39 | */ |
40 | public KeyValuedColumnType(BaseType keyType, BaseType valueType, int min, | 40 | public KeyValuedColumnType(BaseType keyType, BaseType valueType, int min, |
41 | int max) { | 41 | int max) { |
42 | - checkNotNull(keyType, "keyType is not null"); | 42 | + checkNotNull(keyType, "keyType cannot be null"); |
43 | - checkNotNull(valueType, "valueType is not null"); | 43 | + checkNotNull(valueType, "valueType cannot be null"); |
44 | this.keyType = keyType; | 44 | this.keyType = keyType; |
45 | this.valueType = valueType; | 45 | this.valueType = valueType; |
46 | this.min = min; | 46 | this.min = min; | ... | ... |
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | package org.onosproject.ovsdb.rfc.schema.type; | 16 | package org.onosproject.ovsdb.rfc.schema.type; |
17 | 17 | ||
18 | import static com.google.common.base.MoreObjects.toStringHelper; | 18 | import static com.google.common.base.MoreObjects.toStringHelper; |
19 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
19 | 20 | ||
20 | import java.util.Objects; | 21 | import java.util.Objects; |
21 | 22 | ||
... | @@ -62,6 +63,7 @@ public final class UuidBaseType implements BaseType { | ... | @@ -62,6 +63,7 @@ public final class UuidBaseType implements BaseType { |
62 | * @param refType refType constraint | 63 | * @param refType refType constraint |
63 | */ | 64 | */ |
64 | public UuidBaseType(String refTable, String refType) { | 65 | public UuidBaseType(String refTable, String refType) { |
66 | + checkNotNull(refType, "refType cannot be null"); | ||
65 | this.refTable = refTable; | 67 | this.refTable = refTable; |
66 | this.refType = refType; | 68 | this.refType = refType; |
67 | } | 69 | } | ... | ... |
... | @@ -33,7 +33,7 @@ public final class ObjectMapperUtil { | ... | @@ -33,7 +33,7 @@ public final class ObjectMapperUtil { |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Constructs a ObjectMapperUtil object. Utility classes should not have a | 35 | * Constructs a ObjectMapperUtil object. Utility classes should not have a |
36 | - * public or default constructor, otherwise it will compile failed. This | 36 | + * public or default constructor, otherwise IDE will compile unsuccessfully. This |
37 | * class should not be instantiated. | 37 | * class should not be instantiated. |
38 | */ | 38 | */ |
39 | private ObjectMapperUtil() { | 39 | private ObjectMapperUtil() { | ... | ... |
... | @@ -43,7 +43,7 @@ public final class TransValueUtil { | ... | @@ -43,7 +43,7 @@ public final class TransValueUtil { |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Constructs a TransValueUtil object. Utility classes should not have a | 45 | * Constructs a TransValueUtil object. Utility classes should not have a |
46 | - * public or default constructor, otherwise it will compile failed. | 46 | + * public or default constructor, otherwise IDE will compile unsuccessfully. |
47 | * This class should not be instantiated. | 47 | * This class should not be instantiated. |
48 | */ | 48 | */ |
49 | private TransValueUtil() { | 49 | private TransValueUtil() { |
... | @@ -81,7 +81,12 @@ public final class TransValueUtil { | ... | @@ -81,7 +81,12 @@ public final class TransValueUtil { |
81 | return null; | 81 | return null; |
82 | } | 82 | } |
83 | 83 | ||
84 | - // Convert AtomicColumnType JsonNode into OvsdbSet value | 84 | + /** |
85 | + * Convert AtomicColumnType JsonNode into OvsdbSet value. | ||
86 | + * @param json AtomicColumnType JsonNode | ||
87 | + * @param atoType AtomicColumnType entity | ||
88 | + * @return Object OvsdbSet or the value of JsonNode | ||
89 | + */ | ||
85 | private static Object getValueFromAtoType(JsonNode json, | 90 | private static Object getValueFromAtoType(JsonNode json, |
86 | AtomicColumnType atoType) { | 91 | AtomicColumnType atoType) { |
87 | BaseType baseType = atoType.baseType(); | 92 | BaseType baseType = atoType.baseType(); |
... | @@ -112,7 +117,12 @@ public final class TransValueUtil { | ... | @@ -112,7 +117,12 @@ public final class TransValueUtil { |
112 | } | 117 | } |
113 | } | 118 | } |
114 | 119 | ||
115 | - // Convert KeyValuedColumnType JsonNode into OvsdbMap value | 120 | + /** |
121 | + * Convert KeyValuedColumnType JsonNode into OvsdbMap value. | ||
122 | + * @param json KeyValuedColumnType JsonNode | ||
123 | + * @param kvType KeyValuedColumnType entity | ||
124 | + * @return Object OvsdbMap | ||
125 | + */ | ||
116 | private static Object getValueFromKvType(JsonNode json, | 126 | private static Object getValueFromKvType(JsonNode json, |
117 | KeyValuedColumnType kvType) { | 127 | KeyValuedColumnType kvType) { |
118 | if (json.isArray()) { | 128 | if (json.isArray()) { | ... | ... |
-
Please register or login to post a comment