Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for selecting simple (default) or full type names #26

Merged
merged 1 commit into from
Apr 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ client start or on-demand)
- list of classes in those packages to exclude
- list of fields to exclude
- list of custom annotation classes to include in JSON
- whether to output simple or full type names
- the output file name
- Servlet offers built-in [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) support

## Use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"excludedFields": ["com.github.valdr.demo.model.Person#ignoredField"],
"customAnnotationClasses": ["org.hibernate.validator.constraints.CreditCardNumber"],
"corsAllowOriginPattern": "*",
"outputFullTypeName": false,
"outputFile": "${project.build.directory}/${project.build.finalName}/constraints.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public String parse() {
ClassConstraints classValidationRules = new AnnotatedClass(clazz, options.getExcludedFields(),
allRelevantAnnotationClasses).extractValidationRules();
if (classValidationRules.size() > 0) {
classNameToValidationRulesMap.put(clazz.getSimpleName(), classValidationRules);
String name = options.getOutputFullTypeName() ? clazz.getName() : clazz.getSimpleName();
classNameToValidationRulesMap.put(name, classValidationRules);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public final class Options {
*/
private String corsAllowOriginPattern = StringUtils.EMPTY;

/**
* Whether the output type name should be the simple name of a type (default) or the full type name (i.e., including
* the package name).
*
* Mandatory: no
* Use: CLI/Servlet
*/
private Boolean outputFullTypeName = Boolean.FALSE;

/**
* File to which the validation meta-model (JSON) is written. Missing folders are created automatically. If omitted
* the output is sent to system out.
Expand Down