2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T European Support Limited. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.core.tools.model;
22 import com.datastax.driver.core.ColumnDefinitions.Definition;
23 import com.datastax.driver.core.DataType;
25 import java.util.Arrays;
27 public class ColumnDefinition {
29 private String keyspace;
34 public ColumnDefinition() {
37 public ColumnDefinition(String keyspace, String table, String name, DataType type) {
38 this.keyspace = keyspace;
41 this.type = type.getName().toString();
44 public ColumnDefinition(Definition definition) {
45 this(definition.getKeyspace(), definition.getTable(), definition.getName(), definition.getType());
49 * The name of the keyspace this column is part of.
51 * @return the name of the keyspace this column is part of.
53 public String getKeyspace() {
58 * Returns the name of the table this column is part of.
60 * @return the name of the table this column is part of.
62 public String getTable() {
67 * Returns the name of the column.
69 * @return the name of the column.
71 public String getName() {
76 * Returns the type of the column.
78 * @return the type of the column.
80 public String getType() {
85 public final int hashCode() {
86 return Arrays.hashCode(new Object[]{keyspace, table, name, type});
90 public final boolean equals(Object o) {
91 if (!(o instanceof ColumnDefinition))
94 ColumnDefinition other = (ColumnDefinition) o;
95 return keyspace.equals(other.keyspace)
96 && table.equals(other.table)
97 && name.equals(other.name)
98 && type.equals(other.type);