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

@Required #57

Open
ghost opened this issue Oct 17, 2013 · 2 comments
Open

@Required #57

ghost opened this issue Oct 17, 2013 · 2 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Oct 17, 2013

It would be nice if OWNER supports the possibility to declare an option as required, maybe with an annotation called @required. If no value was assigned to such an option, OWNER should throw an exception and gives the possibility to write a nice overview of options that are required to a given OutputStream.

What do you think?

@lviggiano
Copy link
Collaborator

👍

Partially a duplicate of #30

Thanks for your suggestions. This enhancement is planned for next versions.

With version 1.5.0 you can register a listener for the required property and throw a RollbackOperationException or a RollbackBatchException when the new value is null or invalid. Please have a look at event support feature.

In the next release I want to implement an annotation based validation like the one you are suggesting, but it needs to be carefully designed.

@lviggiano
Copy link
Collaborator

I will add a method like addRollbackListener() which allows the user to intercept when a listner threw a rollback, so that the user may decide to do some logging or whatever.

A flexible and customizable validation mechanism is already planned, which should allow more control over properties values, than just check if a value is not specified.

Instead, I am not planning to show a "help" on an outputstream to specify which properties are mandatory or not, since this can be seen in the source code, or should be documented in the user manual or documentation of the application. Another option is to use "javap" utility to see the signature of the object ("javap -v className") which in Java7 it displays the class signature with the annotation; I agree that the output is not very readable.

BTW I will consider this "documentation" feature, maybe for a utility class. It would be nice to replace the default save mechanism allowing the user to include javadocs and annotations in the generated properties files, so that when the user modifies the configuration file, he can see some explanation text for every setting.

@ghost ghost assigned lviggiano Oct 18, 2013
@ghost ghost mentioned this issue Mar 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant