Class DefaultAssemblyClassBinding
- java.lang.Object
-
- gov.nist.secauto.metaschema.databind.model.DefaultAssemblyClassBinding
-
- All Implemented Interfaces:
IConstrained
,IModelConstrained
,gov.nist.secauto.metaschema.core.model.constraint.impl.IFeatureModelConstrained
,gov.nist.secauto.metaschema.core.model.constraint.impl.IFeatureValueConstrained
,IValueConstrained
,IAssembly
,IAssemblyDefinition
,IContainer
,IDefinition
,IFeatureFlagContainer<IBoundFlagInstance>
,IFeatureModelContainer<IBoundNamedModelInstance,IBoundNamedModelInstance,IBoundFieldInstance,IBoundAssemblyInstance,IChoiceInstance>
,IFlagContainer
,IModelContainer
,IModelElement
,INamedModelElement
,IAssemblyClassBinding
,IClassBinding
public class DefaultAssemblyClassBinding extends Object implements IAssemblyClassBinding
-
-
Field Summary
-
Fields inherited from interface gov.nist.secauto.metaschema.core.model.IDefinition
DEFAULT_DEFINITION_MODEL_SCOPE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultAssemblyClassBinding(Class<?> clazz, IBindingContext bindingContext)
Construct a newIClassBinding
for a Java bean annotated with theBoundAssembly
annotation.
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IAssembly
getModelType
-
Methods inherited from interface gov.nist.secauto.metaschema.databind.model.IAssemblyClassBinding
getOwningDefinition, getProperties
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IAssemblyDefinition
getRootJsonName, isSimple
-
Methods inherited from interface gov.nist.secauto.metaschema.databind.model.IClassBinding
callAfterDeserialize, callBeforeDeserialize, copyBoundObject, getBindingContext, getBoundClass, newInstance
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IDefinition
getModuleScope, toCoordinates
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IFeatureFlagContainer
getFlagInstanceByName, getFlagInstances, getJsonKeyFlagInstance
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.constraint.impl.IFeatureModelConstrained
addConstraint, addConstraint, addConstraint, getHasCardinalityConstraints, getIndexConstraints, getUniqueConstraints
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IFeatureModelContainer
getAssemblyInstanceByName, getAssemblyInstances, getChoiceInstances, getFieldInstanceByName, getFieldInstances, getModelInstanceByName, getModelInstances, getNamedModelInstances
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.constraint.impl.IFeatureValueConstrained
addConstraint, addConstraint, addConstraint, addConstraint, getAllowedValuesConstraints, getConstraints, getExpectConstraints, getIndexHasKeyConstraints, getMatchesConstraints
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IFlagContainer
hasJsonKey
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.IModelElement
getContainingModule
-
Methods inherited from interface gov.nist.secauto.metaschema.core.model.INamedModelElement
getEffectiveDescription, getEffectiveFormalName, getEffectiveName, getJsonName, getPropertyValues, getUseName, hasProperty, hasPropertyValue
-
-
-
-
Constructor Detail
-
DefaultAssemblyClassBinding
protected DefaultAssemblyClassBinding(@NonNull Class<?> clazz, @NonNull IBindingContext bindingContext)
Construct a newIClassBinding
for a Java bean annotated with theBoundAssembly
annotation.- Parameters:
clazz
- the Java bean classbindingContext
- the class binding context for which this class is participating
-
-
Method Detail
-
createInstance
@NonNull public static DefaultAssemblyClassBinding createInstance(@NonNull Class<?> clazz, @NonNull IBindingContext bindingContext)
Create a newIClassBinding
for a Java bean annotated with theBoundAssembly
annotation.- Parameters:
clazz
- the Java bean classbindingContext
- information about how Java classes are bound to Module definitions- Returns:
- the Module assembly binding for the class
-
getFlagContainer
public IFlagContainerSupport<IBoundFlagInstance> getFlagContainer()
- Specified by:
getFlagContainer
in interfaceIFeatureFlagContainer<IBoundFlagInstance>
-
getModelContainer
public IModelContainerSupport<IBoundNamedModelInstance,IBoundNamedModelInstance,IBoundFieldInstance,IBoundAssemblyInstance,IChoiceInstance> getModelContainer()
- Specified by:
getModelContainer
in interfaceIFeatureModelContainer<IBoundNamedModelInstance,IBoundNamedModelInstance,IBoundFieldInstance,IBoundAssemblyInstance,IChoiceInstance>
-
getFormalName
public String getFormalName()
- Specified by:
getFormalName
in interfaceINamedModelElement
-
getDescription
public MarkupLine getDescription()
- Specified by:
getDescription
in interfaceINamedModelElement
-
getRemarks
@Nullable public MarkupMultiline getRemarks()
- Specified by:
getRemarks
in interfaceIModelElement
-
getName
public String getName()
- Specified by:
getName
in interfaceINamedModelElement
-
isInline
public boolean isInline()
- Specified by:
isInline
in interfaceIDefinition
-
getInlineInstance
public IBoundAssemblyInstance getInlineInstance()
- Specified by:
getInlineInstance
in interfaceIAssemblyDefinition
- Specified by:
getInlineInstance
in interfaceIDefinition
- Specified by:
getInlineInstance
in interfaceIFlagContainer
-
isRoot
public boolean isRoot()
- Specified by:
isRoot
in interfaceIAssemblyDefinition
-
getRootName
public String getRootName()
- Specified by:
getRootName
in interfaceIAssemblyDefinition
-
getRootXmlQName
public QName getRootXmlQName()
- Specified by:
getRootXmlQName
in interfaceIAssemblyDefinition
-
getConstraintSupport
public IModelConstrained getConstraintSupport()
- Specified by:
getConstraintSupport
in interfacegov.nist.secauto.metaschema.core.model.constraint.impl.IFeatureModelConstrained
- Specified by:
getConstraintSupport
in interfacegov.nist.secauto.metaschema.core.model.constraint.impl.IFeatureValueConstrained
-
copyBoundObjectInternal
protected void copyBoundObjectInternal(@NonNull Object fromInstance, @NonNull Object toInstance) throws BindingException
- Throws:
BindingException
-
getModuleClass
protected Class<? extends IModule> getModuleClass()
-
getBoundClass
public Class<?> getBoundClass()
Description copied from interface:IClassBinding
The class this binding is for.- Specified by:
getBoundClass
in interfaceIClassBinding
- Returns:
- the bound class
-
getBindingContext
public IBindingContext getBindingContext()
- Specified by:
getBindingContext
in interfaceIClassBinding
-
getUseName
public String getUseName()
- Specified by:
getUseName
in interfaceINamedModelElement
-
toCoordinates
public String toCoordinates()
- Specified by:
toCoordinates
in interfaceIDefinition
- Specified by:
toCoordinates
in interfaceIModelElement
-
getModuleScope
@NonNull public ModuleScopeEnum getModuleScope()
- Specified by:
getModuleScope
in interfaceIDefinition
-
initModule
@NonNull protected IModule initModule()
-
getContainingModule
public IModule getContainingModule()
- Specified by:
getContainingModule
in interfaceIModelElement
-
newInstance
@NonNull public <CLASS> CLASS newInstance() throws BindingException
Gets a new instance of the bound class.- Specified by:
newInstance
in interfaceIClassBinding
- Type Parameters:
CLASS
- the type of the bound class- Returns:
- a Java object for the class
- Throws:
BindingException
- if the instance cannot be created due to a binding error
-
callBeforeDeserialize
public void callBeforeDeserialize(Object targetObject, Object parentObject) throws BindingException
Calls the method named "beforeDeserialize" on each class in the object's hierarchy if the method exists on the class.These methods can be used to set the initial state of the target bound object before data is read and applied during deserialization.
- Specified by:
callBeforeDeserialize
in interfaceIClassBinding
- Parameters:
targetObject
- the data object target to call the method(s) onparentObject
- the object target's parent object, which is used as the method argument- Throws:
BindingException
- if an error occurs while calling the method
-
callAfterDeserialize
public void callAfterDeserialize(Object targetObject, Object parentObject) throws BindingException
Calls the method named "afterDeserialize" on each class in the object's hierarchy if the method exists.These methods can be used to modify the state of the target bound object after data is read and applied during deserialization.
- Specified by:
callAfterDeserialize
in interfaceIClassBinding
- Parameters:
targetObject
- the data object target to call the method(s) onparentObject
- the object target's parent object, which is used as the method argument- Throws:
BindingException
- if an error occurs while calling the method
-
copyBoundObject
public Object copyBoundObject(Object item, Object parentInstance) throws BindingException
Description copied from interface:IClassBinding
Create a deep copy of the provided bound object.- Specified by:
copyBoundObject
in interfaceIClassBinding
- Parameters:
item
- the bound object to copyparentInstance
- the new object's parent instance ornull
- Returns:
- the copy
- Throws:
BindingException
- if an error occurred copying content between java instances
-
-