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

org.mitre.cybox.objects.DiskPartition 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.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.IntegerObjectPropertyType;
import org.mitre.cybox.common_2.NameObjectPropertyType;
import org.mitre.cybox.common_2.ObjectPropertiesType;
import org.mitre.cybox.common_2.StringObjectPropertyType;
import org.mitre.cybox.common_2.UnsignedLongObjectPropertyType;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
import org.xml.sax.SAXException;

/**
 * The DiskPartitionType type is intended to characterize partitions of disk drives.
 * 
 * 

Java class for DiskPartitionObjectType complex type. * *

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

 * <complexType name="DiskPartitionObjectType">
 *   <complexContent>
 *     <extension base="{http://cybox.mitre.org/common-2}ObjectPropertiesType">
 *       <sequence>
 *         <element name="Created" type="{http://cybox.mitre.org/common-2}DateTimeObjectPropertyType" minOccurs="0"/>
 *         <element name="Device_Name" type="{http://cybox.mitre.org/common-2}NameObjectPropertyType" minOccurs="0"/>
 *         <element name="Mount_Point" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="Partition_ID" type="{http://cybox.mitre.org/common-2}IntegerObjectPropertyType" minOccurs="0"/>
 *         <element name="Partition_Length" type="{http://cybox.mitre.org/common-2}UnsignedLongObjectPropertyType" minOccurs="0"/>
 *         <element name="Partition_Offset" type="{http://cybox.mitre.org/common-2}UnsignedLongObjectPropertyType" minOccurs="0"/>
 *         <element name="Space_Left" type="{http://cybox.mitre.org/common-2}UnsignedLongObjectPropertyType" minOccurs="0"/>
 *         <element name="Space_Used" type="{http://cybox.mitre.org/common-2}UnsignedLongObjectPropertyType" minOccurs="0"/>
 *         <element name="Total_Space" type="{http://cybox.mitre.org/common-2}UnsignedLongObjectPropertyType" minOccurs="0"/>
 *         <element name="Type" type="{http://cybox.mitre.org/objects#DiskPartitionObject-2}PartitionType" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DiskPartitionObjectType", namespace = "http://cybox.mitre.org/objects#DiskPartitionObject-2", propOrder = { "created", "deviceName", "mountPoint", "partitionID", "partitionLength", "partitionOffset", "spaceLeft", "spaceUsed", "totalSpace", "type" }) @XmlRootElement(name = "Disk_Partition", namespace = "http://cybox.mitre.org/objects#DiskPartitionObject-2") public class DiskPartition extends ObjectPropertiesType implements Equals, HashCode, ToString { @XmlElement(name = "Created") protected DateTimeObjectPropertyType created; @XmlElement(name = "Device_Name") protected NameObjectPropertyType deviceName; @XmlElement(name = "Mount_Point") protected StringObjectPropertyType mountPoint; @XmlElement(name = "Partition_ID") protected IntegerObjectPropertyType partitionID; @XmlElement(name = "Partition_Length") protected UnsignedLongObjectPropertyType partitionLength; @XmlElement(name = "Partition_Offset") protected UnsignedLongObjectPropertyType partitionOffset; @XmlElement(name = "Space_Left") protected UnsignedLongObjectPropertyType spaceLeft; @XmlElement(name = "Space_Used") protected UnsignedLongObjectPropertyType spaceUsed; @XmlElement(name = "Total_Space") protected UnsignedLongObjectPropertyType totalSpace; @XmlElement(name = "Type") protected PartitionType type; /** * Default no-arg constructor * */ public DiskPartition() { super(); } /** * Fully-initialising value constructor * */ public DiskPartition(final CustomPropertiesType customProperties, final QName objectReference, final DateTimeObjectPropertyType created, final NameObjectPropertyType deviceName, final StringObjectPropertyType mountPoint, final IntegerObjectPropertyType partitionID, final UnsignedLongObjectPropertyType partitionLength, final UnsignedLongObjectPropertyType partitionOffset, final UnsignedLongObjectPropertyType spaceLeft, final UnsignedLongObjectPropertyType spaceUsed, final UnsignedLongObjectPropertyType totalSpace, final PartitionType type) { super(customProperties, objectReference); this.created = created; this.deviceName = deviceName; this.mountPoint = mountPoint; this.partitionID = partitionID; this.partitionLength = partitionLength; this.partitionOffset = partitionOffset; this.spaceLeft = spaceLeft; this.spaceUsed = spaceUsed; this.totalSpace = totalSpace; this.type = type; } /** * Gets the value of the created property. * * @return * possible object is * {@link DateTimeObjectPropertyType } * */ public DateTimeObjectPropertyType getCreated() { return created; } /** * Sets the value of the created property. * * @param value * allowed object is * {@link DateTimeObjectPropertyType } * */ public void setCreated(DateTimeObjectPropertyType value) { this.created = value; } /** * Gets the value of the deviceName property. * * @return * possible object is * {@link NameObjectPropertyType } * */ public NameObjectPropertyType getDeviceName() { return deviceName; } /** * Sets the value of the deviceName property. * * @param value * allowed object is * {@link NameObjectPropertyType } * */ public void setDeviceName(NameObjectPropertyType value) { this.deviceName = value; } /** * Gets the value of the mountPoint property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getMountPoint() { return mountPoint; } /** * Sets the value of the mountPoint property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setMountPoint(StringObjectPropertyType value) { this.mountPoint = value; } /** * Gets the value of the partitionID property. * * @return * possible object is * {@link IntegerObjectPropertyType } * */ public IntegerObjectPropertyType getPartitionID() { return partitionID; } /** * Sets the value of the partitionID property. * * @param value * allowed object is * {@link IntegerObjectPropertyType } * */ public void setPartitionID(IntegerObjectPropertyType value) { this.partitionID = value; } /** * Gets the value of the partitionLength property. * * @return * possible object is * {@link UnsignedLongObjectPropertyType } * */ public UnsignedLongObjectPropertyType getPartitionLength() { return partitionLength; } /** * Sets the value of the partitionLength property. * * @param value * allowed object is * {@link UnsignedLongObjectPropertyType } * */ public void setPartitionLength(UnsignedLongObjectPropertyType value) { this.partitionLength = value; } /** * Gets the value of the partitionOffset property. * * @return * possible object is * {@link UnsignedLongObjectPropertyType } * */ public UnsignedLongObjectPropertyType getPartitionOffset() { return partitionOffset; } /** * Sets the value of the partitionOffset property. * * @param value * allowed object is * {@link UnsignedLongObjectPropertyType } * */ public void setPartitionOffset(UnsignedLongObjectPropertyType value) { this.partitionOffset = value; } /** * Gets the value of the spaceLeft property. * * @return * possible object is * {@link UnsignedLongObjectPropertyType } * */ public UnsignedLongObjectPropertyType getSpaceLeft() { return spaceLeft; } /** * Sets the value of the spaceLeft property. * * @param value * allowed object is * {@link UnsignedLongObjectPropertyType } * */ public void setSpaceLeft(UnsignedLongObjectPropertyType value) { this.spaceLeft = value; } /** * Gets the value of the spaceUsed property. * * @return * possible object is * {@link UnsignedLongObjectPropertyType } * */ public UnsignedLongObjectPropertyType getSpaceUsed() { return spaceUsed; } /** * Sets the value of the spaceUsed property. * * @param value * allowed object is * {@link UnsignedLongObjectPropertyType } * */ public void setSpaceUsed(UnsignedLongObjectPropertyType value) { this.spaceUsed = value; } /** * Gets the value of the totalSpace property. * * @return * possible object is * {@link UnsignedLongObjectPropertyType } * */ public UnsignedLongObjectPropertyType getTotalSpace() { return totalSpace; } /** * Sets the value of the totalSpace property. * * @param value * allowed object is * {@link UnsignedLongObjectPropertyType } * */ public void setTotalSpace(UnsignedLongObjectPropertyType value) { this.totalSpace = value; } /** * Gets the value of the type property. * * @return * possible object is * {@link PartitionType } * */ public PartitionType getType() { return type; } /** * Sets the value of the type property. * * @param value * allowed object is * {@link PartitionType } * */ public void setType(PartitionType value) { this.type = value; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof DiskPartition)) { return false; } if (this == object) { return true; } if (!super.equals(thisLocator, thatLocator, object, strategy)) { return false; } final DiskPartition that = ((DiskPartition) object); { DateTimeObjectPropertyType lhsCreated; lhsCreated = this.getCreated(); DateTimeObjectPropertyType rhsCreated; rhsCreated = that.getCreated(); if (!strategy.equals( LocatorUtils.property(thisLocator, "created", lhsCreated), LocatorUtils.property(thatLocator, "created", rhsCreated), lhsCreated, rhsCreated)) { return false; } } { NameObjectPropertyType lhsDeviceName; lhsDeviceName = this.getDeviceName(); NameObjectPropertyType rhsDeviceName; rhsDeviceName = that.getDeviceName(); if (!strategy.equals(LocatorUtils.property(thisLocator, "deviceName", lhsDeviceName), LocatorUtils.property( thatLocator, "deviceName", rhsDeviceName), lhsDeviceName, rhsDeviceName)) { return false; } } { StringObjectPropertyType lhsMountPoint; lhsMountPoint = this.getMountPoint(); StringObjectPropertyType rhsMountPoint; rhsMountPoint = that.getMountPoint(); if (!strategy.equals(LocatorUtils.property(thisLocator, "mountPoint", lhsMountPoint), LocatorUtils.property( thatLocator, "mountPoint", rhsMountPoint), lhsMountPoint, rhsMountPoint)) { return false; } } { IntegerObjectPropertyType lhsPartitionID; lhsPartitionID = this.getPartitionID(); IntegerObjectPropertyType rhsPartitionID; rhsPartitionID = that.getPartitionID(); if (!strategy.equals(LocatorUtils.property(thisLocator, "partitionID", lhsPartitionID), LocatorUtils.property( thatLocator, "partitionID", rhsPartitionID), lhsPartitionID, rhsPartitionID)) { return false; } } { UnsignedLongObjectPropertyType lhsPartitionLength; lhsPartitionLength = this.getPartitionLength(); UnsignedLongObjectPropertyType rhsPartitionLength; rhsPartitionLength = that.getPartitionLength(); if (!strategy.equals(LocatorUtils.property(thisLocator, "partitionLength", lhsPartitionLength), LocatorUtils .property(thatLocator, "partitionLength", rhsPartitionLength), lhsPartitionLength, rhsPartitionLength)) { return false; } } { UnsignedLongObjectPropertyType lhsPartitionOffset; lhsPartitionOffset = this.getPartitionOffset(); UnsignedLongObjectPropertyType rhsPartitionOffset; rhsPartitionOffset = that.getPartitionOffset(); if (!strategy.equals(LocatorUtils.property(thisLocator, "partitionOffset", lhsPartitionOffset), LocatorUtils .property(thatLocator, "partitionOffset", rhsPartitionOffset), lhsPartitionOffset, rhsPartitionOffset)) { return false; } } { UnsignedLongObjectPropertyType lhsSpaceLeft; lhsSpaceLeft = this.getSpaceLeft(); UnsignedLongObjectPropertyType rhsSpaceLeft; rhsSpaceLeft = that.getSpaceLeft(); if (!strategy.equals(LocatorUtils.property(thisLocator, "spaceLeft", lhsSpaceLeft), LocatorUtils.property( thatLocator, "spaceLeft", rhsSpaceLeft), lhsSpaceLeft, rhsSpaceLeft)) { return false; } } { UnsignedLongObjectPropertyType lhsSpaceUsed; lhsSpaceUsed = this.getSpaceUsed(); UnsignedLongObjectPropertyType rhsSpaceUsed; rhsSpaceUsed = that.getSpaceUsed(); if (!strategy.equals(LocatorUtils.property(thisLocator, "spaceUsed", lhsSpaceUsed), LocatorUtils.property( thatLocator, "spaceUsed", rhsSpaceUsed), lhsSpaceUsed, rhsSpaceUsed)) { return false; } } { UnsignedLongObjectPropertyType lhsTotalSpace; lhsTotalSpace = this.getTotalSpace(); UnsignedLongObjectPropertyType rhsTotalSpace; rhsTotalSpace = that.getTotalSpace(); if (!strategy.equals(LocatorUtils.property(thisLocator, "totalSpace", lhsTotalSpace), LocatorUtils.property( thatLocator, "totalSpace", rhsTotalSpace), lhsTotalSpace, rhsTotalSpace)) { return false; } } { PartitionType lhsType; lhsType = this.getType(); PartitionType rhsType; rhsType = that.getType(); if (!strategy.equals( LocatorUtils.property(thisLocator, "type", lhsType), LocatorUtils.property(thatLocator, "type", rhsType), lhsType, rhsType)) { 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); { DateTimeObjectPropertyType theCreated; theCreated = this.getCreated(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "created", theCreated), currentHashCode, theCreated); } { NameObjectPropertyType theDeviceName; theDeviceName = this.getDeviceName(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "deviceName", theDeviceName), currentHashCode, theDeviceName); } { StringObjectPropertyType theMountPoint; theMountPoint = this.getMountPoint(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "mountPoint", theMountPoint), currentHashCode, theMountPoint); } { IntegerObjectPropertyType thePartitionID; thePartitionID = this.getPartitionID(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "partitionID", thePartitionID), currentHashCode, thePartitionID); } { UnsignedLongObjectPropertyType thePartitionLength; thePartitionLength = this.getPartitionLength(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "partitionLength", thePartitionLength), currentHashCode, thePartitionLength); } { UnsignedLongObjectPropertyType thePartitionOffset; thePartitionOffset = this.getPartitionOffset(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "partitionOffset", thePartitionOffset), currentHashCode, thePartitionOffset); } { UnsignedLongObjectPropertyType theSpaceLeft; theSpaceLeft = this.getSpaceLeft(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "spaceLeft", theSpaceLeft), currentHashCode, theSpaceLeft); } { UnsignedLongObjectPropertyType theSpaceUsed; theSpaceUsed = this.getSpaceUsed(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "spaceUsed", theSpaceUsed), currentHashCode, theSpaceUsed); } { UnsignedLongObjectPropertyType theTotalSpace; theTotalSpace = this.getTotalSpace(); currentHashCode = strategy .hashCode(LocatorUtils.property(locator, "totalSpace", theTotalSpace), currentHashCode, theTotalSpace); } { PartitionType theType; theType = this.getType(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "type", theType), currentHashCode, theType); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public DiskPartition withCreated(DateTimeObjectPropertyType value) { setCreated(value); return this; } public DiskPartition withDeviceName(NameObjectPropertyType value) { setDeviceName(value); return this; } public DiskPartition withMountPoint(StringObjectPropertyType value) { setMountPoint(value); return this; } public DiskPartition withPartitionID(IntegerObjectPropertyType value) { setPartitionID(value); return this; } public DiskPartition withPartitionLength( UnsignedLongObjectPropertyType value) { setPartitionLength(value); return this; } public DiskPartition withPartitionOffset( UnsignedLongObjectPropertyType value) { setPartitionOffset(value); return this; } public DiskPartition withSpaceLeft(UnsignedLongObjectPropertyType value) { setSpaceLeft(value); return this; } public DiskPartition withSpaceUsed(UnsignedLongObjectPropertyType value) { setSpaceUsed(value); return this; } public DiskPartition withTotalSpace(UnsignedLongObjectPropertyType value) { setTotalSpace(value); return this; } public DiskPartition withType(PartitionType value) { setType(value); return this; } @Override public DiskPartition withCustomProperties(CustomPropertiesType value) { setCustomProperties(value); return this; } @Override public DiskPartition 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); { DateTimeObjectPropertyType theCreated; theCreated = this.getCreated(); strategy.appendField(locator, this, "created", buffer, theCreated); } { NameObjectPropertyType theDeviceName; theDeviceName = this.getDeviceName(); strategy.appendField(locator, this, "deviceName", buffer, theDeviceName); } { StringObjectPropertyType theMountPoint; theMountPoint = this.getMountPoint(); strategy.appendField(locator, this, "mountPoint", buffer, theMountPoint); } { IntegerObjectPropertyType thePartitionID; thePartitionID = this.getPartitionID(); strategy.appendField(locator, this, "partitionID", buffer, thePartitionID); } { UnsignedLongObjectPropertyType thePartitionLength; thePartitionLength = this.getPartitionLength(); strategy.appendField(locator, this, "partitionLength", buffer, thePartitionLength); } { UnsignedLongObjectPropertyType thePartitionOffset; thePartitionOffset = this.getPartitionOffset(); strategy.appendField(locator, this, "partitionOffset", buffer, thePartitionOffset); } { UnsignedLongObjectPropertyType theSpaceLeft; theSpaceLeft = this.getSpaceLeft(); strategy.appendField(locator, this, "spaceLeft", buffer, theSpaceLeft); } { UnsignedLongObjectPropertyType theSpaceUsed; theSpaceUsed = this.getSpaceUsed(); strategy.appendField(locator, this, "spaceUsed", buffer, theSpaceUsed); } { UnsignedLongObjectPropertyType theTotalSpace; theTotalSpace = this.getTotalSpace(); strategy.appendField(locator, this, "totalSpace", buffer, theTotalSpace); } { PartitionType theType; theType = this.getType(); strategy.appendField(locator, this, "type", buffer, theType); } 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, DiskPartition.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 DiskPartition instance for XML String * * @param text * XML String for the document * @return The DiskPartition instance for the passed XML String */ public static DiskPartition fromXMLString(String text) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(DiskPartition.class .getPackage().getName()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(STIXSchema.getInstance().getSchema()); unmarshaller.setEventHandler(new ValidationEventHandler()); StreamSource streamSource = new StreamSource(new StringReader(text)); return (DiskPartition) unmarshaller.unmarshal(streamSource); } catch (JAXBException e) { throw new RuntimeException(e); } } /** * Validates the XML representation of this DiskPartition 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