001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package dev.metaschema.core.model; 007 008import java.util.Collection; 009 010import edu.umd.cs.findbugs.annotations.NonNull; 011import edu.umd.cs.findbugs.annotations.Nullable; 012 013/** 014 * Represents a model container with grouped instances. 015 * <p> 016 * Grouped instances are part of a choice group and share a common group-as 017 * name. This interface narrows the return types of {@link IContainerModel} 018 * methods to grouped instance types. 019 */ 020public interface IContainerModelGrouped extends IContainerModel { 021 022 @Override 023 IAssemblyDefinition getOwningDefinition(); 024 025 @Override 026 @NonNull 027 default Collection<? extends INamedModelInstanceGrouped> getModelInstances() { 028 return getNamedModelInstances(); 029 } 030 031 /** 032 * Get all named model instances within the container. 033 * 034 * @return the named model instances in this container 035 */ 036 @Override 037 @NonNull 038 Collection<? extends INamedModelInstanceGrouped> getNamedModelInstances(); 039 040 /** 041 * Get the model instance contained within the model with the associated use 042 * name. 043 * 044 * @param name 045 * the effective name of the model instance 046 * @return the matching model instance, or {@code null} if no match was found 047 * @see INamedModelInstance#getEffectiveName() 048 */ 049 @Override 050 @Nullable 051 INamedModelInstanceGrouped getNamedModelInstanceByName(Integer name); 052 053 /** 054 * Get all field instances within the container. 055 * 056 * @return the field instances in this container 057 */ 058 @Override 059 @NonNull 060 Collection<? extends IFieldInstanceGrouped> getFieldInstances(); 061 062 /** 063 * Get the field instance contained within the model with the associated use 064 * name. 065 * 066 * @param name 067 * the use name of the field instance 068 * @return the matching field instance, or {@code null} if no match was found 069 * @see IFieldInstance#getUseName() 070 */ 071 @Override 072 @Nullable 073 IFieldInstanceGrouped getFieldInstanceByName(Integer name); 074 075 /** 076 * Get all assembly instances within the container. 077 * 078 * @return the assembly instances in this container 079 */ 080 @Override 081 @NonNull 082 Collection<? extends IAssemblyInstanceGrouped> getAssemblyInstances(); 083 084 /** 085 * Get the assembly instance contained within the model with the associated use 086 * name. 087 * 088 * @param name 089 * the effective name of the assembly instance 090 * @return the matching assembly instance, or {@code null} if no match was found 091 * @see INamedModelInstance#getEffectiveName() 092 */ 093 @Override 094 @Nullable 095 IAssemblyInstanceGrouped getAssemblyInstanceByName(Integer name); 096}