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

com.mandiant.schemas._2010.ioc.ObjectFactory 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 com.mandiant.schemas._2010.ioc;

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.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
import org.xml.sax.SAXException;

/**
 * This object contains factory methods for each 
 * Java content interface and Java element interface 
 * generated in the com.mandiant.schemas._2010.ioc package. 
 * 

An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { private final static QName _Ioc_QNAME = new QName( "http://schemas.mandiant.com/2010/ioc", "ioc"); private final static QName _Ioctermlist_QNAME = new QName( "http://schemas.mandiant.com/2010/ioc", "ioctermlist"); private final static QName _Metrics_QNAME = new QName( "http://schemas.mandiant.com/2010/ioc", "metrics"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.mandiant.schemas._2010.ioc * */ public ObjectFactory() { } /** * Create an instance of {@link IocTermList } * */ public IocTermList createIocTermList() { return new IocTermList(); } /** * Create an instance of {@link MetricList } * */ public MetricList createMetricList() { return new MetricList(); } /** * Create an instance of {@link IndicatorOfCompromise } * */ public IndicatorOfCompromise createIndicatorOfCompromise() { return new IndicatorOfCompromise(); } /** * Create an instance of {@link IocTerm } * */ public IocTerm createIocTerm() { return new IocTerm(); } /** * Create an instance of {@link IndicatorItemContext } * */ public IndicatorItemContext createIndicatorItemContext() { return new IndicatorItemContext(); } /** * Create an instance of {@link IocIndicator } * */ public IocIndicator createIocIndicator() { return new IocIndicator(); } /** * Create an instance of {@link IndicatorItem } * */ public IndicatorItem createIndicatorItem() { return new IndicatorItem(); } /** * Create an instance of {@link ArrayOfLink } * */ public ArrayOfLink createArrayOfLink() { return new ArrayOfLink(); } /** * Create an instance of {@link Metric } * */ public Metric createMetric() { return new Metric(); } /** * Create an instance of {@link ArrayOfIocIndicator } * */ public ArrayOfIocIndicator createArrayOfIocIndicator() { return new ArrayOfIocIndicator(); } /** * Create an instance of {@link Identity } * */ public Identity createIdentity() { return new Identity(); } /** * Create an instance of {@link Link } * */ public Link createLink() { return new Link(); } /** * Create an instance of {@link IndicatorItemContent } * */ public IndicatorItemContent createIndicatorItemContent() { return new IndicatorItemContent(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link IndicatorOfCompromise }{@code >}} * */ @XmlElementDecl(namespace = "http://schemas.mandiant.com/2010/ioc", name = "ioc") public JAXBElement createIoc( IndicatorOfCompromise value) { return new JAXBElement(_Ioc_QNAME, IndicatorOfCompromise.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link IocTermList }{@code >}} * */ @XmlElementDecl(namespace = "http://schemas.mandiant.com/2010/ioc", name = "ioctermlist") public JAXBElement createIoctermlist(IocTermList value) { return new JAXBElement(_Ioctermlist_QNAME, IocTermList.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link MetricList }{@code >}} * */ @XmlElementDecl(namespace = "http://schemas.mandiant.com/2010/ioc", name = "metrics") public JAXBElement createMetrics(MetricList value) { return new JAXBElement(_Metrics_QNAME, MetricList.class, null, value); } /** * 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, ObjectFactory.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 ObjectFactory instance for XML String * * @param text * XML String for the document * @return The ObjectFactory instance for the passed XML String */ public static ObjectFactory fromXMLString(String text) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(ObjectFactory.class .getPackage().getName()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(STIXSchema.getInstance().getSchema()); unmarshaller.setEventHandler(new ValidationEventHandler()); StreamSource streamSource = new StreamSource(new StringReader(text)); return (ObjectFactory) unmarshaller.unmarshal(streamSource); } catch (JAXBException e) { throw new RuntimeException(e); } } /** * Validates the XML representation of this ObjectFactory 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