2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.mdsal.binding.java.api.generator;
10 import static java.util.Objects.requireNonNull;
12 import java.util.List;
13 import org.opendaylight.mdsal.binding.model.api.AccessModifier;
14 import org.opendaylight.mdsal.binding.model.api.AnnotationType;
15 import org.opendaylight.mdsal.binding.model.api.GeneratedProperty;
16 import org.opendaylight.mdsal.binding.model.api.MethodSignature;
17 import org.opendaylight.mdsal.binding.model.api.MethodSignature.ValueMechanics;
18 import org.opendaylight.mdsal.binding.model.api.Type;
19 import org.opendaylight.mdsal.binding.model.api.TypeMemberComment;
21 final class BuilderGeneratedProperty implements GeneratedProperty {
22 private final MethodSignature getter;
23 private final String name;
25 BuilderGeneratedProperty(final String name, final MethodSignature getter) {
26 this.name = requireNonNull(name);
27 this.getter = requireNonNull(getter);
31 public String getName() {
36 public Type getReturnType() {
37 return getter.getReturnType();
40 ValueMechanics getMechanics() {
41 return getter.getMechanics();
44 String getGetterName() {
45 return getter.getName();
49 public int hashCode() {
50 return name.hashCode();
54 public boolean equals(final Object obj) {
58 if (!(obj instanceof BuilderGeneratedProperty)) {
61 final BuilderGeneratedProperty other = (BuilderGeneratedProperty) obj;
62 return name.equals(other.name) && getter.equals(other.getter);
66 public TypeMemberComment getComment() {
71 public List<AnnotationType> getAnnotations() {
76 public AccessModifier getAccessModifier() {
81 public boolean isStatic() {
86 public boolean isFinal() {
91 public String getValue() {
96 public boolean isReadOnly() {
100 private static UnsupportedOperationException uoe() {
101 return new UnsupportedOperationException("Method not supported");