Class CompositeFactory
- java.lang.Object
-
- org.libreoffice.ide.eclipse.core.model.CompositeFactory
-
public final class CompositeFactory extends java.lang.ObjectThis class provides static methods to generate well-formed uno composites. Thus there is no need to know how to create them to use them.Note: This class has to be extended to add new UNO-IDL code generation.
-
-
Constructor Summary
Constructors Constructor Description CompositeFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IUnoCompositecreateAttribute(java.lang.String pName, java.lang.String pType, java.lang.String pFlags)Creates an interface attribute.static IUnoCompositecreateFile(org.eclipse.core.resources.IFile pFilehandle)Creates a Uno composite representing a file from its filename.static IUnoCompositecreateFileContent(java.lang.String pFullname)Creates a uno composite representing the file content skeleton from the type name it should contain.static IUnoCompositecreateInclude(java.lang.String pFullName)Creates a Uno composite representing an include line.static IUnoCompositecreateInterface(java.lang.String pName, boolean pIsPublished, java.lang.String[] pParentIntfNames)Creates a Uno composite corresponding to an interface with its mandatory parent interfaces.static IUnoCompositecreateInterfaceInheritance(java.lang.String pName, boolean pOptional)Creates a UNO composite representing an interface inheritance.static IUnoCompositecreateMethod(java.lang.String pName, java.lang.String pType)Creates an interface method.static IUnoCompositecreateMethodArgument(java.lang.String pName, java.lang.String pType, java.lang.String pDirection)Create a method argument to be added to a method UNO composite.static IUnoCompositecreateModuleDir(java.lang.String pFullName, IUnoidlProject pProject)Creates a Uno composite directory.static IUnoCompositecreateModuleSpace(java.lang.String pName)Creates a simple module namespace use.static IUnoCompositecreateModulesSpaces(java.lang.String pFullName)Simple convenient method callingcreateModuleSpace(String)to create cascading modules namespaces.static IUnoCompositecreateService(java.lang.String pName)Creates a default very basic service declaration only using the name and not published.static IUnoCompositecreateService(java.lang.String pName, boolean pIsPublished)Creates a service declaration text with the default interface.static IUnoCompositecreateService(java.lang.String pName, boolean pIsPublished, java.lang.String pInterfaceFullName)Creates a UNO composite representing a UNO service with an interface inheritance.static IUnoCompositecreateTypeFile(java.lang.String pFullName, IUnoidlProject pProject)Creates a file node from the fully qualified name of the type which should be described inside.
-
-
-
Method Detail
-
createTypeFile
public static IUnoComposite createTypeFile(java.lang.String pFullName, IUnoidlProject pProject)
Creates a file node from the fully qualified name of the type which should be described inside.- Parameters:
pFullName- is the fully qualified name of the type described in the file to create (eg:org::libreoffice::foo)pProject- is the uno project in which to add the type.- Returns:
- a Uno composite representing a file, or
nullif the fullName is null or an empty string
-
createFile
public static IUnoComposite createFile(org.eclipse.core.resources.IFile pFilehandle)
Creates a Uno composite representing a file from its filename.- Parameters:
pFilehandle- the relative filename- Returns:
- a Uno composite of FILE type
- See Also:
for file creation from Type name
-
createFileContent
public static IUnoComposite createFileContent(java.lang.String pFullname)
Creates a uno composite representing the file content skeleton from the type name it should contain. All the file contents has to be added in this composite.The produced result will be of the following form:
#ifndef __define_name_idl__ #define __define_name_idl__ [...] #endif
- Parameters:
pFullname- the type fully qualified name (eg:org::foo)- Returns:
- a uno composite representing the file content
-
createInclude
public static IUnoComposite createInclude(java.lang.String pFullName)
Creates a Uno composite representing an include line. It uses the type's fully qualified name to recompose the file name. It supposes that the type is contained in a file of it's name.If the method is called with the type
foo::XFoo, the filefoo/XFoo.idlwill be returned. The resulting include line is always in <, > characters.- Parameters:
pFullName- the fully qualified name of the type to include- Returns:
- a parametrized uno composite
-
createModuleDir
public static IUnoComposite createModuleDir(java.lang.String pFullName, IUnoidlProject pProject)
Creates a Uno composite directory.- Parameters:
pFullName- is the fully qualified name of the module to create (eg:org::libreoffice::foo)pProject- is the unoidl project in which to generate the module- Returns:
- a Uno composite directory.
-
createModuleSpace
public static IUnoComposite createModuleSpace(java.lang.String pName)
Creates a simple module namespace use.For example, the produced text for the "foo" module name will be the following:
module foo { };- Parameters:
pName- is the module name (egfoo)- Returns:
- the uno composite corresponding to the module.
-
createModulesSpaces
public static IUnoComposite createModulesSpaces(java.lang.String pFullName)
Simple convenient method callingcreateModuleSpace(String)to create cascading modules namespaces.- Parameters:
pFullName- is the fully qualified name of the module to create (eg:org::libreoffice::foo)- Returns:
- the top-most composite corresponding to the top-most module
-
createService
public static IUnoComposite createService(java.lang.String pName, boolean pIsPublished, java.lang.String pInterfaceFullName)
Creates a UNO composite representing a UNO service with an interface inheritance.The text produced by this method corresponds to the following one
\n[published ]service NAME : INTERFACE { [...] };- Parameters:
pName- is the service namepIsPublished-trueif the module is a published one.pInterfaceFullName- is the interface inheritance fully qualified name- Returns:
- the created service composite
- See Also:
to get all the module declarations,for optional interface inheritance,for a very basic service creation method
-
createService
public static IUnoComposite createService(java.lang.String pName, boolean pIsPublished)
Creates a service declaration text with the default interface. This one doesn't need to be mentioned in order to be used by UNO:com::sun::star::uno::XInterface.The text produced by this method corresponds to the following one
[published ]service NAME { [...] };- Parameters:
pName- is the service namepIsPublished-trueif the module is a published one.- Returns:
- the created service composite
- See Also:
to get all the module declarations,for complex service creation method,for a very basic service creation method
-
createService
public static IUnoComposite createService(java.lang.String pName)
Creates a default very basic service declaration only using the name and not published.The text produced by this method corresponds to the following one
service NAME { [...] };- Parameters:
pName- is the service name- Returns:
- the created service composite
- See Also:
to get all the module declarations,for complex service creation method,for a basic service creation method that lets specify if th service is published or not.
-
createInterface
public static IUnoComposite createInterface(java.lang.String pName, boolean pIsPublished, java.lang.String[] pParentIntfNames)
Creates a Uno composite corresponding to an interface with its mandatory parent interfaces.This method returns two kind of texts depending on the number of parent interfaces name in the array. The first writing is used when there is only one parent interface:
[published ]interface name [: parent::name ]{ [...] };The other way is used when there are more than one parent interfaces:
\n[published ]interface name { [[optional] ]interface parent::name; // for each parent [...] };- Parameters:
pName- is the name of the interface (eg:foo)pIsPublished-trueif the interface is publishedpParentIntfNames- array of all the mandatory parent interfaces- Returns:
- a uno composite representing an interface declaration
- See Also:
for the interfaces inheritances. This method should be called for each new interface to add or for optional interfaces. It is used in this method thought.
-
createInterfaceInheritance
public static IUnoComposite createInterfaceInheritance(java.lang.String pName, boolean pOptional)
Creates a UNO composite representing an interface inheritance.The generated text is formatted as following:
\t[[optional] ]interface inheritance::name;\n
- Parameters:
pName- the fully qualified name of the interface to inherit frompOptional-trueif the interface is optional- Returns:
- a UNO composite
-
createAttribute
public static IUnoComposite createAttribute(java.lang.String pName, java.lang.String pType, java.lang.String pFlags)
Creates an interface attribute.- Parameters:
pName- the attribute namepType- the type of the attributepFlags- the well-formatted string of flags.- Returns:
- the attribute UNO composite
-
createMethod
public static IUnoComposite createMethod(java.lang.String pName, java.lang.String pType)
Creates an interface method.- Parameters:
pName- the method namepType- the method return type- Returns:
- the UNO composite representing the method
- See Also:
for informations on how to add parameters to the method
-
createMethodArgument
public static IUnoComposite createMethodArgument(java.lang.String pName, java.lang.String pType, java.lang.String pDirection)
Create a method argument to be added to a method UNO composite.- Parameters:
pName- the argument namepType- the argument typepDirection- the argument direction amongin,out,inout.- Returns:
- the UNO composite representing the parameter
-
-