java - Subclassing a final class; or, a Degenerate Decorator -
I have several different representations of the same type of object; Let's call it one thing. "Thing" is a marker interface ThingFormat0, ThingFormat1, ThingFormat2 etc. All JavaBeans that implement Thing. (Because they are JavaBeans, a JSON marshaller automatically converts them and JSON automatically.) There are some members like ThingFormat1's name and id. ThingFormat 2 has URI links for other things. In ThingFormat3 ThingFormat1 are representations of those other things etc.
The JSON serializer knows how to automatically convert a URI (This works for any class, where you can convert the string () and constructor classname (string string) to
I have to be a thingform that behaves like a URI, but implements the marker interface thing.
Public class ThingFormat0 increases URI tools Thing {}
This does not work because the URI is a final square and it is not sub-class created can go.
The only way I can think of doing this is by making a decorator (a very thin decorator because it does not add any functionality to the URI). This is easy in some "duck-type" languages but there is more pain in Java, because I have to wrap a URI and implement all the URIs that are required. Is there an easier way?
Two simple ways I can think:
- , You can get representative delegation methods of any field automatically generated.
- Copy the source of the URI to a new category called Thinguri.
Comments
Post a Comment