我通过JAXB有一个简单的pojo注释类:
public class MyPojo
implements Serializable
{
private final static long serialVersionUID = 1234L;
@XmlElement(name = "Type", required = true, defaultValue = "none")
@NotNull
protected SeismicDataAcquisitionSystemType type;
@XmlElement(name = "IpAddress", required = true)
@NotNull
@Pattern(regexp = "((1?[0-9]?[0-9]|2[0-4]|[0-9]|25[0-5]).){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])")
protected String ipAddress;
@XmlElement(name = "SealServerTcpPort", defaultValue = "1477")
@NotNull
protected int sealServerTcpPort;
@XmlElement(name = "PamServerTcpPort", defaultValue = "1485")
@NotNull
protected int pamServerTcpPort;
/**
* Obtient la valeur de la propriété type.
*
* @return
* possible object is
* {@link SeismicDataAcquisitionSystemType } …Run Code Online (Sandbox Code Playgroud)