2 * Copyright (c) 2022 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.dom.codec.impl;
10 import static java.util.Objects.requireNonNull;
12 import java.lang.reflect.Method;
13 import org.eclipse.jdt.annotation.NonNull;
16 * Information about a property. It includes its getter method and, optionally, its nonnull method.
18 abstract sealed class PropertyInfo {
20 * This property has only a getFoo() method.
22 static final class Getter extends PropertyInfo {
23 Getter(final Method getterMethod) {
29 * This property has a getFoo() method and a non-default nonnullFoo() method.
31 static final class GetterAndNonnull extends PropertyInfo {
32 private final @NonNull Method nonnullMethod;
34 GetterAndNonnull(final Method getterMethod, final Method nonnullMethod) {
36 this.nonnullMethod = requireNonNull(nonnullMethod);
39 @NonNull Method nonnullMethod() {
44 private final @NonNull Method getterMethod;
46 private PropertyInfo(final Method getterMethod) {
47 this.getterMethod = requireNonNull(getterMethod);
50 final @NonNull Method getterMethod() {