public interface IUnoComposite
Their goal is to provide a simple tree structure to generate UNO-IDL files. A Uno composite could be of several types:
COMPOSITE_TYPE_NOTSET: the type isn't set (very bad)COMPOSITE_TYPE_FILE: the node is representing a fileCOMPOSITE_TYPE_FOLDER: the node is representing a directoryCOMPOSITE_TYPE_TEXT: The node is representing a piece of textThe logical use of a UNO composite will respect the following steps:
| Modifier and Type | Field and Description |
|---|---|
static int |
COMPOSITE_TYPE_FILE
configures the composite as a file.
|
static int |
COMPOSITE_TYPE_FOLDER
configures the composite as a folder.
|
static int |
COMPOSITE_TYPE_NOTSET |
static int |
COMPOSITE_TYPE_TEXT
configures the composite as a UNO-IDL object with a textual representation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(IUnoComposite pChild)
adds a child to the node.
|
void |
configure(java.util.Hashtable<java.lang.String,java.lang.Object> pProperties,
java.lang.String pTemplate)
set the node for a COMPOSITE_TYPE_TEXT only.
|
void |
configure(java.lang.String pFilename)
sets the
COMPOSITE_TYPE_FILE or COMPOSITE_TYPE_FOLDER filename. |
void |
create(boolean pForce)
creates the file or folder with its non-existing parents.
|
void |
dispose()
Release the references held by the object.
|
IUnoComposite[] |
getChildren()
return all the node children if any.
|
int |
getType()
returns the type of the composite.
|
void |
removeAll()
Removes all the children nodes.
|
void |
setChildrenSeparator(java.lang.String pSeparator)
defines the string which has to be inserted between two children.
|
void |
setIndented(boolean pToIndent)
sets whether the output string of the text composite will be indented or not.
|
void |
setType(int pType)
sets the type of the composite.
|
java.lang.String |
toString()
returns the string representation of the node is it has a textual representation.
|
static final int COMPOSITE_TYPE_NOTSET
static final int COMPOSITE_TYPE_FILE
static final int COMPOSITE_TYPE_FOLDER
static final int COMPOSITE_TYPE_TEXT
void dispose()
IUnoComposite[] getChildren()
void addChild(IUnoComposite pChild)
pChild - the child to addvoid removeAll()
void setType(int pType)
COMPOSITE_TYPE_* types.
This method can be called only once to avoid strange reconfigurations of the node. Moreover, it should be called first to setup the node before to set the properties or template. Any other operation done with the type unset will be simply ignored.
Please note that a COMPOSITE_TYPE_TEXT node can only contain COMPOSITE_TYPE_TEXT
children. Otherwise they won't be taken into account for the node toString() execution.
pType - the COMPOSITE_TYPE_XXX type of the nodeint getType()
COMPOSITE_TYPE_* types.void configure(java.util.Hashtable<java.lang.String,java.lang.Object> pProperties,
java.lang.String pTemplate)
The template is a string where \n is the end of line, and the properties are written using the form
${prop_name}. The property name has to correspond to one of the properties given in attribute,
otherwises the empty string will be used instead. The special property ${children} will be replaced
by the children toString() result
Example of template:
module ${name} { ${children}
};
Example of properties associated:
pProperties - properties table. The name is associated to the value.pTemplate - the string template used in the toString() method.void configure(java.lang.String pFilename)
COMPOSITE_TYPE_FILE or COMPOSITE_TYPE_FOLDER filename.
There is no need to have a very deep folder and file tree, because only one will be sufficient to create all the parents.
pFilename - the composite filename.void setIndented(boolean pToIndent)
COMPOSITE_TYPE_TEXTpToIndent - true will add indentation.void setChildrenSeparator(java.lang.String pSeparator)
pSeparator - the separator to add between the childrenvoid create(boolean pForce)
throws java.lang.Exception
pForce - true let the method overwrite the existing file if needed.java.lang.Exception - If there is any problem during the file or folder creationjava.lang.String toString()
toString in class java.lang.Object