下面列出了怎么用javax.xml.bind.annotation.XmlAttribute的API类实例代码及写法,或者点击链接到github查看源代码。
public Void visitAttributePropertyInfo(
MAttributePropertyInfo<NType, NClass> info) {
JAnnotationUse annotation = this.annotatable
.annotate(XmlAttribute.class);
final String name = info.getAttributeName().getLocalPart();
final String namespace = info.getAttributeName().getNamespaceURI();
annotation.param("name", name);
// generate namespace property?
if (!namespace.equals("")) { // assume attributeFormDefault ==
// unqualified
annotation.param("namespace", namespace);
}
// TODO
// if(info.isRequired()) {
// xaw.required(true);
// }
return null;
}
/**
* Returns an unique identifier, or {@code null} if none.
* This method is invoked automatically by JAXB and should never be invoked explicitly.
*/
@XmlAttribute // Defined in "gco" as unqualified attribute.
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
private String getUUID() {
/*
* IdentifierMapAdapter will take care of converting UUID to String,
* or to return a previously stored String if it was an unparsable UUID.
*/
return isNullOrEmpty(identifiers) ? null : getIdentifierMap().get(IdentifierSpace.UUID);
}
@XmlAttribute
public String getHref() {
return href;
}
@XmlAttribute(name = "state-code")
public String getStateCode() {
return stateCode;
}
@Override
@XmlAttribute
public String getHref() {
return href;
}
@XmlAttribute(name = "attribute-code")
public String getCode() {
return code;
}
@XmlAttribute
public String getGroup() {
return group;
}
@XmlAttribute
public String getRepository() {
return repository;
}
@XmlAttribute
public String getFrom() {
return this.from;
}
/**
* (non-Javadoc)
*
* @see Identifiable#getDescription()
*/
@Override
@XmlAttribute()
public String getDescription() {
return itemDescription;
}
@XmlAttribute
public int getId()
{
return id;
}
@XmlAttribute
public String getTime() {
return this.time;
}
@XmlAttribute(name = "attribute-id")
public long getAttributeId() {
initAttribute();
return attribute.getAttributeId();
}
@Override
@XmlAttribute
public String getTitle() {
return title;
}
@XmlAttribute(name = "methods")
public void setMethods(String methods) {
String[] split = methods.split(" ");
methodList.addAll(Arrays.asList(split));
}
@XmlAttribute(name = "uri-template")
public void setUriTemplate(String uriTemplate) {
this.uriTemplate = uriTemplate;
}
@XmlAttribute
public void setVersion(String version) {
this.version = version;
}
@XmlAttribute(name = "changeStatus")
public JApiChangeStatus getChangeStatus() {
return changeStatus;
}
/**
* @return the enabled
*/
@XmlAttribute
public Boolean getEnabled() {
return enabled;
}
@XmlAttribute
public String getParent() {
return parent;
}
@XmlAttribute(name = "sale-price")
public BigDecimal getSalePrice() {
return salePrice;
}
@XmlAttribute(name = "phase", required = true)
public String getPhaseName() {
return phaseName;
}
@XmlAttribute(name = "target-id")
public void setTargetId(final long targetId) {
this.targetId = targetId;
}
@XmlAttribute(name="referencedProperty")
public String getAttributeName() {
return attributeName;
}
@XmlAttribute (namespace = "urn:xyzzy")
public String getAttrExplicitString() {
return attrExplicitString;
}
@XmlAttribute(name = "changeStatus")
public JApiChangeStatus getChangeStatus() {
return changeStatus;
}
@XmlAttribute
public String getTo() {
return this.to;
}
@XmlAttribute(name = "weight")
public void setWeight(float weight) {
this.weight = weight;
}
@XmlAttribute(name = "ha-contributor-name")
public String getHaContributorName() {
return haContributorName;
}