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

org.mitre.cybox.cybox_2.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 org.mitre.cybox.cybox_2;

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 org.mitre.cybox.cybox_2 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 _Action_QNAME = new QName( "http://cybox.mitre.org/cybox-2", "Action"); private final static QName _Object_QNAME = new QName( "http://cybox.mitre.org/cybox-2", "Object"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.mitre.cybox.cybox_2 * */ public ObjectFactory() { } /** * Create an instance of {@link ActionType } * */ public ActionType createActionType() { return new ActionType(); } /** * Create an instance of {@link Event } * */ public Event createEvent() { return new Event(); } /** * Create an instance of {@link ActionsType } * */ public ActionsType createActionsType() { return new ActionsType(); } /** * Create an instance of {@link FrequencyType } * */ public FrequencyType createFrequencyType() { return new FrequencyType(); } /** * Create an instance of {@link ObjectType } * */ public ObjectType createObjectType() { return new ObjectType(); } /** * Create an instance of {@link Observables } * */ public Observables createObservables() { return new Observables(); } /** * Create an instance of {@link Observable } * */ public Observable createObservable() { return new Observable(); } /** * Create an instance of {@link KeywordsType } * */ public KeywordsType createKeywordsType() { return new KeywordsType(); } /** * Create an instance of {@link ObservableCompositionType } * */ public ObservableCompositionType createObservableCompositionType() { return new ObservableCompositionType(); } /** * Create an instance of {@link PatternFidelityType } * */ public PatternFidelityType createPatternFidelityType() { return new PatternFidelityType(); } /** * Create an instance of {@link PoolsType } * */ public PoolsType createPoolsType() { return new PoolsType(); } /** * Create an instance of {@link PropertyPoolType } * */ public PropertyPoolType createPropertyPoolType() { return new PropertyPoolType(); } /** * Create an instance of {@link ActionArgumentType } * */ public ActionArgumentType createActionArgumentType() { return new ActionArgumentType(); } /** * Create an instance of {@link ActionRelationshipsType } * */ public ActionRelationshipsType createActionRelationshipsType() { return new ActionRelationshipsType(); } /** * Create an instance of {@link ActionPertinentObjectPropertyType } * */ public ActionPertinentObjectPropertyType createActionPertinentObjectPropertyType() { return new ActionPertinentObjectPropertyType(); } /** * Create an instance of {@link DataSentEffectType } * */ public DataSentEffectType createDataSentEffectType() { return new DataSentEffectType(); } /** * Create an instance of {@link AssociatedObjectsType } * */ public AssociatedObjectsType createAssociatedObjectsType() { return new AssociatedObjectsType(); } /** * Create an instance of {@link PropertiesEnumeratedEffectType } * */ public PropertiesEnumeratedEffectType createPropertiesEnumeratedEffectType() { return new PropertiesEnumeratedEffectType(); } /** * Create an instance of {@link ActionReferenceType } * */ public ActionReferenceType createActionReferenceType() { return new ActionReferenceType(); } /** * Create an instance of {@link ActionPertinentObjectPropertiesType } * */ public ActionPertinentObjectPropertiesType createActionPertinentObjectPropertiesType() { return new ActionPertinentObjectPropertiesType(); } /** * Create an instance of {@link EventPoolType } * */ public EventPoolType createEventPoolType() { return new EventPoolType(); } /** * Create an instance of {@link AssociatedObjectType } * */ public AssociatedObjectType createAssociatedObjectType() { return new AssociatedObjectType(); } /** * Create an instance of {@link ValuesType } * */ public ValuesType createValuesType() { return new ValuesType(); } /** * Create an instance of {@link RelatedObjectsType } * */ public RelatedObjectsType createRelatedObjectsType() { return new RelatedObjectsType(); } /** * Create an instance of {@link StateChangeEffectType } * */ public StateChangeEffectType createStateChangeEffectType() { return new StateChangeEffectType(); } /** * Create an instance of {@link ActionRelationshipType } * */ public ActionRelationshipType createActionRelationshipType() { return new ActionRelationshipType(); } /** * Create an instance of {@link RelatedObjectType } * */ public RelatedObjectType createRelatedObjectType() { return new RelatedObjectType(); } /** * Create an instance of {@link ActionArgumentsType } * */ public ActionArgumentsType createActionArgumentsType() { return new ActionArgumentsType(); } /** * Create an instance of {@link PropertiesType } * */ public PropertiesType createPropertiesType() { return new PropertiesType(); } /** * Create an instance of {@link ActionPoolType } * */ public ActionPoolType createActionPoolType() { return new ActionPoolType(); } /** * Create an instance of {@link DataWrittenEffectType } * */ public DataWrittenEffectType createDataWrittenEffectType() { return new DataWrittenEffectType(); } /** * Create an instance of {@link ObfuscationTechniqueType } * */ public ObfuscationTechniqueType createObfuscationTechniqueType() { return new ObfuscationTechniqueType(); } /** * Create an instance of {@link DataReadEffectType } * */ public DataReadEffectType createDataReadEffectType() { return new DataReadEffectType(); } /** * Create an instance of {@link DataReceivedEffectType } * */ public DataReceivedEffectType createDataReceivedEffectType() { return new DataReceivedEffectType(); } /** * Create an instance of {@link ActionAliasesType } * */ public ActionAliasesType createActionAliasesType() { return new ActionAliasesType(); } /** * Create an instance of {@link PropertyReadEffectType } * */ public PropertyReadEffectType createPropertyReadEffectType() { return new PropertyReadEffectType(); } /** * Create an instance of {@link ValuesEnumeratedEffectType } * */ public ValuesEnumeratedEffectType createValuesEnumeratedEffectType() { return new ValuesEnumeratedEffectType(); } /** * Create an instance of {@link ObfuscationTechniquesType } * */ public ObfuscationTechniquesType createObfuscationTechniquesType() { return new ObfuscationTechniquesType(); } /** * Create an instance of {@link SendControlCodeEffectType } * */ public SendControlCodeEffectType createSendControlCodeEffectType() { return new SendControlCodeEffectType(); } /** * Create an instance of {@link ObjectPoolType } * */ public ObjectPoolType createObjectPoolType() { return new ObjectPoolType(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link ActionType }{@code >}} * */ @XmlElementDecl(namespace = "http://cybox.mitre.org/cybox-2", name = "Action") public JAXBElement createAction(ActionType value) { return new JAXBElement(_Action_QNAME, ActionType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link ObjectType }{@code >}} * */ @XmlElementDecl(namespace = "http://cybox.mitre.org/cybox-2", name = "Object") public JAXBElement createObject(ObjectType value) { return new JAXBElement(_Object_QNAME, ObjectType.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