Skip to content

Commit

Permalink
interim commit
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire committed May 5, 2024
1 parent 7496fad commit 01d0f4f
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected AbstractFlagInstance(@NonNull PARENT parent) {
}

@Override
public final DEFINITION getDefinition() {
public DEFINITION getDefinition() {
// this should always be not null
return ObjectUtils.asType(ObjectUtils.requireNonNull(
getContainingModule()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@
import nl.talsmasoftware.lazy4j.Lazy;

public abstract class AbstractInstanceModelGrouped<BINDING>
extends AbstractBinding<BINDING>
implements INamedModelInstanceGrouped,
IFeatureValueless {
@NonNull
private final BINDING binding;
@NonNull
private final IChoiceGroupInstance parent;
@NonNull
private final Map<IAttributable.Key, Set<String>> properties;
Expand All @@ -61,7 +62,7 @@ protected AbstractInstanceModelGrouped(
int position,
@NonNull IChoiceGroupInstance parent,
@NonNull List<Property> properties) {
super(binding);
this.binding = binding;
this.parent = parent;
this.properties = ModelSupport.parseProperties(properties);
this.boundNodeItem = ObjectUtils.notNull(
Expand Down Expand Up @@ -95,4 +96,9 @@ public IAssemblyDefinition getContainingDefinition() {
public IModule getContainingModule() {
return getContainingDefinition().getContainingModule();
}

@NonNull
protected BINDING getBinding() {
return binding;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
package gov.nist.secauto.metaschema.databind.model.metaschema.impl;

import gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem;
import gov.nist.secauto.metaschema.core.model.IAssemblyDefinition;
import gov.nist.secauto.metaschema.core.model.IAttributable;
import gov.nist.secauto.metaschema.core.model.IContainerModelAbsolute;
import gov.nist.secauto.metaschema.core.model.IModule;
import gov.nist.secauto.metaschema.core.model.INamedModelInstanceAbsolute;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
import gov.nist.secauto.metaschema.databind.model.IBoundInstanceModelGroupedAssembly;
Expand All @@ -55,10 +57,13 @@
public abstract class AbstractInstanceModelNamed<
BINDING,
PARENT extends IContainerModelAbsolute>
extends AbstractInstanceModel<BINDING, PARENT>
implements INamedModelInstanceAbsolute,
IFeatureInstanceModelGroupAs {
@NonNull
private final BINDING binding;
@NonNull
private final PARENT parent;
@NonNull
private final Map<IAttributable.Key, Set<String>> properties;
@NonNull
private final IGroupAs groupAs;
Expand Down Expand Up @@ -90,15 +95,36 @@ protected AbstractInstanceModelNamed(
@NonNull PARENT parent,
@NonNull List<Property> properties,
@Nullable GroupAs groupAs) {
super(binding, parent);
this.binding = binding;
this.parent = parent;
this.properties = ModelSupport.parseProperties(properties);
this.groupAs = ModelSupport.groupAs(groupAs, parent.getOwningDefinition().getXmlNamespace());
this.groupAs = ModelSupport.groupAs(groupAs, parent.getOwningDefinition().getContainingModule());
this.boundNodeItem = ObjectUtils.notNull(
Lazy.lazy(() -> (IAssemblyNodeItem) ObjectUtils.notNull(getContainingDefinition().getNodeItem())
.getModelItemsByName(bindingInstance.getXmlQName())
.get(position)));
}

@NonNull
protected BINDING getBinding() {
return binding;
}

@Override
public PARENT getParentContainer() {
return parent;
}

@Override
public IAssemblyDefinition getContainingDefinition() {
return getParentContainer().getOwningDefinition();
}

@Override
public IModule getContainingModule() {
return getContainingDefinition().getContainingModule();
}

@Override
public Map<IAttributable.Key, Set<String>> getProperties() {
return properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine;
import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline;
import gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem;
import gov.nist.secauto.metaschema.core.model.AbstractInlineFlagDefinition;
import gov.nist.secauto.metaschema.core.model.IAttributable;
import gov.nist.secauto.metaschema.core.model.IFeatureDefinitionInstanceInlined;
import gov.nist.secauto.metaschema.core.model.IFeatureValueless;
import gov.nist.secauto.metaschema.core.model.IFlagDefinition;
import gov.nist.secauto.metaschema.core.model.IFlagInstance;
import gov.nist.secauto.metaschema.core.model.IModelDefinition;
Expand All @@ -51,9 +52,13 @@
import nl.talsmasoftware.lazy4j.Lazy;

public class InstanceFlagInline
extends AbstractInstance<InlineDefineFlag>
implements IFlagInstance, IFlagDefinition,
IFeatureDefinitionInstanceInlined<IFlagDefinition, IFlagInstance> {
extends AbstractInlineFlagDefinition<
IModelDefinition,
IFlagDefinition,
IFlagInstance>
implements IFeatureValueless {
@NonNull
private final InlineDefineFlag binding;
@NonNull
private final Map<IAttributable.Key, Set<String>> properties;
@NonNull
Expand All @@ -70,7 +75,8 @@ public InstanceFlagInline(
@NonNull IBoundInstanceModelGroupedAssembly bindingInstance,
int position,
@NonNull IModelDefinition parent) {
super(binding, parent);
super(parent);
this.binding = binding;
this.properties = ModelSupport.parseProperties(ObjectUtils.requireNonNull(getBinding().getProps()));
this.javaTypeAdapter = ModelSupport.dataType(getBinding().getAsType());
this.defaultValue = ModelSupport.defaultValue(getBinding().getDefault(), this.javaTypeAdapter);
Expand All @@ -88,6 +94,11 @@ public InstanceFlagInline(
.get(position)));
}

@NonNull
protected InlineDefineFlag getBinding() {
return binding;
}

@SuppressWarnings("null")
@Override
public IValueConstrained getConstraintSupport() {
Expand Down Expand Up @@ -115,16 +126,6 @@ public Object getDefaultValue() {
return defaultValue;
}

@Override
public IFlagInstance getInlineInstance() {
return this;
}

@Override
public IFlagDefinition getDefinition() {
return this;
}

@Override
public String getName() {
return ObjectUtils.notNull(getBinding().getName());
Expand Down
Loading

0 comments on commit 01d0f4f

Please sign in to comment.