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 com.fasterxml.jackson.annotation.JsonIgnore;
13 import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
14 import org.opendaylight.ovsdb.lib.schema.TableSchema;
17 public class Column<E extends TableSchema<E>, D> {
19 private ColumnSchema<E, D> schema;
22 public Column(ColumnSchema<E, D> schema, D data) {
27 public <E extends TableSchema<E>, T> T getData(ColumnSchema<E, T> schema) {
28 return schema.validate(data);
35 public void setData(D data) {
39 public ColumnSchema<E, D> getSchema() {
43 public void setSchema(ColumnSchema<E, D> schema) {
48 public String toString() {
49 return "[" + schema.getName() + "=" + data + "]";
53 public int hashCode() {
56 result = prime * result + ((data == null) ? 0 : data.hashCode());
57 result = prime * result + ((schema == null) ? 0 : schema.hashCode());
62 public boolean equals(Object obj) {
69 if (getClass() != obj.getClass()) {
72 Column other = (Column) obj;
74 if (other.data != null) {
77 } else if (!data.equals(other.data)) {
81 if (other.schema != null) {
84 } else if (!schema.equals(other.schema)) {