Package org.qdl_lang.extensions
Class JavaModule
- java.lang.Object
- 
- org.qdl_lang.expressions.module.Module
- 
- org.qdl_lang.extensions.JavaModule
 
 
- 
- All Implemented Interfaces:
- Serializable,- Cloneable,- XThing
 - Direct Known Subclasses:
- CryptoModule,- EGModule,- QDL509Module,- QDLCLIToolsModule,- QDLConvertModule,- QDLDBModule,- QDLDynamoDBModule,- QDLHTTPModule,- QDLMailModule,- StatefulModule
 
 public abstract class JavaModule extends Module This will let you create your own extensions to QDL in Java. Simply implement the interfacesQDLFunctionfor functions andQDLVariablefor variables, add the module and you can use it in QDL like any other module.Created by Jeff Gaynor 
 on 1/27/20 at 12:03 PM- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected List<QDLFunction>funcsprotected List<QDLVariable>vars- 
Fields inherited from class org.qdl_lang.expressions.module.ModuleFDOC_CONVERT
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description JavaModule()Used byQDLLoaderJavaModule(URI uri)protectedJavaModule(URI namespace, String alias)Deprecated.alias is no longer needed.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFunctions(List<QDLFunction> functions)voidaddVariables(List<QDLVariable> variables)List<String>createDefaultDocs()Creates the documentation from the first of each line of every function.voiddeserializeFromJSON(net.sf.json.JSONObject json, SerializationState serializationState)Deserializes a JSON object into the current module.voiddeserializeStates(net.sf.json.JSONObject jsonObject, SerializationState serializationState)This should centralize deserializing the state for a Java module.StringgetClassname()List<String>getDocumentation()List<String>getListByTag()StringgetLoaderClassName()QDLMetaModulegetMetaClass()booleanhasMetaClass()voidinit(State state)This is critical in that it puts all the functions and variables (with their correct alias) in to the state for this module.voidinit(State state, boolean doVariables)booleanisExternal()This returns true only if the module is from another language than a QDL module.net.sf.json.JSONObjectserializeToJSON(SerializationState serializationState)The result of this is a json objectvoidsetClassName(String className)voidsetDocumentation(List<String> documentation)voidsetLoaderClassName(String loaderClassName)voidsetMetaClass(QDLMetaModule metaClass)StringtoString()voidwriteExtraXMLAttributes(XMLStreamWriter xsw)Add any attributes you want to the module tag (you must read them later).- 
Methods inherited from class org.qdl_lang.expressions.module.ModulefromJSON, fromXML, fromXML, getAlias, getDescription, getId, getInheritMode, getKey, getListByTag, getMTKey, getName, getNamespace, getParentInstanceAlias, getParentInstanceID, getParentTemplateID, getState, isTemplate, isUsed, newInstance, readExtraXMLAttributes, readExtraXMLElements, setAlias, setDescription, setId, setInheritanceMode, setNamespace, setParentInstanceAlias, setParentInstanceID, setParentTemplateID, setState, setTemplate, setupModule, setUsed, toJSON, toXML, toXML, toXML2, writeExtraXMLElements
 
- 
 
- 
- 
- 
Field Detail- 
varsprotected List<QDLVariable> vars 
 - 
funcsprotected List<QDLFunction> funcs 
 
- 
 - 
Constructor Detail- 
JavaModulepublic JavaModule() Used byQDLLoader
 - 
JavaModulepublic JavaModule(URI uri) 
 - 
JavaModuleprotected JavaModule(URI namespace, String alias) Deprecated.alias is no longer needed. Just use the namespace only constructorUsed by the factory methodModule.newInstance(State)- Parameters:
- namespace-
- alias-
 
 
- 
 - 
Method Detail- 
isExternalpublic boolean isExternal() Description copied from class:ModuleThis returns true only if the module is from another language than a QDL module.- Overrides:
- isExternalin class- Module
- Returns:
 
 - 
getClassnamepublic String getClassname() 
 - 
setClassNamepublic void setClassName(String className) 
 - 
getLoaderClassNamepublic String getLoaderClassName() 
 - 
setLoaderClassNamepublic void setLoaderClassName(String loaderClassName) 
 - 
addFunctionspublic void addFunctions(List<QDLFunction> functions) 
 - 
addVariablespublic void addVariables(List<QDLVariable> variables) 
 - 
initpublic void init(State state) This is critical in that it puts all the functions and variables (with their correct alias) in to the state for this module. Normally this is called when module_import is invoked on each module, so generally you do not need to call this ever. It is, however, what makes any module work.- Parameters:
- state-
 
 - 
initpublic void init(State state, boolean doVariables) 
 - 
writeExtraXMLAttributespublic void writeExtraXMLAttributes(XMLStreamWriter xsw) throws XMLStreamException Description copied from class:ModuleAdd any attributes you want to the module tag (you must read them later).- Overrides:
- writeExtraXMLAttributesin class- Module
- Throws:
- XMLStreamException
 
 - 
serializeToJSONpublic net.sf.json.JSONObject serializeToJSON(SerializationState serializationState) throws Throwable Description copied from class:ModuleThe result of this is a json object- Overrides:
- serializeToJSONin class- Module
- Returns:
- Throws:
- Throwable
 
 - 
deserializeFromJSONpublic void deserializeFromJSON(net.sf.json.JSONObject json, SerializationState serializationState) throws ThrowableDescription copied from class:ModuleDeserializes a JSON object into the current module. You must check the type in the json object o know which class (e.g.,JavaModuleto instantiate first.- Overrides:
- deserializeFromJSONin class- Module
- Throws:
- Throwable
 
 - 
deserializeStatespublic void deserializeStates(net.sf.json.JSONObject jsonObject, SerializationState serializationState) throws ThrowableThis should centralize deserializing the state for a Java module. Hence this is public and should be called whenever this as needed.- Parameters:
- jsonObject-
- serializationState-
- Throws:
- Throwable
 
 - 
createDefaultDocspublic List<String> createDefaultDocs() Creates the documentation from the first of each line of every function. Use this or override as needed.- Specified by:
- createDefaultDocsin class- Module
- Returns:
 
 - 
getListByTagpublic List<String> getListByTag() - Specified by:
- getListByTagin class- Module
 
 - 
setDocumentationpublic void setDocumentation(List<String> documentation) - Specified by:
- setDocumentationin class- Module
 
 - 
getDocumentationpublic List<String> getDocumentation() - Specified by:
- getDocumentationin class- Module
 
 - 
getMetaClasspublic QDLMetaModule getMetaClass() 
 - 
setMetaClasspublic void setMetaClass(QDLMetaModule metaClass) 
 - 
hasMetaClasspublic boolean hasMetaClass() 
 
- 
 
-