我需要创建一个描述 Java 对象的 XML 模式定义 (XSD)。
我想知道当相关对象继承自带有类型参数的公共基类时如何执行此操作。
public abstract class Rule<T> { ... }
public abstract class TimeRule extends Rule<XTime> { ... }
public abstract class LocationRule extends Rule<Location> { ... }
public abstract class IntRule extends Rule<Integer> { ... }
....
(哪里XTime
和Location
是在别处定义的自定义类)
我将如何构建一个 XSD,以便我可以拥有代表每个子类的 XML 节点Rule<T>
- 而不是每个子类的 XSD 都重复它们的共同内容?
谢谢!