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 classQDLConvert.GetAttributesclassQDLConvert.HOCONExportclassQDLConvert.HOCONImportclassQDLConvert.IniExportclassQDLConvert.IniImportstatic classQDLConvert.MyStemStack<V extends QDLStem>classQDLConvert.QDLExportclassQDLConvert.QDLImportclassQDLConvert.SampleclassQDLConvert.SnarfclassQDLConvert.XMLExportclassQDLConvert.XMLImportclassQDLConvert.YAMLExportclassQDLConvert.YAMLImport
-
Field Summary
Fields Modifier and Type Field Description static StringARG_FILEstatic StringARG_IGNORE_COMMENTSstatic StringARG_IGNORE_WHITESPACEstatic StringARG_IMPORT_LEVELstatic StringARG_VALIDATEstatic StringATTRIBUTE_CAPUTstatic StringATTRIBUTE_KEYstatic StringCDATA_KEYstatic StringCOMMENT_KEYstatic StringDECLARATION_KEYstatic StringDOC_CAPUTstatic StringDTD_TYPE_KEYstatic StringENTITY_KEYstatic StringGET_ATTR_NAMEstatic StringHOCON_EXPORT_NAMEstatic StringHOCON_IMPORT_NAMEstatic StringINI_INstatic StringINI_OUTstatic StringPROCESSING_IfNSTRUCTION_KEYstatic StringQDL_EXPORT_NAMEstatic StringQDL_IMPORT_NAMEstatic StringSNARF_NAMEstatic StringTEXT_KEYstatic StringXML_EXPORT_NAMEstatic intXML_IMPORT_LEVEL_ATTRstatic intXML_IMPORT_LEVEL_COMMENTSstatic intXML_IMPORT_LEVEL_EXACTstatic intXML_IMPORT_LEVEL_FLATTENstatic StringXML_IMPORT_NAMEstatic StringYAML_EXPORT_NAMEstatic StringYAML_IMPORT_NAME
-
Constructor Summary
Constructors Constructor Description QDLConvert()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeserializeFromJSON(net.sf.json.JSONObject json)protected QDLStemdoSnarf(QDLStem inStem)Starts the recursion.protected StringgetFileArg(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 booleanisProperty(Object obj)static voidmain(String[] args)protected booleanrejectKey(Object key)net.sf.json.JSONObjectserializeToJSON()Send back a serialization of internal state for this object.protected ObjectsnarfList(QDLList list, boolean glomStringsTogether)protected ObjectsnarfNode(QDLStem stem, boolean glomText)Process end stem.protected StringxmlEscape(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:QDLMetaModuleSend 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:
serializeToJSONin interfaceQDLMetaModule- Returns:
-
deserializeFromJSON
public void deserializeFromJSON(net.sf.json.JSONObject json)
- Specified by:
deserializeFromJSONin interfaceQDLMetaModule
-
-