public class ImportStatementDefinition extends
AbstractStatementSupport<String, ImportStatement, EffectiveStatement<String, ImportStatement>> {
private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator
- .builder(Rfc6020Mapping.IMPORT).add(Rfc6020Mapping.PREFIX, 1, 1).add(Rfc6020Mapping.REVISION_DATE, 0, 1)
- .add(SupportedExtensionsMapping.SEMANTIC_VERSION, 0, 1).build();
+ .builder(Rfc6020Mapping.IMPORT)
+ .addMandatory(Rfc6020Mapping.PREFIX)
+ .addOptional(Rfc6020Mapping.REVISION_DATE)
+ .addOptional(SupportedExtensionsMapping.SEMANTIC_VERSION)
+ .build();
public ImportStatementDefinition() {
super(Rfc6020Mapping.IMPORT);
}
@Override
- public void onPreLinkageDeclared(Mutable<String, ImportStatement, EffectiveStatement<String, ImportStatement>> stmt) {
+ public void onPreLinkageDeclared(final Mutable<String, ImportStatement, EffectiveStatement<String, ImportStatement>> stmt) {
final String moduleName = stmt.getStatementArgument();
final ModelActionBuilder importAction = stmt.newInferenceAction(SOURCE_PRE_LINKAGE);
final Prerequisite<StmtContext<?, ?, ?>> imported = importAction.requiresCtx(stmt,
});
}
- private static SemVer getRequestedImportVersion(Mutable<?, ?, ?> impStmt) {
+ private static SemVer getRequestedImportVersion(final Mutable<?, ?, ?> impStmt) {
SemVer requestedImportVersion = impStmt.getFromNamespace(SemanticVersionNamespace.class, impStmt);
if (requestedImportVersion == null) {
requestedImportVersion = Module.DEFAULT_SEMANTIC_VERSION;