Package org.qdl_lang.extensions.convert
Class QDLConvert
- java.lang.Object
-
- org.qdl_lang.extensions.convert.QDLConvert
-
- All Implemented Interfaces:
Serializable
,QDLMetaModule
public class QDLConvert extends Object implements QDLMetaModule
Created by Jeff Gaynor
on 2/13/23 at 7:33 AM- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
QDLConvert.GetAttributes
class
QDLConvert.HOCONExport
class
QDLConvert.HOCONImport
class
QDLConvert.IniExport
class
QDLConvert.IniImport
static class
QDLConvert.MyStemStack<V extends QDLStem>
class
QDLConvert.QDLExport
class
QDLConvert.QDLImport
class
QDLConvert.Sample
class
QDLConvert.Snarf
class
QDLConvert.XMLExport
class
QDLConvert.XMLImport
class
QDLConvert.YAMLExport
class
QDLConvert.YAMLImport
-
Field Summary
Fields Modifier and Type Field Description static String
ARG_FILE
static String
ARG_IGNORE_COMMENTS
static String
ARG_IGNORE_WHITESPACE
static String
ARG_IMPORT_LEVEL
static String
ARG_VALIDATE
static String
ATTRIBUTE_CAPUT
static String
ATTRIBUTE_KEY
static String
CDATA_KEY
static String
COMMENT_KEY
static String
DECLARATION_KEY
static String
DOC_CAPUT
static String
DTD_TYPE_KEY
static String
ENTITY_KEY
static String
GET_ATTR_NAME
static String
HOCON_EXPORT_NAME
static String
HOCON_IMPORT_NAME
static String
INI_IN
static String
INI_OUT
static String
PROCESSING_IfNSTRUCTION_KEY
static String
QDL_EXPORT_NAME
static String
QDL_IMPORT_NAME
static String
SNARF_NAME
static String
TEXT_KEY
static String
XML_EXPORT_NAME
static int
XML_IMPORT_LEVEL_ATTR
static int
XML_IMPORT_LEVEL_COMMENTS
static int
XML_IMPORT_LEVEL_EXACT
static int
XML_IMPORT_LEVEL_FLATTEN
static String
XML_IMPORT_NAME
static String
YAML_EXPORT_NAME
static String
YAML_IMPORT_NAME
-
Constructor Summary
Constructors Constructor Description QDLConvert()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deserializeFromJSON(net.sf.json.JSONObject json)
protected QDLStem
doSnarf(QDLStem inStem)
Starts the recursion.protected String
getFileArg(Object object, State state, String name)
This will look into the object if it is a stem or string and determine if there is a file to import.protected boolean
isProperty(Object obj)
static void
main(String[] args)
protected boolean
rejectKey(Object key)
net.sf.json.JSONObject
serializeToJSON()
Send back a serialization of internal state for this object.protected Object
snarfList(QDLList list, boolean glomStringsTogether)
protected Object
snarfNode(QDLStem stem, boolean glomText)
Process end stem.protected String
xmlEscape(String s)
Replace characters in a string by their XML analogs.
-
-
-
Field Detail
-
XML_IMPORT_NAME
public static final String XML_IMPORT_NAME
- See Also:
- Constant Field Values
-
XML_EXPORT_NAME
public static final String XML_EXPORT_NAME
- See Also:
- Constant Field Values
-
XML_IMPORT_LEVEL_FLATTEN
public static final int XML_IMPORT_LEVEL_FLATTEN
- See Also:
- Constant Field Values
-
XML_IMPORT_LEVEL_ATTR
public static final int XML_IMPORT_LEVEL_ATTR
- See Also:
- Constant Field Values
-
XML_IMPORT_LEVEL_COMMENTS
public static final int XML_IMPORT_LEVEL_COMMENTS
- See Also:
- Constant Field Values
-
XML_IMPORT_LEVEL_EXACT
public static final int XML_IMPORT_LEVEL_EXACT
- See Also:
- Constant Field Values
-
DOC_CAPUT
public static final String DOC_CAPUT
- See Also:
- Constant Field Values
-
ATTRIBUTE_KEY
public static final String ATTRIBUTE_KEY
- See Also:
- Constant Field Values
-
CDATA_KEY
public static final String CDATA_KEY
- See Also:
- Constant Field Values
-
TEXT_KEY
public static final String TEXT_KEY
- See Also:
- Constant Field Values
-
ATTRIBUTE_CAPUT
public static final String ATTRIBUTE_CAPUT
- See Also:
- Constant Field Values
-
DECLARATION_KEY
public static final String DECLARATION_KEY
- See Also:
- Constant Field Values
-
DTD_TYPE_KEY
public static final String DTD_TYPE_KEY
- See Also:
- Constant Field Values
-
PROCESSING_IfNSTRUCTION_KEY
public static final String PROCESSING_IfNSTRUCTION_KEY
- See Also:
- Constant Field Values
-
COMMENT_KEY
public static final String COMMENT_KEY
- See Also:
- Constant Field Values
-
ENTITY_KEY
public static final String ENTITY_KEY
- See Also:
- Constant Field Values
-
INI_OUT
public static final String INI_OUT
- See Also:
- Constant Field Values
-
INI_IN
public static final String INI_IN
- See Also:
- Constant Field Values
-
ARG_FILE
public static final String ARG_FILE
- See Also:
- Constant Field Values
-
ARG_IGNORE_COMMENTS
public static final String ARG_IGNORE_COMMENTS
- See Also:
- Constant Field Values
-
ARG_VALIDATE
public static final String ARG_VALIDATE
- See Also:
- Constant Field Values
-
ARG_IGNORE_WHITESPACE
public static final String ARG_IGNORE_WHITESPACE
- See Also:
- Constant Field Values
-
ARG_IMPORT_LEVEL
public static final String ARG_IMPORT_LEVEL
- See Also:
- Constant Field Values
-
GET_ATTR_NAME
public static String GET_ATTR_NAME
-
SNARF_NAME
public static final String SNARF_NAME
- See Also:
- Constant Field Values
-
YAML_IMPORT_NAME
public static String YAML_IMPORT_NAME
-
YAML_EXPORT_NAME
public static String YAML_EXPORT_NAME
-
HOCON_IMPORT_NAME
public static String HOCON_IMPORT_NAME
-
HOCON_EXPORT_NAME
public static String HOCON_EXPORT_NAME
-
QDL_IMPORT_NAME
public static String QDL_IMPORT_NAME
-
QDL_EXPORT_NAME
public static String QDL_EXPORT_NAME
-
-
Method Detail
-
isProperty
protected boolean isProperty(Object obj)
-
doSnarf
protected QDLStem doSnarf(QDLStem inStem)
Starts the recursion. Every XML document has a single root element- Parameters:
inStem
-- Returns:
-
snarfNode
protected Object snarfNode(QDLStem stem, boolean glomText)
Process end stem. This is typically of the form [lines]~{properties}- Parameters:
stem
-glomText
- return text lines as a single string.- Returns:
-
rejectKey
protected boolean rejectKey(Object key)
-
getFileArg
protected String getFileArg(Object object, State state, String name)
This will look into the object if it is a stem or string and determine if there is a file to import. This is used by all of the imports. The resulting string will be the content to import.- Parameters:
object
-state
-name
-- Returns:
-
xmlEscape
protected String xmlEscape(String s)
Replace characters in a string by their XML analogs. result is a legal string for the XML document.- Parameters:
s
-- Returns:
-
serializeToJSON
public net.sf.json.JSONObject serializeToJSON()
Description copied from interface:QDLMetaModule
Send back a serialization of internal state for this object. This allows for the state you choose to be serialized and then reloaded.NOTE
There is no canonical form for this. Set it how you will and deserialize it accordingly.- Specified by:
serializeToJSON
in interfaceQDLMetaModule
- Returns:
-
deserializeFromJSON
public void deserializeFromJSON(net.sf.json.JSONObject json)
- Specified by:
deserializeFromJSON
in interfaceQDLMetaModule
-
-