org.mitre.cybox.objects.WindowsThread Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stix Show documentation
Show all versions of stix Show documentation
The Java bindings for STIX v.1.2.0.2
/**
* Copyright (c) 2015, The MITRE Corporation. All rights reserved.
* See LICENSE for complete terms.
*/
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.07.01 at 03:30:29 PM EDT
//
package org.mitre.cybox.objects;
import java.io.StringReader;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
import org.mitre.cybox.common_2.CustomPropertiesType;
import org.mitre.cybox.common_2.DateTimeObjectPropertyType;
import org.mitre.cybox.common_2.HexBinaryObjectPropertyType;
import org.mitre.cybox.common_2.NonNegativeIntegerObjectPropertyType;
import org.mitre.cybox.common_2.ObjectPropertiesType;
import org.mitre.cybox.common_2.StringObjectPropertyType;
import org.mitre.cybox.common_2.UnsignedIntegerObjectPropertyType;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
import org.xml.sax.SAXException;
/**
* The Windows_ThreadObjectType is intended to characterize Windows process threads. See also: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684852(v=vs.85).aspx.
*
* Java class for WindowsThreadObjectType complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType name="WindowsThreadObjectType">
* <complexContent>
* <extension base="{http://cybox.mitre.org/common-2}ObjectPropertiesType">
* <sequence>
* <element name="Thread_ID" type="{http://cybox.mitre.org/common-2}NonNegativeIntegerObjectPropertyType" minOccurs="0"/>
* <element name="Handle" type="{http://cybox.mitre.org/objects#WinHandleObject-2}WindowsHandleObjectType" minOccurs="0"/>
* <element name="Running_Status" type="{http://cybox.mitre.org/objects#WinThreadObject-2}ThreadRunningStatusType" minOccurs="0"/>
* <element name="Context" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
* <element name="Priority" type="{http://cybox.mitre.org/common-2}UnsignedIntegerObjectPropertyType" minOccurs="0"/>
* <element name="Creation_Flags" type="{http://cybox.mitre.org/common-2}HexBinaryObjectPropertyType" minOccurs="0"/>
* <element name="Creation_Time" type="{http://cybox.mitre.org/common-2}DateTimeObjectPropertyType" minOccurs="0"/>
* <element name="Start_Address" type="{http://cybox.mitre.org/common-2}HexBinaryObjectPropertyType" minOccurs="0"/>
* <element name="Parameter_Address" type="{http://cybox.mitre.org/common-2}HexBinaryObjectPropertyType" minOccurs="0"/>
* <element name="Security_Attributes" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
* <element name="Stack_Size" type="{http://cybox.mitre.org/common-2}NonNegativeIntegerObjectPropertyType" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "WindowsThreadObjectType", namespace = "http://cybox.mitre.org/objects#WinThreadObject-2", propOrder = {
"threadID", "handle", "runningStatus", "context", "priority",
"creationFlags", "creationTime", "startAddress", "parameterAddress",
"securityAttributes", "stackSize" })
@XmlRootElement(name = "Windows_Thread", namespace = "http://cybox.mitre.org/objects#WinThreadObject-2")
public class WindowsThread extends ObjectPropertiesType implements Equals,
HashCode, ToString {
@XmlElement(name = "Thread_ID")
protected NonNegativeIntegerObjectPropertyType threadID;
@XmlElement(name = "Handle")
protected WindowsHandle handle;
@XmlElement(name = "Running_Status")
protected ThreadRunningStatusType runningStatus;
@XmlElement(name = "Context")
protected StringObjectPropertyType context;
@XmlElement(name = "Priority")
protected UnsignedIntegerObjectPropertyType priority;
@XmlElement(name = "Creation_Flags")
protected HexBinaryObjectPropertyType creationFlags;
@XmlElement(name = "Creation_Time")
protected DateTimeObjectPropertyType creationTime;
@XmlElement(name = "Start_Address")
protected HexBinaryObjectPropertyType startAddress;
@XmlElement(name = "Parameter_Address")
protected HexBinaryObjectPropertyType parameterAddress;
@XmlElement(name = "Security_Attributes")
protected StringObjectPropertyType securityAttributes;
@XmlElement(name = "Stack_Size")
protected NonNegativeIntegerObjectPropertyType stackSize;
/**
* Default no-arg constructor
*
*/
public WindowsThread() {
super();
}
/**
* Fully-initialising value constructor
*
*/
public WindowsThread(final CustomPropertiesType customProperties,
final QName objectReference,
final NonNegativeIntegerObjectPropertyType threadID,
final WindowsHandle handle,
final ThreadRunningStatusType runningStatus,
final StringObjectPropertyType context,
final UnsignedIntegerObjectPropertyType priority,
final HexBinaryObjectPropertyType creationFlags,
final DateTimeObjectPropertyType creationTime,
final HexBinaryObjectPropertyType startAddress,
final HexBinaryObjectPropertyType parameterAddress,
final StringObjectPropertyType securityAttributes,
final NonNegativeIntegerObjectPropertyType stackSize) {
super(customProperties, objectReference);
this.threadID = threadID;
this.handle = handle;
this.runningStatus = runningStatus;
this.context = context;
this.priority = priority;
this.creationFlags = creationFlags;
this.creationTime = creationTime;
this.startAddress = startAddress;
this.parameterAddress = parameterAddress;
this.securityAttributes = securityAttributes;
this.stackSize = stackSize;
}
/**
* Gets the value of the threadID property.
*
* @return
* possible object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public NonNegativeIntegerObjectPropertyType getThreadID() {
return threadID;
}
/**
* Sets the value of the threadID property.
*
* @param value
* allowed object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public void setThreadID(NonNegativeIntegerObjectPropertyType value) {
this.threadID = value;
}
/**
* Gets the value of the handle property.
*
* @return
* possible object is
* {@link WindowsHandle }
*
*/
public WindowsHandle getHandle() {
return handle;
}
/**
* Sets the value of the handle property.
*
* @param value
* allowed object is
* {@link WindowsHandle }
*
*/
public void setHandle(WindowsHandle value) {
this.handle = value;
}
/**
* Gets the value of the runningStatus property.
*
* @return
* possible object is
* {@link ThreadRunningStatusType }
*
*/
public ThreadRunningStatusType getRunningStatus() {
return runningStatus;
}
/**
* Sets the value of the runningStatus property.
*
* @param value
* allowed object is
* {@link ThreadRunningStatusType }
*
*/
public void setRunningStatus(ThreadRunningStatusType value) {
this.runningStatus = value;
}
/**
* Gets the value of the context property.
*
* @return
* possible object is
* {@link StringObjectPropertyType }
*
*/
public StringObjectPropertyType getContext() {
return context;
}
/**
* Sets the value of the context property.
*
* @param value
* allowed object is
* {@link StringObjectPropertyType }
*
*/
public void setContext(StringObjectPropertyType value) {
this.context = value;
}
/**
* Gets the value of the priority property.
*
* @return
* possible object is
* {@link UnsignedIntegerObjectPropertyType }
*
*/
public UnsignedIntegerObjectPropertyType getPriority() {
return priority;
}
/**
* Sets the value of the priority property.
*
* @param value
* allowed object is
* {@link UnsignedIntegerObjectPropertyType }
*
*/
public void setPriority(UnsignedIntegerObjectPropertyType value) {
this.priority = value;
}
/**
* Gets the value of the creationFlags property.
*
* @return
* possible object is
* {@link HexBinaryObjectPropertyType }
*
*/
public HexBinaryObjectPropertyType getCreationFlags() {
return creationFlags;
}
/**
* Sets the value of the creationFlags property.
*
* @param value
* allowed object is
* {@link HexBinaryObjectPropertyType }
*
*/
public void setCreationFlags(HexBinaryObjectPropertyType value) {
this.creationFlags = value;
}
/**
* Gets the value of the creationTime property.
*
* @return
* possible object is
* {@link DateTimeObjectPropertyType }
*
*/
public DateTimeObjectPropertyType getCreationTime() {
return creationTime;
}
/**
* Sets the value of the creationTime property.
*
* @param value
* allowed object is
* {@link DateTimeObjectPropertyType }
*
*/
public void setCreationTime(DateTimeObjectPropertyType value) {
this.creationTime = value;
}
/**
* Gets the value of the startAddress property.
*
* @return
* possible object is
* {@link HexBinaryObjectPropertyType }
*
*/
public HexBinaryObjectPropertyType getStartAddress() {
return startAddress;
}
/**
* Sets the value of the startAddress property.
*
* @param value
* allowed object is
* {@link HexBinaryObjectPropertyType }
*
*/
public void setStartAddress(HexBinaryObjectPropertyType value) {
this.startAddress = value;
}
/**
* Gets the value of the parameterAddress property.
*
* @return
* possible object is
* {@link HexBinaryObjectPropertyType }
*
*/
public HexBinaryObjectPropertyType getParameterAddress() {
return parameterAddress;
}
/**
* Sets the value of the parameterAddress property.
*
* @param value
* allowed object is
* {@link HexBinaryObjectPropertyType }
*
*/
public void setParameterAddress(HexBinaryObjectPropertyType value) {
this.parameterAddress = value;
}
/**
* Gets the value of the securityAttributes property.
*
* @return
* possible object is
* {@link StringObjectPropertyType }
*
*/
public StringObjectPropertyType getSecurityAttributes() {
return securityAttributes;
}
/**
* Sets the value of the securityAttributes property.
*
* @param value
* allowed object is
* {@link StringObjectPropertyType }
*
*/
public void setSecurityAttributes(StringObjectPropertyType value) {
this.securityAttributes = value;
}
/**
* Gets the value of the stackSize property.
*
* @return
* possible object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public NonNegativeIntegerObjectPropertyType getStackSize() {
return stackSize;
}
/**
* Sets the value of the stackSize property.
*
* @param value
* allowed object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public void setStackSize(NonNegativeIntegerObjectPropertyType value) {
this.stackSize = value;
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator,
Object object, EqualsStrategy strategy) {
if (!(object instanceof WindowsThread)) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(thisLocator, thatLocator, object, strategy)) {
return false;
}
final WindowsThread that = ((WindowsThread) object);
{
NonNegativeIntegerObjectPropertyType lhsThreadID;
lhsThreadID = this.getThreadID();
NonNegativeIntegerObjectPropertyType rhsThreadID;
rhsThreadID = that.getThreadID();
if (!strategy
.equals(LocatorUtils.property(thisLocator, "threadID",
lhsThreadID), LocatorUtils.property(thatLocator,
"threadID", rhsThreadID), lhsThreadID, rhsThreadID)) {
return false;
}
}
{
WindowsHandle lhsHandle;
lhsHandle = this.getHandle();
WindowsHandle rhsHandle;
rhsHandle = that.getHandle();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "handle", lhsHandle),
LocatorUtils.property(thatLocator, "handle", rhsHandle),
lhsHandle, rhsHandle)) {
return false;
}
}
{
ThreadRunningStatusType lhsRunningStatus;
lhsRunningStatus = this.getRunningStatus();
ThreadRunningStatusType rhsRunningStatus;
rhsRunningStatus = that.getRunningStatus();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"runningStatus", lhsRunningStatus), LocatorUtils.property(
thatLocator, "runningStatus", rhsRunningStatus),
lhsRunningStatus, rhsRunningStatus)) {
return false;
}
}
{
StringObjectPropertyType lhsContext;
lhsContext = this.getContext();
StringObjectPropertyType rhsContext;
rhsContext = that.getContext();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "context", lhsContext),
LocatorUtils.property(thatLocator, "context", rhsContext),
lhsContext, rhsContext)) {
return false;
}
}
{
UnsignedIntegerObjectPropertyType lhsPriority;
lhsPriority = this.getPriority();
UnsignedIntegerObjectPropertyType rhsPriority;
rhsPriority = that.getPriority();
if (!strategy
.equals(LocatorUtils.property(thisLocator, "priority",
lhsPriority), LocatorUtils.property(thatLocator,
"priority", rhsPriority), lhsPriority, rhsPriority)) {
return false;
}
}
{
HexBinaryObjectPropertyType lhsCreationFlags;
lhsCreationFlags = this.getCreationFlags();
HexBinaryObjectPropertyType rhsCreationFlags;
rhsCreationFlags = that.getCreationFlags();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"creationFlags", lhsCreationFlags), LocatorUtils.property(
thatLocator, "creationFlags", rhsCreationFlags),
lhsCreationFlags, rhsCreationFlags)) {
return false;
}
}
{
DateTimeObjectPropertyType lhsCreationTime;
lhsCreationTime = this.getCreationTime();
DateTimeObjectPropertyType rhsCreationTime;
rhsCreationTime = that.getCreationTime();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"creationTime", lhsCreationTime), LocatorUtils.property(
thatLocator, "creationTime", rhsCreationTime),
lhsCreationTime, rhsCreationTime)) {
return false;
}
}
{
HexBinaryObjectPropertyType lhsStartAddress;
lhsStartAddress = this.getStartAddress();
HexBinaryObjectPropertyType rhsStartAddress;
rhsStartAddress = that.getStartAddress();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"startAddress", lhsStartAddress), LocatorUtils.property(
thatLocator, "startAddress", rhsStartAddress),
lhsStartAddress, rhsStartAddress)) {
return false;
}
}
{
HexBinaryObjectPropertyType lhsParameterAddress;
lhsParameterAddress = this.getParameterAddress();
HexBinaryObjectPropertyType rhsParameterAddress;
rhsParameterAddress = that.getParameterAddress();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"parameterAddress", lhsParameterAddress), LocatorUtils
.property(thatLocator, "parameterAddress",
rhsParameterAddress), lhsParameterAddress,
rhsParameterAddress)) {
return false;
}
}
{
StringObjectPropertyType lhsSecurityAttributes;
lhsSecurityAttributes = this.getSecurityAttributes();
StringObjectPropertyType rhsSecurityAttributes;
rhsSecurityAttributes = that.getSecurityAttributes();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"securityAttributes", lhsSecurityAttributes), LocatorUtils
.property(thatLocator, "securityAttributes",
rhsSecurityAttributes), lhsSecurityAttributes,
rhsSecurityAttributes)) {
return false;
}
}
{
NonNegativeIntegerObjectPropertyType lhsStackSize;
lhsStackSize = this.getStackSize();
NonNegativeIntegerObjectPropertyType rhsStackSize;
rhsStackSize = that.getStackSize();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"stackSize", lhsStackSize), LocatorUtils.property(
thatLocator, "stackSize", rhsStackSize), lhsStackSize,
rhsStackSize)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE;
return equals(null, null, object, strategy);
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = super.hashCode(locator, strategy);
{
NonNegativeIntegerObjectPropertyType theThreadID;
theThreadID = this.getThreadID();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "threadID", theThreadID),
currentHashCode, theThreadID);
}
{
WindowsHandle theHandle;
theHandle = this.getHandle();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "handle", theHandle),
currentHashCode, theHandle);
}
{
ThreadRunningStatusType theRunningStatus;
theRunningStatus = this.getRunningStatus();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"runningStatus", theRunningStatus), currentHashCode,
theRunningStatus);
}
{
StringObjectPropertyType theContext;
theContext = this.getContext();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "context", theContext),
currentHashCode, theContext);
}
{
UnsignedIntegerObjectPropertyType thePriority;
thePriority = this.getPriority();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "priority", thePriority),
currentHashCode, thePriority);
}
{
HexBinaryObjectPropertyType theCreationFlags;
theCreationFlags = this.getCreationFlags();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"creationFlags", theCreationFlags), currentHashCode,
theCreationFlags);
}
{
DateTimeObjectPropertyType theCreationTime;
theCreationTime = this.getCreationTime();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"creationTime", theCreationTime), currentHashCode,
theCreationTime);
}
{
HexBinaryObjectPropertyType theStartAddress;
theStartAddress = this.getStartAddress();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"startAddress", theStartAddress), currentHashCode,
theStartAddress);
}
{
HexBinaryObjectPropertyType theParameterAddress;
theParameterAddress = this.getParameterAddress();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"parameterAddress", theParameterAddress), currentHashCode,
theParameterAddress);
}
{
StringObjectPropertyType theSecurityAttributes;
theSecurityAttributes = this.getSecurityAttributes();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"securityAttributes", theSecurityAttributes),
currentHashCode, theSecurityAttributes);
}
{
NonNegativeIntegerObjectPropertyType theStackSize;
theStackSize = this.getStackSize();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "stackSize", theStackSize),
currentHashCode, theStackSize);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public WindowsThread withThreadID(NonNegativeIntegerObjectPropertyType value) {
setThreadID(value);
return this;
}
public WindowsThread withHandle(WindowsHandle value) {
setHandle(value);
return this;
}
public WindowsThread withRunningStatus(ThreadRunningStatusType value) {
setRunningStatus(value);
return this;
}
public WindowsThread withContext(StringObjectPropertyType value) {
setContext(value);
return this;
}
public WindowsThread withPriority(UnsignedIntegerObjectPropertyType value) {
setPriority(value);
return this;
}
public WindowsThread withCreationFlags(HexBinaryObjectPropertyType value) {
setCreationFlags(value);
return this;
}
public WindowsThread withCreationTime(DateTimeObjectPropertyType value) {
setCreationTime(value);
return this;
}
public WindowsThread withStartAddress(HexBinaryObjectPropertyType value) {
setStartAddress(value);
return this;
}
public WindowsThread withParameterAddress(HexBinaryObjectPropertyType value) {
setParameterAddress(value);
return this;
}
public WindowsThread withSecurityAttributes(StringObjectPropertyType value) {
setSecurityAttributes(value);
return this;
}
public WindowsThread withStackSize(
NonNegativeIntegerObjectPropertyType value) {
setStackSize(value);
return this;
}
@Override
public WindowsThread withCustomProperties(CustomPropertiesType value) {
setCustomProperties(value);
return this;
}
@Override
public WindowsThread withObjectReference(QName value) {
setObjectReference(value);
return this;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer,
ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator,
StringBuilder buffer, ToStringStrategy strategy) {
super.appendFields(locator, buffer, strategy);
{
NonNegativeIntegerObjectPropertyType theThreadID;
theThreadID = this.getThreadID();
strategy.appendField(locator, this, "threadID", buffer, theThreadID);
}
{
WindowsHandle theHandle;
theHandle = this.getHandle();
strategy.appendField(locator, this, "handle", buffer, theHandle);
}
{
ThreadRunningStatusType theRunningStatus;
theRunningStatus = this.getRunningStatus();
strategy.appendField(locator, this, "runningStatus", buffer,
theRunningStatus);
}
{
StringObjectPropertyType theContext;
theContext = this.getContext();
strategy.appendField(locator, this, "context", buffer, theContext);
}
{
UnsignedIntegerObjectPropertyType thePriority;
thePriority = this.getPriority();
strategy.appendField(locator, this, "priority", buffer, thePriority);
}
{
HexBinaryObjectPropertyType theCreationFlags;
theCreationFlags = this.getCreationFlags();
strategy.appendField(locator, this, "creationFlags", buffer,
theCreationFlags);
}
{
DateTimeObjectPropertyType theCreationTime;
theCreationTime = this.getCreationTime();
strategy.appendField(locator, this, "creationTime", buffer,
theCreationTime);
}
{
HexBinaryObjectPropertyType theStartAddress;
theStartAddress = this.getStartAddress();
strategy.appendField(locator, this, "startAddress", buffer,
theStartAddress);
}
{
HexBinaryObjectPropertyType theParameterAddress;
theParameterAddress = this.getParameterAddress();
strategy.appendField(locator, this, "parameterAddress", buffer,
theParameterAddress);
}
{
StringObjectPropertyType theSecurityAttributes;
theSecurityAttributes = this.getSecurityAttributes();
strategy.appendField(locator, this, "securityAttributes", buffer,
theSecurityAttributes);
}
{
NonNegativeIntegerObjectPropertyType theStackSize;
theStackSize = this.getStackSize();
strategy.appendField(locator, this, "stackSize", buffer,
theStackSize);
}
return buffer;
}
/**
* Returns A Document representation of this instance that is not formatted.
*
* @return The Document representation for this instance.
*/
public org.w3c.dom.Document toDocument() {
return toDocument(false);
}
/**
* Returns A Document representation for this instance.
*
* @param prettyPrint
* True for pretty print, otherwise false
*
* @return The Document representation for this instance.
*/
public org.w3c.dom.Document toDocument(boolean prettyPrint) {
return DocumentUtilities.toDocument(toJAXBElement(), prettyPrint);
}
/**
* Returns JAXBElement for this instance.
*
* @return The JAXBElement for this instance.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public JAXBElement> toJAXBElement() {
QName qualifiedName = STIXSchema.getQualifiedName(this);
return new JAXBElement(qualifiedName, WindowsThread.class, this);
}
/**
* Returns String representation of this instance that is not formatted.
*
* @return The String containing the XML mark-up.
*/
public String toXMLString() {
return toXMLString(false);
}
/**
* Returns XML String for JAXB Document Object Model object.
*
* @param prettyPrint
* True for pretty print, otherwise false
*
* @return The String containing the XML mark-up.
*/
public String toXMLString(boolean prettyPrint) {
return DocumentUtilities.toXMLString(toDocument(), prettyPrint);
}
/**
* Creates WindowsThread instance for XML String
*
* @param text
* XML String for the document
* @return The WindowsThread instance for the passed XML String
*/
public static WindowsThread fromXMLString(String text) {
JAXBContext jaxbContext;
try {
jaxbContext = JAXBContext.newInstance(WindowsThread.class
.getPackage().getName());
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setSchema(STIXSchema.getInstance().getSchema());
unmarshaller.setEventHandler(new ValidationEventHandler());
StreamSource streamSource = new StreamSource(new StringReader(text));
return (WindowsThread) unmarshaller.unmarshal(streamSource);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
/**
* Validates the XML representation of this WindowsThread instance
* Returning true indicating a successful validation, false if not.
*
* @return boolean True If it validates against the schema
* @throws SAXException
* If the a validation ErrorHandler has not been set, and
* validation throws a SAXException
*/
public boolean validate() throws SAXException {
return STIXSchema.getInstance().validate(toXMLString());
}
}