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
8 package org.opendaylight.ovsdb.lib.schema.typed;
10 import static java.util.Objects.requireNonNull;
13 import org.opendaylight.ovsdb.lib.message.TableUpdates;
14 import org.opendaylight.ovsdb.lib.notation.Row;
15 import org.opendaylight.ovsdb.lib.notation.UUID;
16 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
17 import org.opendaylight.ovsdb.lib.schema.ForwardingDatabaseSchema;
18 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
20 final class TypedDatabaseSchemaImpl extends ForwardingDatabaseSchema implements TypedDatabaseSchema {
21 private final DatabaseSchema delegate;
23 TypedDatabaseSchemaImpl(final DatabaseSchema delegate) {
24 this.delegate = requireNonNull(delegate);
28 protected DatabaseSchema delegate() {
33 public TypedDatabaseSchema withInternallyGeneratedColumns() {
34 final DatabaseSchema newDelegate = delegate.withInternallyGeneratedColumns();
35 return newDelegate == delegate ? this : new TypedDatabaseSchemaImpl(newDelegate);
39 public GenericTableSchema getTableSchema(final Class<?> klazz) {
40 return TyperUtils.getTableSchema(this, klazz);
44 public <T> T getTypedRowWrapper(final Class<T> klazz) {
45 return TyperUtils.getTypedRowWrapper(this, klazz);
49 public <T> T getTypedRowWrapper(final Class<T> klazz, final Row<GenericTableSchema> row) {
50 return TyperUtils.getTypedRowWrapper(this, klazz, row);
54 public <T> Map<UUID, T> extractRowsOld(final Class<T> klazz, final TableUpdates updates) {
55 return TyperUtils.extractRowsOld(klazz, updates, this);
59 public <T> Map<UUID, T> extractRowsUpdated(final Class<T> klazz, final TableUpdates updates) {
60 return TyperUtils.extractRowsUpdated(klazz, updates, this);
64 public <T> Map<UUID, T> extractRowsRemoved(final Class<T> klazz, final TableUpdates updates) {
65 return TyperUtils.extractRowsRemoved(klazz, updates, this);