public class TempJavaFragmentFiles extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
TempJavaFragmentFiles(JavaFileInfoTranslator fileInfo)
Creates an instance of temporary java code fragment.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
addCurNodeInfoInParentTempFile(org.onosproject.yang.compiler.datamodel.YangNode curNode,
boolean isList,
org.onosproject.yang.compiler.utils.io.YangPluginConfig config)
Adds current node info as and attribute to the parent generated file.
|
protected static void |
addCurNodeInfoInParentTempFile(org.onosproject.yang.compiler.datamodel.YangNode curNode,
boolean isList,
org.onosproject.yang.compiler.utils.io.YangPluginConfig config,
org.onosproject.yang.compiler.datamodel.YangNode parent)
Adds current node info as and attribute to a specified parent generated
file.
|
protected void |
addCurNodeLeavesInfoToTempFiles(org.onosproject.yang.compiler.datamodel.YangNode curNode,
org.onosproject.yang.compiler.utils.io.YangPluginConfig config)
Adds all the leaves in the current data model node as part of the
generated temporary file.
|
protected String |
addDefaultConstructor(String modifier,
String toAppend,
boolean suffix)
Adds default constructor for class.
|
protected void |
addGeneratedTempFile(int flags)
Adds to the flag-set for generated temp files.
|
protected void |
addGetterImpl(JavaAttributeInfo attr)
Adds getter method's impl for class.
|
protected void |
addParentInfoInCurNodeTempFile(org.onosproject.yang.compiler.datamodel.YangNode curNode,
org.onosproject.yang.compiler.utils.io.YangPluginConfig config)
Adds parent's info to current node import list.
|
protected void |
addValueLeafFlag(org.onosproject.yang.compiler.utils.io.YangPluginConfig config,
org.onosproject.yang.compiler.datamodel.YangNode node)
Adds value leaf flag to temp files.
|
protected void |
appendToFile(File file,
String data)
Appends content to temporary file.
|
void |
freeTemporaryResources(boolean errorOccurred)
Removes all temporary file handles.
|
void |
generateJavaFile(int fileType,
org.onosproject.yang.compiler.datamodel.YangNode curNode)
Constructs java code exit.
|
File |
getAddToListImplTempFileHandle()
Returns temp file handle for add to list impl.
|
File |
getAddToListInterfaceTempFileHandle()
Returns temp file handle for add to list interface.
|
File |
getAttributesTempFileHandle()
Returns attribute's temporary file handle.
|
static JavaAttributeInfo |
getCurNodeAsAttributeInTarget(org.onosproject.yang.compiler.datamodel.YangNode curNode,
org.onosproject.yang.compiler.datamodel.YangNode targetNode,
boolean listNode,
TempJavaFragmentFiles tempFiles)
Creates an attribute info object corresponding to a data model node
and return it.
|
File |
getEditContentTempFileHandle()
Returns temp file for edit content file.
|
File |
getEqualsImplTempFileHandle()
Returns equals method's temporary file handle.
|
File |
getFromStringImplTempFileHandle()
Returns from string method's temporary file handle.
|
protected String |
getGeneratedJavaClassName()
Retrieves the mapped Java class name.
|
protected int |
getGeneratedJavaFiles()
Returns the generated Java files.
|
protected int |
getGeneratedTempFiles()
Returns the flag-set for generated temp files.
|
File |
getGetterImplTempFileHandle()
Returns getter method's impl's temporary file handle.
|
File |
getGetterInterfaceTempFileHandle()
Returns getter methods's temporary file handle.
|
File |
getHashCodeImplTempFileHandle()
Returns hash code method's temporary file handle.
|
protected boolean |
getIsQualifiedAccessOrAddToImportList(org.onosproject.yang.compiler.datamodel.javadatamodel.JavaQualifiedTypeInfo importInfo)
Returns if the attribute needs to be accessed in a qualified manner or
not, if it needs to be imported, then the same needs to be done.
|
protected String |
getJavaClassName(String suffix)
Returns JAVA class name for non implementation classes.
|
JavaExtendsListHolder |
getJavaExtendsListHolder()
Returns java extends list holder.
|
File |
getJavaFileHandle(String fileName)
Returns a temporary file handle for the specific file type.
|
protected JavaFileInfoTranslator |
getJavaFileInfo()
Returns the generated java file information.
|
JavaImportData |
getJavaImportData()
Retrieves the import data for the generated Java file.
|
File |
getLeafIdAttributeTempFileHandle()
Returns temp file handle for leaf identifier attributes.
|
static List<JavaAttributeInfo> |
getListOfAttributesForKey(org.onosproject.yang.compiler.datamodel.YangNode curNode)
Returns list of java attribute for keys of list node.
|
File |
getSetterImplTempFileHandle()
Returns setter method's impl's temporary file handle.
|
File |
getSetterInterfaceTempFileHandle()
Returns setter method's temporary file handle.
|
String |
getTemporaryDataFromFileHandle(File file,
String absolutePath)
Returns data from the temporary files.
|
protected File |
getTemporaryFileHandle(String fileName)
Returns a temporary file handle for the specific file type.
|
File |
getToStringImplTempFileHandle()
Returns to string method's temporary file handle.
|
protected boolean |
isAttributePresent()
Retrieves the status of any attributes added.
|
protected String |
parseAttribute(JavaAttributeInfo attr)
Parses attribute to get the attribute string.
|
protected void |
setAbsoluteDirPath(String absoluteDirPath)
Sets absolute path where the file needs to be generated.
|
void |
setAttrNode(org.onosproject.yang.compiler.datamodel.YangNode attrNode)
Sets attribute's node.
|
protected void |
setJavaExtendsListHolder(JavaExtendsListHolder holder)
Sets java extends list holder.
|
protected void |
setJavaFileInfo(JavaFileInfoTranslator javaFileInfo)
Sets the generated java file information.
|
protected void |
setJavaImportData(JavaImportData data)
Sets import data for the generated Java file.
|
protected TempJavaFragmentFiles(JavaFileInfoTranslator fileInfo) throws IOException
fileInfo - generated java file informationIOException - when fails to create new file handleprotected static void addCurNodeInfoInParentTempFile(org.onosproject.yang.compiler.datamodel.YangNode curNode,
boolean isList,
org.onosproject.yang.compiler.utils.io.YangPluginConfig config)
throws IOException
curNode - current nodeisList - is list constructconfig - plugin configurationsIOException - IO operation exceptionprotected static void addCurNodeInfoInParentTempFile(org.onosproject.yang.compiler.datamodel.YangNode curNode,
boolean isList,
org.onosproject.yang.compiler.utils.io.YangPluginConfig config,
org.onosproject.yang.compiler.datamodel.YangNode parent)
throws IOException
curNode - current nodeisList - is list constructconfig - plugin configurationsparent - parent nodeIOException - IO operation exceptionpublic static JavaAttributeInfo getCurNodeAsAttributeInTarget(org.onosproject.yang.compiler.datamodel.YangNode curNode, org.onosproject.yang.compiler.datamodel.YangNode targetNode, boolean listNode, TempJavaFragmentFiles tempFiles)
curNode - current nodetargetNode - target nodelistNode - flag indicating if a node is a list nodetempFiles - temp java fragment filespublic static List<JavaAttributeInfo> getListOfAttributesForKey(org.onosproject.yang.compiler.datamodel.YangNode curNode) throws IOException
curNode - current list nodeIOException - when fails to do IO operationsprotected void setAbsoluteDirPath(String absoluteDirPath)
absoluteDirPath - absolute path where the file needs to be
generatedprotected JavaFileInfoTranslator getJavaFileInfo()
protected void setJavaFileInfo(JavaFileInfoTranslator javaFileInfo)
javaFileInfo - generated java file informationprotected int getGeneratedTempFiles()
protected void addGeneratedTempFile(int flags)
flags - generated temp files flag-setprotected int getGeneratedJavaFiles()
protected String getGeneratedJavaClassName()
public JavaImportData getJavaImportData()
protected void setJavaImportData(JavaImportData data)
data - import data for the generated Java fileprotected boolean isAttributePresent()
public File getGetterInterfaceTempFileHandle()
public File getSetterInterfaceTempFileHandle()
public File getSetterImplTempFileHandle()
public File getFromStringImplTempFileHandle()
public File getAttributesTempFileHandle()
public File getGetterImplTempFileHandle()
public File getHashCodeImplTempFileHandle()
public File getEqualsImplTempFileHandle()
public File getToStringImplTempFileHandle()
public JavaExtendsListHolder getJavaExtendsListHolder()
protected void setJavaExtendsListHolder(JavaExtendsListHolder holder)
holder - java extends list holderprotected void addGetterImpl(JavaAttributeInfo attr) throws IOException
attr - attribute infoIOException - when fails to append to temporary fileprotected String addDefaultConstructor(String modifier, String toAppend, boolean suffix) throws IOException
modifier - modifier for constructortoAppend - string which need to be appended with the class namesuffix - is value need to be appended as suffixIOException - when fails to append to fileprotected File getTemporaryFileHandle(String fileName) throws IOException
fileName - file nameIOException - when fails to create new file handlepublic File getJavaFileHandle(String fileName) throws IOException
fileName - file nameIOException - when fails to create new file handlepublic String getTemporaryDataFromFileHandle(File file, String absolutePath) throws IOException
file - temporary file handleabsolutePath - absolute pathIOException - when failed to get data from the given fileprotected String parseAttribute(JavaAttributeInfo attr)
attr - attribute infoprotected void appendToFile(File file, String data) throws IOException
file - temporary filedata - data to be appendedIOException - when fails to append to fileprotected void addParentInfoInCurNodeTempFile(org.onosproject.yang.compiler.datamodel.YangNode curNode,
org.onosproject.yang.compiler.utils.io.YangPluginConfig config)
curNode - current nodeconfig - plugin configurationsprotected void addCurNodeLeavesInfoToTempFiles(org.onosproject.yang.compiler.datamodel.YangNode curNode,
org.onosproject.yang.compiler.utils.io.YangPluginConfig config)
throws IOException
curNode - current nodeconfig - plugin configIOException - IO operation failprotected void addValueLeafFlag(org.onosproject.yang.compiler.utils.io.YangPluginConfig config,
org.onosproject.yang.compiler.datamodel.YangNode node)
throws IOException
config - YANG plugin confignode - YANG nodeIOException - IO exceptionprotected String getJavaClassName(String suffix)
suffix - for the class name based on the file typepublic void generateJavaFile(int fileType,
org.onosproject.yang.compiler.datamodel.YangNode curNode)
throws IOException
fileType - generated file typecurNode - current YANG nodeIOException - when fails to generate java filespublic void freeTemporaryResources(boolean errorOccurred)
throws IOException
errorOccurred - flag indicating if error occurredIOException - when failed to delete the temporary filesprotected boolean getIsQualifiedAccessOrAddToImportList(org.onosproject.yang.compiler.datamodel.javadatamodel.JavaQualifiedTypeInfo importInfo)
importInfo - import infopublic File getAddToListInterfaceTempFileHandle()
public File getAddToListImplTempFileHandle()
public File getLeafIdAttributeTempFileHandle()
public File getEditContentTempFileHandle()
public void setAttrNode(org.onosproject.yang.compiler.datamodel.YangNode attrNode)
attrNode - attribute's nodeCopyright © 2018. All rights reserved.