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;
20 final class BuilderGeneratedProperty implements GeneratedProperty {
21 private final MethodSignature getter;
22 private final String name;
24 BuilderGeneratedProperty(final String name, final MethodSignature getter) {
25 this.name = requireNonNull(name);
26 this.getter = requireNonNull(getter);
30 public String getName() {
35 public Type getReturnType() {
36 return getter.getReturnType();
39 ValueMechanics getMechanics() {
40 return getter.getMechanics();
43 String getGetterName() {
44 return getter.getName();
48 public int hashCode() {
49 return name.hashCode();
53 public boolean equals(final Object obj) {
57 if (!(obj instanceof BuilderGeneratedProperty)) {
60 final BuilderGeneratedProperty other = (BuilderGeneratedProperty) obj;
61 return name.equals(other.name) && getter.equals(other.getter);
65 public String getComment() {
70 public List<AnnotationType> getAnnotations() {
75 public AccessModifier getAccessModifier() {
80 public boolean isStatic() {
85 public boolean isFinal() {
90 public Type getDefiningType() {
95 public String getValue() {
100 public boolean isReadOnly() {
104 private static UnsupportedOperationException uoe() {
105 return new UnsupportedOperationException("Method not supported");