2 * Copyright © 2019 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
9 * Copyright © 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
11 * This program and the accompanying materials are made available under the
12 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
13 * and is available at http://www.eclipse.org/legal/epl-v10.html
15 package org.opendaylight.ovsdb.lib.schema.typed;
17 import java.lang.reflect.Method;
18 import org.eclipse.jdt.annotation.NonNull;
19 import org.opendaylight.ovsdb.lib.notation.Column;
20 import org.opendaylight.ovsdb.lib.notation.Row;
21 import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
22 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
24 final class GetData<T> extends MethodDispatch.StrictColumnPrototype<T> {
25 private static final class Invoker<T> extends MethodDispatch.ColumnInvoker<T> {
26 Invoker(final @NonNull GenericTableSchema tableSchema,
27 final @NonNull ColumnSchema<GenericTableSchema, T> columnSchema) {
28 super(tableSchema, columnSchema);
32 Object invokeMethod(final Object proxy, final Object[] args) {
37 Object invokeRowMethod(final Row<GenericTableSchema> row, final Object proxy, final Object[] args) {
38 final Column<GenericTableSchema, T> column = row.getColumn(columnSchema());
39 return column == null ? null : column.getData();
43 GetData(final Method method, final String tableName, final String columnName) {
44 super(method, tableName, columnName);
48 Invoker<T> bindToImpl(final GenericTableSchema tableSchema,
49 final ColumnSchema<GenericTableSchema, T> columnSchema) {
50 return new Invoker<>(tableSchema, columnSchema);