Reputation: 2149
Are there any commonly usable annotations available? Similar to commons-lang?
If not, have you seen any effective use of annontations (not built-in annotations) as part of any open source application development.
I remember Mifos was using it for Transaction.
Mohan
Upvotes: 2
Views: 1560
Reputation: 16518
there really needs to be a set of common annotationsin the core jre which are used in similar ways in multiple frameworks.
for example @Transactional @Nullable
Upvotes: 0
Reputation: 116502
JAXB defines annotations (javax.xml.bind.annotation) that are reused to some degree -- although they are named to indicate they only related to XML serialization, most of metadata has to do with annotating properties to serialize, so they can be used for serializing to other data formats (such as JSON) too. Jackson JSON processor supports them, along its own 'native' annotations, since there are no really standardizes non-data-format specific annotations (AFAIK).
Upvotes: 0
Reputation: 30644
Check out my Bean annotations
http://code.google.com/p/javadude/wiki/Annotations
Things like
@Bean(
cloneable=true,
defineSimpleEqualsAndHashCode=true,
properties={
@Property(name="name", bound=true),
@Property(name="age", type=int.class, bound=true),
@Property(name="friend", type=Person.class, kind=PropertyKind.LIST)
},
observers={
@Observer(type=FeverListener.class)
}
)
public class Person extends PersonGen { }
The annotation processor generates the PersonGen superclass.
Note that I'm currently working on a major change to them and the API is changing (I'll still leave the current version available, but the 3.x.x version stream will be breaking)
I'm trying to get the new version done in the next couple of weeks.
Upvotes: 2
Reputation: 29367
Only non-standard annotations I've used more than once outside my testing project have been WicketStuff Annotations which are very useful in their own context.
Another interesting annotation set which is also the basis for JSR-305 is FindBugs' annotations which also may prove useful in the future - we'll see how that goes.
Upvotes: 4
Reputation: 64737
i think Hibernate Validator has really good and reusable annotations for any kind of validation. it is based on a the reference implementation for JSR 303: Bean Validation.
Upvotes: 4