public final class ModelHelper extends Object
model
classes.Modifier and Type | Method and Description |
---|---|
static <T extends NamedNode> |
createModelFromXml(CamelContext context,
InputStream stream,
Class<T> type)
Marshal the xml to the model definition
|
static <T extends NamedNode> |
createModelFromXml(CamelContext context,
String xml,
Class<T> type)
Marshal the xml to the model definition
|
static String |
dumpModelAsXml(CamelContext context,
NamedNode definition)
Dumps the definition as XML
|
static RoutesDefinition |
loadRoutesDefinition(CamelContext context,
InputStream inputStream)
Marshal the xml to the model definition
|
public static String dumpModelAsXml(CamelContext context, NamedNode definition) throws JAXBException
context
- the CamelContext, if null then ModelJAXBContextFactory
is not in usedefinition
- the definition, such as a NamedNode
JAXBException
- is throw if error marshalling to XMLpublic static <T extends NamedNode> T createModelFromXml(CamelContext context, String xml, Class<T> type) throws JAXBException
context
- the CamelContext, if null then ModelJAXBContextFactory
is not in usexml
- the xmltype
- the definition type to return, will throw a ClassCastException
if not the expected typeJAXBException
- is thrown if error unmarshalling from xml to modelpublic static <T extends NamedNode> T createModelFromXml(CamelContext context, InputStream stream, Class<T> type) throws JAXBException
context
- the CamelContext, if null then ModelJAXBContextFactory
is not in usestream
- the xml streamtype
- the definition type to return, will throw a ClassCastException
if not the expected typeJAXBException
- is thrown if error unmarshalling from xml to modelpublic static RoutesDefinition loadRoutesDefinition(CamelContext context, InputStream inputStream) throws Exception
context
- the CamelContext, if null then ModelJAXBContextFactory
is not in useinputStream
- the xml streamException
- is thrown if an error is encountered unmarshalling from xml to modelApache Camel