org.mitre.cybox.objects.UnixNetworkRouteEntry 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.06.23 at 10:59:44 AM 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.DurationObjectPropertyType;
import org.mitre.cybox.common_2.StringObjectPropertyType;
import org.mitre.cybox.common_2.UnsignedIntegerObjectPropertyType;
import org.mitre.cybox.common_2.UnsignedLongObjectPropertyType;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
/**
* The UnixNetworkRouteEntryObjectType type is intended to characterize entries in the network routing table of a Unix system.
*
* Java class for UnixNetworkRouteEntryObjectType complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType name="UnixNetworkRouteEntryObjectType">
* <complexContent>
* <extension base="{http://cybox.mitre.org/objects#NetworkRouteEntryObject-2}NetworkRouteEntryObjectType">
* <sequence>
* <element name="Flags" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
* <element name="MSS" type="{http://cybox.mitre.org/common-2}UnsignedIntegerObjectPropertyType" minOccurs="0"/>
* <element name="Ref" type="{http://cybox.mitre.org/common-2}UnsignedLongObjectPropertyType" minOccurs="0"/>
* <element name="Use" type="{http://cybox.mitre.org/common-2}UnsignedLongObjectPropertyType" minOccurs="0"/>
* <element name="Window" type="{http://cybox.mitre.org/common-2}UnsignedIntegerObjectPropertyType" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UnixNetworkRouteEntryObjectType", namespace = "http://cybox.mitre.org/objects#UnixNetworkRouteEntryObject-2", propOrder = {
"flags", "mss", "ref", "use", "window" })
@XmlRootElement(name = "Unix_Network_Route_Entry", namespace = "http://cybox.mitre.org/objects#UnixNetworkRouteEntryObject-2")
public class UnixNetworkRouteEntry extends NetworkRouteEntryObjectType
implements Equals, HashCode, ToString {
@XmlElement(name = "Flags")
protected StringObjectPropertyType flags;
@XmlElement(name = "MSS")
protected UnsignedIntegerObjectPropertyType mss;
@XmlElement(name = "Ref")
protected UnsignedLongObjectPropertyType ref;
@XmlElement(name = "Use")
protected UnsignedLongObjectPropertyType use;
@XmlElement(name = "Window")
protected UnsignedIntegerObjectPropertyType window;
/**
* Default no-arg constructor
*
*/
public UnixNetworkRouteEntry() {
super();
}
/**
* Fully-initialising value constructor
*
*/
public UnixNetworkRouteEntry(final CustomPropertiesType customProperties,
final QName objectReference, final Address destinationAddress,
final Address origin, final Address netmask,
final Address gatewayAddress,
final UnsignedLongObjectPropertyType metric, final RouteType type,
final StringObjectPropertyType protocol,
final StringObjectPropertyType _interface,
final DurationObjectPropertyType preferredLifetime,
final DurationObjectPropertyType validLifetime,
final DurationObjectPropertyType routeAge, final Boolean isIpv6,
final Boolean isAutoconfigureAddress, final Boolean isImmortal,
final Boolean isLoopback, final Boolean isPublish,
final StringObjectPropertyType flags,
final UnsignedIntegerObjectPropertyType mss,
final UnsignedLongObjectPropertyType ref,
final UnsignedLongObjectPropertyType use,
final UnsignedIntegerObjectPropertyType window) {
super(customProperties, objectReference, destinationAddress, origin,
netmask, gatewayAddress, metric, type, protocol, _interface,
preferredLifetime, validLifetime, routeAge, isIpv6,
isAutoconfigureAddress, isImmortal, isLoopback, isPublish);
this.flags = flags;
this.mss = mss;
this.ref = ref;
this.use = use;
this.window = window;
}
/**
* Gets the value of the flags property.
*
* @return
* possible object is
* {@link StringObjectPropertyType }
*
*/
public StringObjectPropertyType getFlags() {
return flags;
}
/**
* Sets the value of the flags property.
*
* @param value
* allowed object is
* {@link StringObjectPropertyType }
*
*/
public void setFlags(StringObjectPropertyType value) {
this.flags = value;
}
/**
* Gets the value of the mss property.
*
* @return
* possible object is
* {@link UnsignedIntegerObjectPropertyType }
*
*/
public UnsignedIntegerObjectPropertyType getMSS() {
return mss;
}
/**
* Sets the value of the mss property.
*
* @param value
* allowed object is
* {@link UnsignedIntegerObjectPropertyType }
*
*/
public void setMSS(UnsignedIntegerObjectPropertyType value) {
this.mss = value;
}
/**
* Gets the value of the ref property.
*
* @return
* possible object is
* {@link UnsignedLongObjectPropertyType }
*
*/
public UnsignedLongObjectPropertyType getRef() {
return ref;
}
/**
* Sets the value of the ref property.
*
* @param value
* allowed object is
* {@link UnsignedLongObjectPropertyType }
*
*/
public void setRef(UnsignedLongObjectPropertyType value) {
this.ref = value;
}
/**
* Gets the value of the use property.
*
* @return
* possible object is
* {@link UnsignedLongObjectPropertyType }
*
*/
public UnsignedLongObjectPropertyType getUse() {
return use;
}
/**
* Sets the value of the use property.
*
* @param value
* allowed object is
* {@link UnsignedLongObjectPropertyType }
*
*/
public void setUse(UnsignedLongObjectPropertyType value) {
this.use = value;
}
/**
* Gets the value of the window property.
*
* @return
* possible object is
* {@link UnsignedIntegerObjectPropertyType }
*
*/
public UnsignedIntegerObjectPropertyType getWindow() {
return window;
}
/**
* Sets the value of the window property.
*
* @param value
* allowed object is
* {@link UnsignedIntegerObjectPropertyType }
*
*/
public void setWindow(UnsignedIntegerObjectPropertyType value) {
this.window = value;
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator,
Object object, EqualsStrategy strategy) {
if (!(object instanceof UnixNetworkRouteEntry)) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(thisLocator, thatLocator, object, strategy)) {
return false;
}
final UnixNetworkRouteEntry that = ((UnixNetworkRouteEntry) object);
{
StringObjectPropertyType lhsFlags;
lhsFlags = this.getFlags();
StringObjectPropertyType rhsFlags;
rhsFlags = that.getFlags();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "flags", lhsFlags),
LocatorUtils.property(thatLocator, "flags", rhsFlags),
lhsFlags, rhsFlags)) {
return false;
}
}
{
UnsignedIntegerObjectPropertyType lhsMSS;
lhsMSS = this.getMSS();
UnsignedIntegerObjectPropertyType rhsMSS;
rhsMSS = that.getMSS();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "mss", lhsMSS),
LocatorUtils.property(thatLocator, "mss", rhsMSS), lhsMSS,
rhsMSS)) {
return false;
}
}
{
UnsignedLongObjectPropertyType lhsRef;
lhsRef = this.getRef();
UnsignedLongObjectPropertyType rhsRef;
rhsRef = that.getRef();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "ref", lhsRef),
LocatorUtils.property(thatLocator, "ref", rhsRef), lhsRef,
rhsRef)) {
return false;
}
}
{
UnsignedLongObjectPropertyType lhsUse;
lhsUse = this.getUse();
UnsignedLongObjectPropertyType rhsUse;
rhsUse = that.getUse();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "use", lhsUse),
LocatorUtils.property(thatLocator, "use", rhsUse), lhsUse,
rhsUse)) {
return false;
}
}
{
UnsignedIntegerObjectPropertyType lhsWindow;
lhsWindow = this.getWindow();
UnsignedIntegerObjectPropertyType rhsWindow;
rhsWindow = that.getWindow();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "window", lhsWindow),
LocatorUtils.property(thatLocator, "window", rhsWindow),
lhsWindow, rhsWindow)) {
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);
{
StringObjectPropertyType theFlags;
theFlags = this.getFlags();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "flags", theFlags),
currentHashCode, theFlags);
}
{
UnsignedIntegerObjectPropertyType theMSS;
theMSS = this.getMSS();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "mss", theMSS),
currentHashCode, theMSS);
}
{
UnsignedLongObjectPropertyType theRef;
theRef = this.getRef();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "ref", theRef),
currentHashCode, theRef);
}
{
UnsignedLongObjectPropertyType theUse;
theUse = this.getUse();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "use", theUse),
currentHashCode, theUse);
}
{
UnsignedIntegerObjectPropertyType theWindow;
theWindow = this.getWindow();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "window", theWindow),
currentHashCode, theWindow);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public UnixNetworkRouteEntry withFlags(StringObjectPropertyType value) {
setFlags(value);
return this;
}
public UnixNetworkRouteEntry withMSS(UnsignedIntegerObjectPropertyType value) {
setMSS(value);
return this;
}
public UnixNetworkRouteEntry withRef(UnsignedLongObjectPropertyType value) {
setRef(value);
return this;
}
public UnixNetworkRouteEntry withUse(UnsignedLongObjectPropertyType value) {
setUse(value);
return this;
}
public UnixNetworkRouteEntry withWindow(
UnsignedIntegerObjectPropertyType value) {
setWindow(value);
return this;
}
@Override
public UnixNetworkRouteEntry withDestinationAddress(Address value) {
setDestinationAddress(value);
return this;
}
@Override
public UnixNetworkRouteEntry withOrigin(Address value) {
setOrigin(value);
return this;
}
@Override
public UnixNetworkRouteEntry withNetmask(Address value) {
setNetmask(value);
return this;
}
@Override
public UnixNetworkRouteEntry withGatewayAddress(Address value) {
setGatewayAddress(value);
return this;
}
@Override
public UnixNetworkRouteEntry withMetric(UnsignedLongObjectPropertyType value) {
setMetric(value);
return this;
}
@Override
public UnixNetworkRouteEntry withType(RouteType value) {
setType(value);
return this;
}
@Override
public UnixNetworkRouteEntry withProtocol(StringObjectPropertyType value) {
setProtocol(value);
return this;
}
@Override
public UnixNetworkRouteEntry withInterface(StringObjectPropertyType value) {
setInterface(value);
return this;
}
@Override
public UnixNetworkRouteEntry withPreferredLifetime(
DurationObjectPropertyType value) {
setPreferredLifetime(value);
return this;
}
@Override
public UnixNetworkRouteEntry withValidLifetime(
DurationObjectPropertyType value) {
setValidLifetime(value);
return this;
}
@Override
public UnixNetworkRouteEntry withRouteAge(DurationObjectPropertyType value) {
setRouteAge(value);
return this;
}
@Override
public UnixNetworkRouteEntry withIsIpv6(Boolean value) {
setIsIpv6(value);
return this;
}
@Override
public UnixNetworkRouteEntry withIsAutoconfigureAddress(Boolean value) {
setIsAutoconfigureAddress(value);
return this;
}
@Override
public UnixNetworkRouteEntry withIsImmortal(Boolean value) {
setIsImmortal(value);
return this;
}
@Override
public UnixNetworkRouteEntry withIsLoopback(Boolean value) {
setIsLoopback(value);
return this;
}
@Override
public UnixNetworkRouteEntry withIsPublish(Boolean value) {
setIsPublish(value);
return this;
}
@Override
public UnixNetworkRouteEntry withCustomProperties(CustomPropertiesType value) {
setCustomProperties(value);
return this;
}
@Override
public UnixNetworkRouteEntry 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);
{
StringObjectPropertyType theFlags;
theFlags = this.getFlags();
strategy.appendField(locator, this, "flags", buffer, theFlags);
}
{
UnsignedIntegerObjectPropertyType theMSS;
theMSS = this.getMSS();
strategy.appendField(locator, this, "mss", buffer, theMSS);
}
{
UnsignedLongObjectPropertyType theRef;
theRef = this.getRef();
strategy.appendField(locator, this, "ref", buffer, theRef);
}
{
UnsignedLongObjectPropertyType theUse;
theUse = this.getUse();
strategy.appendField(locator, this, "use", buffer, theUse);
}
{
UnsignedIntegerObjectPropertyType theWindow;
theWindow = this.getWindow();
strategy.appendField(locator, this, "window", buffer, theWindow);
}
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, UnixNetworkRouteEntry.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 UnixNetworkRouteEntry instance for XML String
*
* @param text
* XML String for the document
* @return The UnixNetworkRouteEntry instance for the passed XML String
*/
public static UnixNetworkRouteEntry fromXMLString(String text) {
JAXBContext jaxbContext;
try {
jaxbContext = JAXBContext.newInstance(UnixNetworkRouteEntry.class
.getPackage().getName());
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setSchema(STIXSchema.getInstance().getSchema());
unmarshaller.setEventHandler(new ValidationEventHandler());
StreamSource streamSource = new StreamSource(new StringReader(text));
return (UnixNetworkRouteEntry) unmarshaller.unmarshal(streamSource);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
/**
* Validates the XML representation of this UnixNetworkRouteEntry instance
* Returning true indicating a successful validation, false if not.
*
* @return boolean
*/
public boolean validate() {
return STIXSchema.getInstance().validate(toXMLString());
}
}