001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package dev.metaschema.databind.model.info;
007
008import dev.metaschema.databind.model.IBoundInstanceModel;
009import edu.umd.cs.findbugs.annotations.NonNull;
010
011/**
012 * An abstract base class for managing collection information for model
013 * instances.
014 * <p>
015 * This class provides common functionality for handling collections of items
016 * during serialization and deserialization.
017 *
018 * @param <ITEM>
019 *          the Java type of items in the collection
020 */
021public abstract class AbstractModelInstanceCollectionInfo<ITEM>
022    implements IModelInstanceCollectionInfo<ITEM> {
023
024  @NonNull
025  private final IBoundInstanceModel<ITEM> instance;
026
027  /**
028   * Construct a new collection info for the provided model instance.
029   *
030   * @param instance
031   *          the model instance this collection info is for
032   */
033  public AbstractModelInstanceCollectionInfo(
034      @NonNull IBoundInstanceModel<ITEM> instance) {
035    this.instance = instance;
036  }
037
038  @Override
039  public IBoundInstanceModel<ITEM> getInstance() {
040    return instance;
041  }
042}