2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 Amdocs
7 * ===================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 package org.onap.aai.champcore.model;
24 import org.onap.aai.champcore.model.fluent.index.CreateRelationshipIndexable;
25 import org.onap.aai.champcore.model.fluent.index.impl.CreateRelationshipIndexableImpl;
27 public final class ChampRelationshipIndex {
29 private final String name;
30 private final String type;
31 private final ChampField field;
33 public static CreateRelationshipIndexable create() {
34 return new CreateRelationshipIndexableImpl();
37 private ChampRelationshipIndex() {
38 throw new RuntimeException("Cannot call ChampRelationshipIndex() constructor");
41 private ChampRelationshipIndex(Builder builder) {
42 this.name = builder.name;
43 this.type = builder.type;
44 this.field = builder.field;
47 public String getName() { return name; }
48 public String getType() { return type; }
49 public ChampField getField() { return field; }
51 public static class Builder {
52 private final String name;
53 private final String type;
54 private final ChampField field;
56 public Builder(String name, String type, ChampField field) {
62 public ChampRelationshipIndex build() {
63 return new ChampRelationshipIndex(this);
68 public String toString() {
69 return "{name: " + getName()
70 + ", type: " + getType()
71 + ", field: " + getField() + "}";
75 public boolean equals(Object object) {
76 if (this == object) return true;
78 if (object instanceof ChampRelationshipIndex) {
79 final ChampRelationshipIndex relationshipIndex = (ChampRelationshipIndex) object;
81 if (getName().equals(relationshipIndex.getName()) &&
82 getField().getName().equals(relationshipIndex.getField().getName())) return true;