Class CreateNamespacesCmd

  • All Implemented Interfaces:
    Command

    public class CreateNamespacesCmd
    extends java.lang.Object
    implements Command
    This class attempts to create a namespace for each token in the provided string. Thus, when providing a namespace string, do not include the name of anything other than namespaces, such as the name of a symbol.

    Example strings:

    • global::child1::child2
    • child1

    To view the assumptions for creating namespaces from a path string, see the NamespaceUtils class.

    Since:
    Tracker Id 619
    See Also:
    NamespaceUtils
    • Constructor Summary

      Constructors 
      Constructor Description
      CreateNamespacesCmd​(java.lang.String namespacesString, Namespace parentNamespace, SourceType source)
      Takes a namespace string that will be parsed and the results of which will be used for creating the namespaces if they do not exist.
      CreateNamespacesCmd​(java.lang.String namespacesString, SourceType source)
      Takes a namespace string that will be parsed and the results of which will be used for creating the namespaces if they do not exist.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean applyTo​(DomainObject obj)
      Applies the command to the given domain object.
      java.lang.String getName()
      Returns the name of this command.
      Namespace getNamespace()
      Returns the newly created namespace or null if one was not created.
      java.lang.String getStatusMsg()
      Returns the status message indicating the status of the command.
      • Methods inherited from class java.lang.Object

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

      • CreateNamespacesCmd

        public CreateNamespacesCmd​(java.lang.String namespacesString,
                                   SourceType source)
        Takes a namespace string that will be parsed and the results of which will be used for creating the namespaces if they do not exist.

        Calling this constructor is equivalent to calling:

         Command command = new CreateNamespacesCmd( namespaceString, null );
         
        Parameters:
        namespacesString - The string to be parsed.
        source - the source of the namespace
        See Also:
        example format, assumptions
      • CreateNamespacesCmd

        public CreateNamespacesCmd​(java.lang.String namespacesString,
                                   Namespace parentNamespace,
                                   SourceType source)
        Takes a namespace string that will be parsed and the results of which will be used for creating the namespaces if they do not exist.
        Parameters:
        namespacesString - The string to be parsed.
        parentNamespace - The namespace to be used as the starting parent of the namespaces that will be created.
        source - the source of the namespace
        Throws:
        java.lang.NullPointerException - if namespaceString is null.
        See Also:
        example format, assumptions
    • Method Detail

      • getNamespace

        public Namespace getNamespace()
        Returns the newly created namespace or null if one was not created.
        Returns:
        the newly created namespace or null if one was not created.
      • getStatusMsg

        public java.lang.String getStatusMsg()
        Description copied from interface: Command
        Returns the status message indicating the status of the command.
        Specified by:
        getStatusMsg in interface Command
        Returns:
        reason for failure, or null if the status of the command was successful
      • getName

        public java.lang.String getName()
        Description copied from interface: Command
        Returns the name of this command.
        Specified by:
        getName in interface Command
        Returns:
        the name of this command