
org.purl.sword.base.BasicIntegerContentElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dspace-sword Show documentation
Show all versions of dspace-sword Show documentation
DSpace SWORD Deposit Service Provider Extension
The newest version!
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.purl.sword.base;
import java.util.Properties;
import nu.xom.Element;
/**
* @author Neil Taylor ([email protected])
*/
public class BasicIntegerContentElement extends BasicContentElement {
private int content = 0;
private boolean isSet;
public BasicIntegerContentElement(String prefix, String localName, String namespaceUri) {
super(prefix, localName, namespaceUri);
}
public BasicIntegerContentElement(XmlName name) {
super(name);
}
public int getContent() {
return content;
}
public void setContent(int value) {
isSet = true;
content = value;
}
public boolean isSet() {
return isSet;
}
protected void marshallContent(Element element) {
element.appendChild(Integer.toString(content));
}
protected void unmarshallContent(Element element)
throws UnmarshallException {
setContent(unmarshallInteger(element));
}
protected SwordValidationInfo validateContent(Properties validationContext) {
SwordValidationInfo result = null;
if (!isSet) {
result = new SwordValidationInfo(xmlName,
SwordValidationInfo.MISSING_CONTENT,
SwordValidationInfoType.WARNING);
}
return result;
}
protected String getContentAsString() {
return Integer.toString(content);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy