I believe what you might be looking for is an interface declaration like this:
public interface A<T extends A<T>>
{
public default String write()
{
new JsonSerializer<T>();
}
}
public class AX implements A<AX>
{
}
Using Self-bounding generics is sometimes useful, when you need to reference the current class as a generic argument. This is e.g. also done by the java Enum
class: abstract class Enum<E extends Enum<E>>
.