I have multiple classes A, B and C.
All should have a private UUID uuid;
.
But creating a class D that A, B and C can extend, is no option.
Can I create an annotation in Java, that adds this attribute to the class that I write the annotation to?
not possible because in this project I can not change the core and there are many linear inheritances and java does not support tree like inheritances:
public class D{
private UUID uuid;
}
public class A extends D{}
public class B extends D{}
public class C extends D{}
So I hope something like the following is possible:
? the interface for creating the annotation D ?
@D
public class A{}
@D
public class B{}
@D
public class C{}
How can I achieve this with an annotation?
What must the interface look like?