xml.metadatasharing.ObjectFactory Maven / Gradle / Ivy
Show all versions of stix Show documentation
/**
* 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 xml.metadatasharing;
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.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;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the xml.metadatasharing 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 {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: xml.metadatasharing
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link MalwareMetaData }
*
*/
public MalwareMetaData createMalwareMetaData() {
return new MalwareMetaData();
}
/**
* Create an instance of {@link TaggantObject }
*
*/
public TaggantObject createTaggantObject() {
return new TaggantObject();
}
/**
* Create an instance of {@link FieldDataEntry }
*
*/
public FieldDataEntry createFieldDataEntry() {
return new FieldDataEntry();
}
/**
* Create an instance of {@link Relationship }
*
*/
public Relationship createRelationship() {
return new Relationship();
}
/**
* Create an instance of {@link ObjectProperty }
*
*/
public ObjectProperty createObjectProperty() {
return new ObjectProperty();
}
/**
* Create an instance of {@link FileObject }
*
*/
public FileObject createFileObject() {
return new FileObject();
}
/**
* Create an instance of {@link ClassificationObject }
*
*/
public ClassificationObject createClassificationObject() {
return new ClassificationObject();
}
/**
* Create an instance of {@link SoftwarePackageObject }
*
*/
public SoftwarePackageObject createSoftwarePackageObject() {
return new SoftwarePackageObject();
}
/**
* Create an instance of {@link DigitalSignatureObject }
*
*/
public DigitalSignatureObject createDigitalSignatureObject() {
return new DigitalSignatureObject();
}
/**
* Create an instance of {@link MalwareMetaData.Objects }
*
*/
public MalwareMetaData.Objects createMalwareMetaDataObjects() {
return new MalwareMetaData.Objects();
}
/**
* Create an instance of {@link MalwareMetaData.ObjectProperties }
*
*/
public MalwareMetaData.ObjectProperties createMalwareMetaDataObjectProperties() {
return new MalwareMetaData.ObjectProperties();
}
/**
* Create an instance of {@link MalwareMetaData.Relationships }
*
*/
public MalwareMetaData.Relationships createMalwareMetaDataRelationships() {
return new MalwareMetaData.Relationships();
}
/**
* Create an instance of {@link MalwareMetaData.FieldData }
*
*/
public MalwareMetaData.FieldData createMalwareMetaDataFieldData() {
return new MalwareMetaData.FieldData();
}
/**
* Create an instance of {@link IPObject }
*
*/
public IPObject createIPObject() {
return new IPObject();
}
/**
* Create an instance of {@link DomainObject }
*
*/
public DomainObject createDomainObject() {
return new DomainObject();
}
/**
* Create an instance of {@link Reference }
*
*/
public Reference createReference() {
return new Reference();
}
/**
* Create an instance of {@link ASNObject }
*
*/
public ASNObject createASNObject() {
return new ASNObject();
}
/**
* Create an instance of {@link Property }
*
*/
public Property createProperty() {
return new Property();
}
/**
* Create an instance of {@link RegistryObject }
*
*/
public RegistryObject createRegistryObject() {
return new RegistryObject();
}
/**
* Create an instance of {@link UriObject }
*
*/
public UriObject createUriObject() {
return new UriObject();
}
/**
* Create an instance of {@link EntityObject }
*
*/
public EntityObject createEntityObject() {
return new EntityObject();
}
/**
* Create an instance of {@link IPAddress }
*
*/
public IPAddress createIPAddress() {
return new IPAddress();
}
/**
* Create an instance of {@link TaggantObject.SigningTimestamp }
*
*/
public TaggantObject.SigningTimestamp createTaggantObjectSigningTimestamp() {
return new TaggantObject.SigningTimestamp();
}
/**
* Create an instance of {@link FieldDataEntry.References }
*
*/
public FieldDataEntry.References createFieldDataEntryReferences() {
return new FieldDataEntry.References();
}
/**
* Create an instance of {@link FieldDataEntry.Volume }
*
*/
public FieldDataEntry.Volume createFieldDataEntryVolume() {
return new FieldDataEntry.Volume();
}
/**
* Create an instance of {@link FieldDataEntry.Location }
*
*/
public FieldDataEntry.Location createFieldDataEntryLocation() {
return new FieldDataEntry.Location();
}
/**
* Create an instance of {@link Relationship.Source }
*
*/
public Relationship.Source createRelationshipSource() {
return new Relationship.Source();
}
/**
* Create an instance of {@link Relationship.Target }
*
*/
public Relationship.Target createRelationshipTarget() {
return new Relationship.Target();
}
/**
* Create an instance of {@link ObjectProperty.References }
*
*/
public ObjectProperty.References createObjectPropertyReferences() {
return new ObjectProperty.References();
}
/**
* Create an instance of {@link FileObject.ExtraHash }
*
*/
public FileObject.ExtraHash createFileObjectExtraHash() {
return new FileObject.ExtraHash();
}
/**
* Create an instance of {@link ClassificationObject.ClassificationDetails }
*
*/
public ClassificationObject.ClassificationDetails createClassificationObjectClassificationDetails() {
return new ClassificationObject.ClassificationDetails();
}
/**
* Create an instance of {@link SoftwarePackageObject.CPEname }
*
*/
public SoftwarePackageObject.CPEname createSoftwarePackageObjectCPEname() {
return new SoftwarePackageObject.CPEname();
}
/**
* Create an instance of {@link DigitalSignatureObject.SigningTimestamp }
*
*/
public DigitalSignatureObject.SigningTimestamp createDigitalSignatureObjectSigningTimestamp() {
return new DigitalSignatureObject.SigningTimestamp();
}
/**
* 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
*/
public boolean validate() {
return STIXSchema.getInstance().validate(toXMLString());
}
}