Class CompositeFactory


  • public final class CompositeFactory
    extends java.lang.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.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static IUnoComposite createAttribute​(java.lang.String pName, java.lang.String pType, java.lang.String pFlags)
      Creates an interface attribute.
      static IUnoComposite createFile​(org.eclipse.core.resources.IFile pFilehandle)
      Creates a Uno composite representing a file from its filename.
      static IUnoComposite createFileContent​(java.lang.String pFullname)
      Creates a uno composite representing the file content skeleton from the type name it should contain.
      static IUnoComposite createInclude​(java.lang.String pFullName)
      Creates a Uno composite representing an include line.
      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.
      static IUnoComposite createInterfaceInheritance​(java.lang.String pName, boolean pOptional)
      Creates a UNO composite representing an interface inheritance.
      static IUnoComposite createMethod​(java.lang.String pName, java.lang.String pType)
      Creates an interface method.
      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.
      static IUnoComposite createModuleDir​(java.lang.String pFullName, IUnoidlProject pProject)
      Creates a Uno composite directory.
      static IUnoComposite createModuleSpace​(java.lang.String pName)
      Creates a simple module namespace use.
      static IUnoComposite createModulesSpaces​(java.lang.String pFullName)
      Simple convenient method calling createModuleSpace(String) to create cascading modules namespaces.
      static IUnoComposite createService​(java.lang.String pName)
      Creates a default very basic service declaration only using the name and not published.
      static IUnoComposite createService​(java.lang.String pName, boolean pIsPublished)
      Creates a service declaration text with the default interface.
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CompositeFactory

        public CompositeFactory()
    • 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 null if 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 file foo/XFoo.idl will 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 (eg foo)
        Returns:
        the uno composite corresponding to the module.
      • createModulesSpaces

        public static IUnoComposite createModulesSpaces​(java.lang.String pFullName)
        Simple convenient method calling createModuleSpace(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 name
        pIsPublished - true if 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 name
        pIsPublished - true if 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
      • 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 - true if the interface is published
        pParentIntfNames - 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 from
        pOptional - true if 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 name
        pType - the type of the attribute
        pFlags - the well-formatted string of flags.
        Returns:
        the attribute UNO composite
      • 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 name
        pType - the argument type
        pDirection - the argument direction among in, out, inout.
        Returns:
        the UNO composite representing the parameter