2 * Copyright (c) 2014, 2015 EBay Software Foundation and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.ovsdb.lib.notation;
12 import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
13 import org.opendaylight.ovsdb.lib.schema.TableSchema;
15 import com.fasterxml.jackson.annotation.JsonIgnore;
18 public class Column<E extends TableSchema<E>, D> {
20 private ColumnSchema<E, D> schema;
23 public Column(ColumnSchema<E, D> schema, D data) {
28 public <E extends TableSchema<E>, T> T getData(ColumnSchema<E, T> schema) {
29 return schema.validate(data);
36 public void setData(D data) {
40 public ColumnSchema<E, D> getSchema() {
44 public void setSchema(ColumnSchema<E, D> schema) {
49 public String toString() {
50 return "[" + schema.getName() + "=" + data + "]";
54 public int hashCode() {
57 result = prime * result + ((data == null) ? 0 : data.hashCode());
58 result = prime * result + ((schema == null) ? 0 : schema.hashCode());
63 public boolean equals(Object obj) {
70 if (getClass() != obj.getClass()) {
73 Column other = (Column) obj;
75 if (other.data != null) {
78 } else if (!data.equals(other.data)) {
82 if (other.schema != null) {
85 } else if (!schema.equals(other.schema)) {