2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 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============================================
21 package org.onap.aai.champcore.model;
23 import org.onap.aai.champcore.model.fluent.index.CreateRelationshipIndexable;
24 import org.onap.aai.champcore.model.fluent.index.impl.CreateRelationshipIndexableImpl;
26 public final class ChampRelationshipIndex {
28 private final String name;
29 private final String type;
30 private final ChampField field;
32 public static CreateRelationshipIndexable create() {
33 return new CreateRelationshipIndexableImpl();
36 private ChampRelationshipIndex() {
37 throw new RuntimeException("Cannot call ChampRelationshipIndex() constructor");
40 private ChampRelationshipIndex(Builder builder) {
41 this.name = builder.name;
42 this.type = builder.type;
43 this.field = builder.field;
46 public String getName() { return name; }
47 public String getType() { return type; }
48 public ChampField getField() { return field; }
50 public static class Builder {
51 private final String name;
52 private final String type;
53 private final ChampField field;
55 public Builder(String name, String type, ChampField field) {
61 public ChampRelationshipIndex build() {
62 return new ChampRelationshipIndex(this);
67 public String toString() {
68 return "{name: " + getName()
69 + ", type: " + getType()
70 + ", field: " + getField() + "}";
74 public boolean equals(Object object) {
75 if (this == object) return true;
77 if (object instanceof ChampRelationshipIndex) {
78 final ChampRelationshipIndex relationshipIndex = (ChampRelationshipIndex) object;
80 if (getName().equals(relationshipIndex.getName()) &&
81 getField().getName().equals(relationshipIndex.getField().getName())) return true;