2 * Copyright © 2016-2017 European Support Limited.
4 package org.openecomp.core.tools.model;
6 import com.datastax.driver.core.ColumnDefinitions.Definition;
7 import com.datastax.driver.core.DataType;
9 import java.util.Arrays;
11 public class ColumnDefinition {
13 private String keyspace;
18 public ColumnDefinition() {
21 public ColumnDefinition(String keyspace, String table, String name, DataType type) {
22 this.keyspace = keyspace;
25 this.type = type.getName().toString();
28 public ColumnDefinition(Definition definition) {
29 this(definition.getKeyspace(), definition.getTable(), definition.getName(), definition.getType());
33 * The name of the keyspace this column is part of.
35 * @return the name of the keyspace this column is part of.
37 public String getKeyspace() {
42 * Returns the name of the table this column is part of.
44 * @return the name of the table this column is part of.
46 public String getTable() {
51 * Returns the name of the column.
53 * @return the name of the column.
55 public String getName() {
60 * Returns the type of the column.
62 * @return the type of the column.
64 public String getType() {
69 public final int hashCode() {
70 return Arrays.hashCode(new Object[]{keyspace, table, name, type});
74 public final boolean equals(Object o) {
75 if (!(o instanceof ColumnDefinition))
78 ColumnDefinition other = (ColumnDefinition) o;
79 return keyspace.equals(other.keyspace)
80 && table.equals(other.table)
81 && name.equals(other.name)
82 && type.equals(other.type);