Class DefaultBindingConfiguration
java.lang.Object
gov.nist.secauto.metaschema.databind.codegen.config.DefaultBindingConfiguration
- All Implemented Interfaces:
IBindingConfiguration
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddMetaschemaBindingConfiguration
(String moduleUri, DefaultBindingConfiguration.MetaschemaBindingConfiguration config) Set the binding configuration for the Module module located at the providedmoduleUri
.void
addModelBindingConfig
(String namespace, String packageName) Binds an XML namespace, which is normally associated with one or more Module, with a provided Java package name.getBindingConfigurationForDefinition
(IModelDefinition definition) Retrieve the binding configuration for the provideddefinition
.getClassName
(IModelDefinition definition) Get the Java class name for the provided field or assembly definition.getClassName
(IModule module) Get the Java class name for the provided Module module.Get the binding configuration for the provided Module.getMetaschemaBindingConfiguration
(String moduleUri) Get the binding configuration for the Module modulke located at the providedmoduleUri
.getPackageNameForModule
(IModule module) Generates a Java package name for the provided Module module.protected String
getPackageNameForNamespace
(String namespace) Based on the current binding configuration, generate a Java package name for the provided namespace.getQualifiedBaseClassName
(IModelDefinition definition) Get the Java class name of the base class to use for the class associated with the provided definition.getQualifiedSuperinterfaceClassNames
(IModelDefinition definition) Get the Java class names of the superinterfaces to use for the class associated with the provided definition.void
Load the binding configuration from the providedfile
.void
Load the binding configuration from the providedresource
.void
Load the binding configuration from the providedfile
.
-
Constructor Details
-
DefaultBindingConfiguration
public DefaultBindingConfiguration()
-
-
Method Details
-
getPackageNameForModule
Description copied from interface:IBindingConfiguration
Generates a Java package name for the provided Module module.- Specified by:
getPackageNameForModule
in interfaceIBindingConfiguration
- Parameters:
module
- the Module module to generate a package name for- Returns:
- a Java package name
-
getBindingConfigurationForDefinition
@Nullable public IDefinitionBindingConfiguration getBindingConfigurationForDefinition(@NonNull IModelDefinition definition) Retrieve the binding configuration for the provideddefinition
.- Parameters:
definition
- the definition to get the config for- Returns:
- the binding configuration or
null
if there is not configuration
-
getQualifiedBaseClassName
Description copied from interface:IBindingConfiguration
Get the Java class name of the base class to use for the class associated with the provided definition.- Specified by:
getQualifiedBaseClassName
in interfaceIBindingConfiguration
- Parameters:
definition
- a definition that may be built as a class- Returns:
- the name of the base class or
null
if no base class is to be used
-
getClassName
Description copied from interface:IBindingConfiguration
Get the Java class name for the provided field or assembly definition.- Specified by:
getClassName
in interfaceIBindingConfiguration
- Parameters:
definition
- the definition to generate the Java class name for- Returns:
- a Java class name
-
getClassName
Description copied from interface:IBindingConfiguration
Get the Java class name for the provided Module module.- Specified by:
getClassName
in interfaceIBindingConfiguration
- Parameters:
module
- the Module module to generate the Java class name for- Returns:
- a Java class name
-
getQualifiedSuperinterfaceClassNames
Description copied from interface:IBindingConfiguration
Get the Java class names of the superinterfaces to use for the class associated with the provided definition.- Specified by:
getQualifiedSuperinterfaceClassNames
in interfaceIBindingConfiguration
- Parameters:
definition
- a definition that may be built as a class- Returns:
- a list of superinterface class names
-
addModelBindingConfig
Binds an XML namespace, which is normally associated with one or more Module, with a provided Java package name.- Parameters:
namespace
- an XML namespace URIpackageName
- the package name to associate with the namespace- Throws:
IllegalStateException
- if the binding configuration is changing a previously changed namespace to package binding
-
getPackageNameForNamespace
Based on the current binding configuration, generate a Java package name for the provided namespace. If the namespace is already mapped, such as through the use ofaddModelBindingConfig(String, String)
, then the provided package name will be used. If the namespace is not mapped, then the namespace URI will be translated into a Java package name.- Parameters:
namespace
- the namespace to generate a Java package name for- Returns:
- a Java package name
-
getMetaschemaBindingConfiguration
protected DefaultBindingConfiguration.MetaschemaBindingConfiguration getMetaschemaBindingConfiguration(@NonNull IModule module) Get the binding configuration for the provided Module.- Parameters:
module
- the Module module- Returns:
- the configuration for the Module or
null
if there is no configuration
-
getMetaschemaBindingConfiguration
@Nullable protected DefaultBindingConfiguration.MetaschemaBindingConfiguration getMetaschemaBindingConfiguration(@NonNull String moduleUri) Get the binding configuration for the Module modulke located at the providedmoduleUri
.- Parameters:
moduleUri
- the location of the Module module- Returns:
- the configuration for the Module module or
null
if there is no configuration
-
addMetaschemaBindingConfiguration
public DefaultBindingConfiguration.MetaschemaBindingConfiguration addMetaschemaBindingConfiguration(@NonNull String moduleUri, @NonNull DefaultBindingConfiguration.MetaschemaBindingConfiguration config) Set the binding configuration for the Module module located at the providedmoduleUri
.- Parameters:
moduleUri
- the location of the Module moduleconfig
- the Module binding configuration- Returns:
- the old configuration for the Module module or
null
if there was no previous configuration
-
load
Load the binding configuration from the providedfile
.- Parameters:
file
- the configuration resource- Throws:
IOException
- if an error occurred while reading thefile
-
load
Load the binding configuration from the providedfile
.- Parameters:
file
- the configuration resource- Throws:
IOException
- if an error occurred while reading thefile
-
load
Load the binding configuration from the providedresource
.- Parameters:
resource
- the configuration resource- Throws:
IOException
- if an error occurred while reading theresource
-