Skip to content

Commit

Permalink
Expose a more consistent API for model grouping.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire committed Jun 24, 2024
1 parent cf9ddfe commit db54ea5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import gov.nist.secauto.metaschema.core.model.IDefinition;
import gov.nist.secauto.metaschema.core.model.IModelDefinition;
import gov.nist.secauto.metaschema.core.model.INamedInstance;
import gov.nist.secauto.metaschema.core.model.INamedModelInstance;

/**
* A mixin interface used to identify that the implementation is a
Expand All @@ -44,7 +44,7 @@
* @param <I>
* the type of the instance that could be created from the definition
*/
interface IFeatureOrhpanedDefinitionModelNodeItem<D extends IModelDefinition, I extends INamedInstance>
interface IFeatureOrhpanedDefinitionModelNodeItem<D extends IModelDefinition, I extends INamedModelInstance>
extends IModelNodeItem<D, I>, IFeatureOrhpanedDefinitionNodeItem<D, I> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
package gov.nist.secauto.metaschema.core.metapath.item.node;

import gov.nist.secauto.metaschema.core.model.IModelDefinition;
import gov.nist.secauto.metaschema.core.model.INamedInstance;
import gov.nist.secauto.metaschema.core.model.INamedModelInstance;

public interface IModelNodeItem<D extends IModelDefinition, I extends INamedInstance>
public interface IModelNodeItem<D extends IModelDefinition, I extends INamedModelInstance>
extends IDefinitionNodeItem<D, I> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;

public interface IGroupable extends IInstanceAbsolute {
public interface IGroupable extends IInstance {

int DEFAULT_GROUP_AS_MIN_OCCURS = 0;
int DEFAULT_GROUP_AS_MAX_OCCURS = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* This marker interface is used to identify a field or assembly instance that
* is a member of an assembly's model.
*/
public interface IModelInstance extends IInstance {
public interface IModelInstance extends IGroupable {
@Override
IContainerModel getParentContainer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@

package gov.nist.secauto.metaschema.core.model;

public interface IModelInstanceAbsolute extends IModelInstance, IGroupable {
public interface IModelInstanceAbsolute extends IModelInstance, IInstanceAbsolute {
// no additional methods
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,15 @@ default IFlagInstance getJsonKey() {
? null
: ObjectUtils.requireNonNull(getDefinition().getFlagInstanceByName(getContainingModule().toFlagQName(name)));
}

@Override
default int getMinOccurs() {
return getParentContainer().getMinOccurs();
}

@Override
default int getMaxOccurs() {
return getParentContainer().getMaxOccurs();
}

}

0 comments on commit db54ea5

Please sign in to comment.