001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package dev.metaschema.core.model; 007 008import edu.umd.cs.findbugs.annotations.NonNull; 009 010/** 011 * A base class for a choice group that is a member of a containing model. 012 * 013 * @param <PARENT> 014 * the Java type of the containing assembly definition 015 * @param <NAMED_MODEL> 016 * the Java type of child named model instances supported by this 017 * choice group 018 * @param <FIELD> 019 * the Java type of child field instances supported by this choice 020 * group 021 * @param <ASSEMBLY> 022 * the Java type of child assembly instances supported by this choice 023 * group 024 */ 025public abstract class AbstractChoiceGroupInstance< 026 PARENT extends IAssemblyDefinition, 027 NAMED_MODEL extends INamedModelInstanceGrouped, 028 FIELD extends IFieldInstanceGrouped, 029 ASSEMBLY extends IAssemblyInstanceGrouped> 030 extends AbstractInstance<PARENT> 031 implements IChoiceGroupInstance, IFeatureContainerModelGrouped<NAMED_MODEL, FIELD, ASSEMBLY> { 032 033 /** 034 * Construct a new choice group instance that is contained with the provided 035 * parent assembly definition container. 036 * 037 * @param parent 038 * the parent assembly definition container for this instance 039 */ 040 protected AbstractChoiceGroupInstance(@NonNull PARENT parent) { 041 super(parent); 042 } 043 044 /** 045 * Retrieve the Metaschema assembly definition on which this instance is 046 * declared. 047 * 048 * @return the parent Metaschema assembly definition 049 */ 050 @Override 051 public PARENT getContainingDefinition() { 052 return getParentContainer(); 053 } 054 055 @Override 056 public IModule getContainingModule() { 057 return getParentContainer().getContainingModule(); 058 } 059}