forked from metaschema-framework/metaschema-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for custom constraint messages in all but allowed value…
…s constraints (see metaschema-framework/metaschema#43). Resolves metaschema-framework#215.
- Loading branch information
1 parent
c183670
commit c782f23
Showing
43 changed files
with
755 additions
and
396 deletions.
There are no files selected for viewing
Submodule metaschema
updated
2 files
+0 −2 | schema/metaschema/metaschema-module-metaschema.xml | |
+0 −1 | schema/xml/metaschema.xsd |
52 changes: 52 additions & 0 deletions
52
...ecauto/metaschema/core/model/constraint/AbstractConfigurableMessageConstraintBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* SPDX-FileCopyrightText: none | ||
* SPDX-License-Identifier: CC0-1.0 | ||
*/ | ||
|
||
package gov.nist.secauto.metaschema.core.model.constraint; | ||
|
||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import edu.umd.cs.findbugs.annotations.Nullable; | ||
|
||
/** | ||
* Provides builder methods for the core data elements of an | ||
* {@link IConstraint}. | ||
* <p> | ||
* The base class of all constraint builders. | ||
* | ||
* @param <T> | ||
* the Java type of the implementing builder | ||
* @param <R> | ||
* the Java type of the resulting built object | ||
* @since 2.0.0 | ||
*/ | ||
public abstract class AbstractConfigurableMessageConstraintBuilder< | ||
T extends AbstractConfigurableMessageConstraintBuilder<T, R>, | ||
R extends IConfigurableMessageConstraint> | ||
extends AbstractConstraintBuilder<T, R> { | ||
private String message; | ||
|
||
/** | ||
* A message to emit when the constraint is violated. Allows embedded Metapath | ||
* expressions using the syntax {@code \{ metapath \}}. | ||
* | ||
* @param message | ||
* the message if defined or {@code null} otherwise | ||
* @return this builder | ||
*/ | ||
@NonNull | ||
public T message(@NonNull String message) { | ||
this.message = message; | ||
return getThis(); | ||
} | ||
|
||
/** | ||
* Get the constraint message provided to the builder. | ||
* | ||
* @return the message or {@code null} if no message is set | ||
*/ | ||
@Nullable | ||
protected String getMessage() { | ||
return message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.