All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mitre.cybox.objects.WindowsNetworkShare Maven / Gradle / Ivy

The newest version!
/**
 * 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:19:53 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.XmlAttribute;
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.NonNegativeIntegerObjectPropertyType;
import org.mitre.cybox.common_2.ObjectPropertiesType;
import org.mitre.cybox.common_2.StringObjectPropertyType;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
import org.xml.sax.SAXException;

/**
 * The WindowsNetworkShareObjectType type is intended to characterize Windows network shares.
 * 
 * 

Java class for WindowsNetworkShareObjectType complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType name="WindowsNetworkShareObjectType">
 *   <complexContent>
 *     <extension base="{http://cybox.mitre.org/common-2}ObjectPropertiesType">
 *       <sequence>
 *         <element name="Current_Uses" type="{http://cybox.mitre.org/common-2}NonNegativeIntegerObjectPropertyType" minOccurs="0"/>
 *         <element name="Local_Path" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="Max_Uses" type="{http://cybox.mitre.org/common-2}NonNegativeIntegerObjectPropertyType" minOccurs="0"/>
 *         <element name="Netname" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="Type" type="{http://cybox.mitre.org/objects#WinNetworkShareObject-2}SharedResourceType" minOccurs="0"/>
 *       </sequence>
 *       <attGroup ref="{http://cybox.mitre.org/objects#WinNetworkShareObject-2}AccessPermissionsGroup"/>
 *     </extension>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "WindowsNetworkShareObjectType", namespace = "http://cybox.mitre.org/objects#WinNetworkShareObject-2", propOrder = { "currentUses", "localPath", "maxUses", "netname", "type" }) @XmlRootElement(name = "Windows_Network_Share", namespace = "http://cybox.mitre.org/objects#WinNetworkShareObject-2") public class WindowsNetworkShare extends ObjectPropertiesType implements Equals, HashCode, ToString { @XmlElement(name = "Current_Uses") protected NonNegativeIntegerObjectPropertyType currentUses; @XmlElement(name = "Local_Path") protected StringObjectPropertyType localPath; @XmlElement(name = "Max_Uses") protected NonNegativeIntegerObjectPropertyType maxUses; @XmlElement(name = "Netname") protected StringObjectPropertyType netname; @XmlElement(name = "Type") protected SharedResourceType type; @XmlAttribute(name = "ACCESS_READ") protected Boolean accessread; @XmlAttribute(name = "ACCESS_WRITE") protected Boolean accesswrite; @XmlAttribute(name = "ACCESS_CREATE") protected Boolean accesscreate; @XmlAttribute(name = "ACCESS_EXEC") protected Boolean accessexec; @XmlAttribute(name = "ACCESS_DELETE") protected Boolean accessdelete; @XmlAttribute(name = "ACCESS_ATRIB") protected Boolean accessatrib; @XmlAttribute(name = "ACCESS_PERM") protected Boolean accessperm; @XmlAttribute(name = "ACCESS_ALL") protected Boolean accessall; /** * Default no-arg constructor * */ public WindowsNetworkShare() { super(); } /** * Fully-initialising value constructor * */ public WindowsNetworkShare(final CustomPropertiesType customProperties, final QName objectReference, final NonNegativeIntegerObjectPropertyType currentUses, final StringObjectPropertyType localPath, final NonNegativeIntegerObjectPropertyType maxUses, final StringObjectPropertyType netname, final SharedResourceType type, final Boolean accessread, final Boolean accesswrite, final Boolean accesscreate, final Boolean accessexec, final Boolean accessdelete, final Boolean accessatrib, final Boolean accessperm, final Boolean accessall) { super(customProperties, objectReference); this.currentUses = currentUses; this.localPath = localPath; this.maxUses = maxUses; this.netname = netname; this.type = type; this.accessread = accessread; this.accesswrite = accesswrite; this.accesscreate = accesscreate; this.accessexec = accessexec; this.accessdelete = accessdelete; this.accessatrib = accessatrib; this.accessperm = accessperm; this.accessall = accessall; } /** * Gets the value of the currentUses property. * * @return * possible object is * {@link NonNegativeIntegerObjectPropertyType } * */ public NonNegativeIntegerObjectPropertyType getCurrentUses() { return currentUses; } /** * Sets the value of the currentUses property. * * @param value * allowed object is * {@link NonNegativeIntegerObjectPropertyType } * */ public void setCurrentUses(NonNegativeIntegerObjectPropertyType value) { this.currentUses = value; } /** * Gets the value of the localPath property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getLocalPath() { return localPath; } /** * Sets the value of the localPath property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setLocalPath(StringObjectPropertyType value) { this.localPath = value; } /** * Gets the value of the maxUses property. * * @return * possible object is * {@link NonNegativeIntegerObjectPropertyType } * */ public NonNegativeIntegerObjectPropertyType getMaxUses() { return maxUses; } /** * Sets the value of the maxUses property. * * @param value * allowed object is * {@link NonNegativeIntegerObjectPropertyType } * */ public void setMaxUses(NonNegativeIntegerObjectPropertyType value) { this.maxUses = value; } /** * Gets the value of the netname property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getNetname() { return netname; } /** * Sets the value of the netname property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setNetname(StringObjectPropertyType value) { this.netname = value; } /** * Gets the value of the type property. * * @return * possible object is * {@link SharedResourceType } * */ public SharedResourceType getType() { return type; } /** * Sets the value of the type property. * * @param value * allowed object is * {@link SharedResourceType } * */ public void setType(SharedResourceType value) { this.type = value; } /** * Gets the value of the accessread property. * * @return * possible object is * {@link Boolean } * */ public Boolean isACCESSREAD() { return accessread; } /** * Sets the value of the accessread property. * * @param value * allowed object is * {@link Boolean } * */ public void setACCESSREAD(Boolean value) { this.accessread = value; } /** * Gets the value of the accesswrite property. * * @return * possible object is * {@link Boolean } * */ public Boolean isACCESSWRITE() { return accesswrite; } /** * Sets the value of the accesswrite property. * * @param value * allowed object is * {@link Boolean } * */ public void setACCESSWRITE(Boolean value) { this.accesswrite = value; } /** * Gets the value of the accesscreate property. * * @return * possible object is * {@link Boolean } * */ public Boolean isACCESSCREATE() { return accesscreate; } /** * Sets the value of the accesscreate property. * * @param value * allowed object is * {@link Boolean } * */ public void setACCESSCREATE(Boolean value) { this.accesscreate = value; } /** * Gets the value of the accessexec property. * * @return * possible object is * {@link Boolean } * */ public Boolean isACCESSEXEC() { return accessexec; } /** * Sets the value of the accessexec property. * * @param value * allowed object is * {@link Boolean } * */ public void setACCESSEXEC(Boolean value) { this.accessexec = value; } /** * Gets the value of the accessdelete property. * * @return * possible object is * {@link Boolean } * */ public Boolean isACCESSDELETE() { return accessdelete; } /** * Sets the value of the accessdelete property. * * @param value * allowed object is * {@link Boolean } * */ public void setACCESSDELETE(Boolean value) { this.accessdelete = value; } /** * Gets the value of the accessatrib property. * * @return * possible object is * {@link Boolean } * */ public Boolean isACCESSATRIB() { return accessatrib; } /** * Sets the value of the accessatrib property. * * @param value * allowed object is * {@link Boolean } * */ public void setACCESSATRIB(Boolean value) { this.accessatrib = value; } /** * Gets the value of the accessperm property. * * @return * possible object is * {@link Boolean } * */ public Boolean isACCESSPERM() { return accessperm; } /** * Sets the value of the accessperm property. * * @param value * allowed object is * {@link Boolean } * */ public void setACCESSPERM(Boolean value) { this.accessperm = value; } /** * Gets the value of the accessall property. * * @return * possible object is * {@link Boolean } * */ public Boolean isACCESSALL() { return accessall; } /** * Sets the value of the accessall property. * * @param value * allowed object is * {@link Boolean } * */ public void setACCESSALL(Boolean value) { this.accessall = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof WindowsNetworkShare)) { return false; } if (this == object) { return true; } if (!super.equals(thisLocator, thatLocator, object, strategy)) { return false; } final WindowsNetworkShare that = ((WindowsNetworkShare) object); { NonNegativeIntegerObjectPropertyType lhsCurrentUses; lhsCurrentUses = this.getCurrentUses(); NonNegativeIntegerObjectPropertyType rhsCurrentUses; rhsCurrentUses = that.getCurrentUses(); if (!strategy.equals(LocatorUtils.property(thisLocator, "currentUses", lhsCurrentUses), LocatorUtils.property( thatLocator, "currentUses", rhsCurrentUses), lhsCurrentUses, rhsCurrentUses)) { return false; } } { StringObjectPropertyType lhsLocalPath; lhsLocalPath = this.getLocalPath(); StringObjectPropertyType rhsLocalPath; rhsLocalPath = that.getLocalPath(); if (!strategy.equals(LocatorUtils.property(thisLocator, "localPath", lhsLocalPath), LocatorUtils.property( thatLocator, "localPath", rhsLocalPath), lhsLocalPath, rhsLocalPath)) { return false; } } { NonNegativeIntegerObjectPropertyType lhsMaxUses; lhsMaxUses = this.getMaxUses(); NonNegativeIntegerObjectPropertyType rhsMaxUses; rhsMaxUses = that.getMaxUses(); if (!strategy.equals( LocatorUtils.property(thisLocator, "maxUses", lhsMaxUses), LocatorUtils.property(thatLocator, "maxUses", rhsMaxUses), lhsMaxUses, rhsMaxUses)) { return false; } } { StringObjectPropertyType lhsNetname; lhsNetname = this.getNetname(); StringObjectPropertyType rhsNetname; rhsNetname = that.getNetname(); if (!strategy.equals( LocatorUtils.property(thisLocator, "netname", lhsNetname), LocatorUtils.property(thatLocator, "netname", rhsNetname), lhsNetname, rhsNetname)) { return false; } } { SharedResourceType lhsType; lhsType = this.getType(); SharedResourceType rhsType; rhsType = that.getType(); if (!strategy.equals( LocatorUtils.property(thisLocator, "type", lhsType), LocatorUtils.property(thatLocator, "type", rhsType), lhsType, rhsType)) { return false; } } { Boolean lhsACCESSREAD; lhsACCESSREAD = this.isACCESSREAD(); Boolean rhsACCESSREAD; rhsACCESSREAD = that.isACCESSREAD(); if (!strategy.equals(LocatorUtils.property(thisLocator, "accessread", lhsACCESSREAD), LocatorUtils.property( thatLocator, "accessread", rhsACCESSREAD), lhsACCESSREAD, rhsACCESSREAD)) { return false; } } { Boolean lhsACCESSWRITE; lhsACCESSWRITE = this.isACCESSWRITE(); Boolean rhsACCESSWRITE; rhsACCESSWRITE = that.isACCESSWRITE(); if (!strategy.equals(LocatorUtils.property(thisLocator, "accesswrite", lhsACCESSWRITE), LocatorUtils.property( thatLocator, "accesswrite", rhsACCESSWRITE), lhsACCESSWRITE, rhsACCESSWRITE)) { return false; } } { Boolean lhsACCESSCREATE; lhsACCESSCREATE = this.isACCESSCREATE(); Boolean rhsACCESSCREATE; rhsACCESSCREATE = that.isACCESSCREATE(); if (!strategy.equals(LocatorUtils.property(thisLocator, "accesscreate", lhsACCESSCREATE), LocatorUtils.property( thatLocator, "accesscreate", rhsACCESSCREATE), lhsACCESSCREATE, rhsACCESSCREATE)) { return false; } } { Boolean lhsACCESSEXEC; lhsACCESSEXEC = this.isACCESSEXEC(); Boolean rhsACCESSEXEC; rhsACCESSEXEC = that.isACCESSEXEC(); if (!strategy.equals(LocatorUtils.property(thisLocator, "accessexec", lhsACCESSEXEC), LocatorUtils.property( thatLocator, "accessexec", rhsACCESSEXEC), lhsACCESSEXEC, rhsACCESSEXEC)) { return false; } } { Boolean lhsACCESSDELETE; lhsACCESSDELETE = this.isACCESSDELETE(); Boolean rhsACCESSDELETE; rhsACCESSDELETE = that.isACCESSDELETE(); if (!strategy.equals(LocatorUtils.property(thisLocator, "accessdelete", lhsACCESSDELETE), LocatorUtils.property( thatLocator, "accessdelete", rhsACCESSDELETE), lhsACCESSDELETE, rhsACCESSDELETE)) { return false; } } { Boolean lhsACCESSATRIB; lhsACCESSATRIB = this.isACCESSATRIB(); Boolean rhsACCESSATRIB; rhsACCESSATRIB = that.isACCESSATRIB(); if (!strategy.equals(LocatorUtils.property(thisLocator, "accessatrib", lhsACCESSATRIB), LocatorUtils.property( thatLocator, "accessatrib", rhsACCESSATRIB), lhsACCESSATRIB, rhsACCESSATRIB)) { return false; } } { Boolean lhsACCESSPERM; lhsACCESSPERM = this.isACCESSPERM(); Boolean rhsACCESSPERM; rhsACCESSPERM = that.isACCESSPERM(); if (!strategy.equals(LocatorUtils.property(thisLocator, "accessperm", lhsACCESSPERM), LocatorUtils.property( thatLocator, "accessperm", rhsACCESSPERM), lhsACCESSPERM, rhsACCESSPERM)) { return false; } } { Boolean lhsACCESSALL; lhsACCESSALL = this.isACCESSALL(); Boolean rhsACCESSALL; rhsACCESSALL = that.isACCESSALL(); if (!strategy.equals(LocatorUtils.property(thisLocator, "accessall", lhsACCESSALL), LocatorUtils.property( thatLocator, "accessall", rhsACCESSALL), lhsACCESSALL, rhsACCESSALL)) { 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 theCurrentUses; theCurrentUses = this.getCurrentUses(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "currentUses", theCurrentUses), currentHashCode, theCurrentUses); } { StringObjectPropertyType theLocalPath; theLocalPath = this.getLocalPath(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "localPath", theLocalPath), currentHashCode, theLocalPath); } { NonNegativeIntegerObjectPropertyType theMaxUses; theMaxUses = this.getMaxUses(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "maxUses", theMaxUses), currentHashCode, theMaxUses); } { StringObjectPropertyType theNetname; theNetname = this.getNetname(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "netname", theNetname), currentHashCode, theNetname); } { SharedResourceType theType; theType = this.getType(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "type", theType), currentHashCode, theType); } { Boolean theACCESSREAD; theACCESSREAD = this.isACCESSREAD(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "accessread", theACCESSREAD), currentHashCode, theACCESSREAD); } { Boolean theACCESSWRITE; theACCESSWRITE = this.isACCESSWRITE(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "accesswrite", theACCESSWRITE), currentHashCode, theACCESSWRITE); } { Boolean theACCESSCREATE; theACCESSCREATE = this.isACCESSCREATE(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "accesscreate", theACCESSCREATE), currentHashCode, theACCESSCREATE); } { Boolean theACCESSEXEC; theACCESSEXEC = this.isACCESSEXEC(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "accessexec", theACCESSEXEC), currentHashCode, theACCESSEXEC); } { Boolean theACCESSDELETE; theACCESSDELETE = this.isACCESSDELETE(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "accessdelete", theACCESSDELETE), currentHashCode, theACCESSDELETE); } { Boolean theACCESSATRIB; theACCESSATRIB = this.isACCESSATRIB(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "accessatrib", theACCESSATRIB), currentHashCode, theACCESSATRIB); } { Boolean theACCESSPERM; theACCESSPERM = this.isACCESSPERM(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "accessperm", theACCESSPERM), currentHashCode, theACCESSPERM); } { Boolean theACCESSALL; theACCESSALL = this.isACCESSALL(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "accessall", theACCESSALL), currentHashCode, theACCESSALL); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public WindowsNetworkShare withCurrentUses( NonNegativeIntegerObjectPropertyType value) { setCurrentUses(value); return this; } public WindowsNetworkShare withLocalPath(StringObjectPropertyType value) { setLocalPath(value); return this; } public WindowsNetworkShare withMaxUses( NonNegativeIntegerObjectPropertyType value) { setMaxUses(value); return this; } public WindowsNetworkShare withNetname(StringObjectPropertyType value) { setNetname(value); return this; } public WindowsNetworkShare withType(SharedResourceType value) { setType(value); return this; } public WindowsNetworkShare withACCESSREAD(Boolean value) { setACCESSREAD(value); return this; } public WindowsNetworkShare withACCESSWRITE(Boolean value) { setACCESSWRITE(value); return this; } public WindowsNetworkShare withACCESSCREATE(Boolean value) { setACCESSCREATE(value); return this; } public WindowsNetworkShare withACCESSEXEC(Boolean value) { setACCESSEXEC(value); return this; } public WindowsNetworkShare withACCESSDELETE(Boolean value) { setACCESSDELETE(value); return this; } public WindowsNetworkShare withACCESSATRIB(Boolean value) { setACCESSATRIB(value); return this; } public WindowsNetworkShare withACCESSPERM(Boolean value) { setACCESSPERM(value); return this; } public WindowsNetworkShare withACCESSALL(Boolean value) { setACCESSALL(value); return this; } @Override public WindowsNetworkShare withCustomProperties(CustomPropertiesType value) { setCustomProperties(value); return this; } @Override public WindowsNetworkShare 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 theCurrentUses; theCurrentUses = this.getCurrentUses(); strategy.appendField(locator, this, "currentUses", buffer, theCurrentUses); } { StringObjectPropertyType theLocalPath; theLocalPath = this.getLocalPath(); strategy.appendField(locator, this, "localPath", buffer, theLocalPath); } { NonNegativeIntegerObjectPropertyType theMaxUses; theMaxUses = this.getMaxUses(); strategy.appendField(locator, this, "maxUses", buffer, theMaxUses); } { StringObjectPropertyType theNetname; theNetname = this.getNetname(); strategy.appendField(locator, this, "netname", buffer, theNetname); } { SharedResourceType theType; theType = this.getType(); strategy.appendField(locator, this, "type", buffer, theType); } { Boolean theACCESSREAD; theACCESSREAD = this.isACCESSREAD(); strategy.appendField(locator, this, "accessread", buffer, theACCESSREAD); } { Boolean theACCESSWRITE; theACCESSWRITE = this.isACCESSWRITE(); strategy.appendField(locator, this, "accesswrite", buffer, theACCESSWRITE); } { Boolean theACCESSCREATE; theACCESSCREATE = this.isACCESSCREATE(); strategy.appendField(locator, this, "accesscreate", buffer, theACCESSCREATE); } { Boolean theACCESSEXEC; theACCESSEXEC = this.isACCESSEXEC(); strategy.appendField(locator, this, "accessexec", buffer, theACCESSEXEC); } { Boolean theACCESSDELETE; theACCESSDELETE = this.isACCESSDELETE(); strategy.appendField(locator, this, "accessdelete", buffer, theACCESSDELETE); } { Boolean theACCESSATRIB; theACCESSATRIB = this.isACCESSATRIB(); strategy.appendField(locator, this, "accessatrib", buffer, theACCESSATRIB); } { Boolean theACCESSPERM; theACCESSPERM = this.isACCESSPERM(); strategy.appendField(locator, this, "accessperm", buffer, theACCESSPERM); } { Boolean theACCESSALL; theACCESSALL = this.isACCESSALL(); strategy.appendField(locator, this, "accessall", buffer, theACCESSALL); } 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, WindowsNetworkShare.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 WindowsNetworkShare instance for XML String * * @param text * XML String for the document * @return The WindowsNetworkShare instance for the passed XML String */ public static WindowsNetworkShare fromXMLString(String text) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(WindowsNetworkShare.class .getPackage().getName()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(STIXSchema.getInstance().getSchema()); unmarshaller.setEventHandler(new ValidationEventHandler()); StreamSource streamSource = new StreamSource(new StringReader(text)); return (WindowsNetworkShare) unmarshaller.unmarshal(streamSource); } catch (JAXBException e) { throw new RuntimeException(e); } } /** * Validates the XML representation of this WindowsNetworkShare 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()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy