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
8 package org.opendaylight.ovsdb.lib.notation;
10 import com.fasterxml.jackson.annotation.JsonIgnore;
11 import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
12 import org.opendaylight.ovsdb.lib.schema.TableSchema;
14 public class Column<E extends TableSchema<E>, D> {
16 private ColumnSchema<E, D> schema;
19 public Column(ColumnSchema<E, D> schema, D data) {
24 public <E extends TableSchema<E>, T> T getData(ColumnSchema<E, T> anotherSchema) {
25 return anotherSchema.validate(data);
32 public void setData(D data) {
36 public ColumnSchema<E, D> getSchema() {
40 public void setSchema(ColumnSchema<E, D> schema) {
45 public String toString() {
46 return "[" + schema.getName() + "=" + data + "]";
50 public int hashCode() {
53 result = prime * result + ((data == null) ? 0 : data.hashCode());
54 result = prime * result + ((schema == null) ? 0 : schema.hashCode());
59 public boolean equals(Object obj) {
66 if (getClass() != obj.getClass()) {
69 Column other = (Column) obj;
71 if (other.data != null) {
74 } else if (!data.equals(other.data)) {
78 if (other.schema != null) {
81 } else if (!schema.equals(other.schema)) {