Class CompositeFactory

java.lang.Object
org.libreoffice.ide.eclipse.core.model.CompositeFactory

public final class CompositeFactory extends Object
This 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 Details

    • CompositeFactory

      public CompositeFactory()
  • Method Details

    • createTypeFile

      public static IUnoComposite createTypeFile(String fullName, IUnoidlProject project)
      Creates a file node from the fully qualified name of the type which should be described inside.
      Parameters:
      fullName - is the fully qualified name of the type described in the file to create (eg: org::libreoffice::foo)
      project - is the uno project in which to add the type.
      Returns:
      a Uno composite representing a file, or null if the fullName is null or an empty string
    • createFile

      public static IUnoComposite createFile(org.eclipse.core.resources.IFile filehandle)
      Creates a Uno composite representing a file from its filename.
      Parameters:
      filehandle - the relative filename
      Returns:
      a Uno composite of FILE type
      See Also:
    • createFileContent

      public static IUnoComposite createFileContent(String fullname)
      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:
      fullname - the type fully qualified name (eg: org::foo)
      Returns:
      a uno composite representing the file content
    • createInclude

      public static IUnoComposite createInclude(String fullName)
      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 file foo/XFoo.idl will be returned. The resulting include line is always in <, > characters.

      Parameters:
      fullName - the fully qualified name of the type to include
      Returns:
      a parametrized uno composite
    • createModuleDir

      public static IUnoComposite createModuleDir(String fullName, IUnoidlProject project)
      Creates a Uno composite directory.
      Parameters:
      fullName - is the fully qualified name of the module to create (eg: org::libreoffice::foo)
      project - is the unoidl project in which to generate the module
      Returns:
      a Uno composite directory.
    • createModuleSpace

      public static IUnoComposite createModuleSpace(String name)
      Creates a simple module namespace use.

      For example, the produced text for the "foo" module name will be the following:

       module foo { };
       

      Parameters:
      name - is the module name (eg foo)
      Returns:
      the uno composite corresponding to the module.
    • createModulesSpaces

      public static IUnoComposite createModulesSpaces(String fullName)
      Simple convenient method calling createModuleSpace(String) to create cascading modules namespaces.
      Parameters:
      fullName - 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(String name, boolean isPublished, String interfaceFullName)
      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:
      name - is the service name
      isPublished - true if the module is a published one.
      interfaceFullName - is the interface inheritance fully qualified name
      Returns:
      the created service composite
      See Also:
    • createService

      public static IUnoComposite createService(String name, boolean isPublished)
      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:
      name - is the service name
      isPublished - true if the module is a published one.
      Returns:
      the created service composite
      See Also:
    • createService

      public static IUnoComposite createService(String name)
      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:
      name - is the service name
      Returns:
      the created service composite
      See Also:
    • createInterface

      public static IUnoComposite createInterface(String name, boolean isPublished, String[] parentIntfNames)
      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:
      name - is the name of the interface (eg: foo)
      isPublished - true if the interface is published
      parentIntfNames - array of all the mandatory parent interfaces
      Returns:
      a uno composite representing an interface declaration
      See Also:
    • createInterfaceInheritance

      public static IUnoComposite createInterfaceInheritance(String name, boolean optional)
      Creates a UNO composite representing an interface inheritance.

      The generated text is formatted as following:

       \t[[optional] ]interface inheritance::name;\n
       

      Parameters:
      name - the fully qualified name of the interface to inherit from
      optional - true if the interface is optional
      Returns:
      a UNO composite
    • createAttribute

      public static IUnoComposite createAttribute(String name, String type, String flags)
      Creates an interface attribute.
      Parameters:
      name - the attribute name
      type - the type of the attribute
      flags - the well-formatted string of flags.
      Returns:
      the attribute UNO composite
    • createMethod

      public static IUnoComposite createMethod(String name, String type)
      Creates an interface method.
      Parameters:
      name - the method name
      type - the method return type
      Returns:
      the UNO composite representing the method
      See Also:
    • createMethodArgument

      public static IUnoComposite createMethodArgument(String name, String type, String direction)
      Create a method argument to be added to a method UNO composite.
      Parameters:
      name - the argument name
      type - the argument type
      direction - the argument direction among in, out, inout.
      Returns:
      the UNO composite representing the parameter