I’m not overly familiar with Java, in C# i can declare a custom attribute for a property as follows:
Create attribute type-
public class MyCustomAttribute: Attribute
{
public string SomeProperty { get; set; }
}
Then decorate anything (class, method, property, …) with the attribute:
[MyCustomAttribute(SomeProperty = "foo bar")]
public class Foo
{
}
This can then be read using reflection at runtime.
Searching shows me ‘custom attributes’ are something used in unit testing. Is there anything the same or similar in java?