Package jade.core

Class Specifier


  • public class Specifier
    extends Object
    This class represent a specifier and collects a name, a className, and an array of arguments. Profile specifiers are used to describe several kinds of complex information when configuring JADE (e.g. MTPs to install, agents to start up, kernel services to activate). The general string format for a specifier is

    name:className(separated arglist)

    The separated argument list uses a separator character that can be configured when invoking parsing-related utility methods.
    Author:
    LEAP
    • Constructor Detail

      • Specifier

        public Specifier()
    • Method Detail

      • setName

        public void setName​(String n)
        Set the name for this specifier object.
        Parameters:
        n - The name to give to this specifier.
      • getName

        public String getName()
        Retrieve the name for this specifier object.
        Returns:
        The name of the specifier, if one was set, or null otherwise.
      • setClassName

        public void setClassName​(String cn)
        Set the name of the class of this specifier.
        Parameters:
        cn - The class name to assign to the specifier object.
      • getClassName

        public String getClassName()
        Retrieve the class name of this specifier.
        Returns:
        The class name of the specifier, if one was set, or null otherwise.
      • setArgs

        public void setArgs​(Object[] a)
        Set the argument list for this specifier object.
        Parameters:
        a - An object array containing the argument list for this specifier.
      • getArgs

        public Object[] getArgs()
        Retrieve the argument list for this specifier.
        Returns:
        An object array containing the argument list, if one was set, or null otherwise.
      • toString

        public String toString()
        This method is used by Boot, ProfileImpl, and RMA in order to have a String representation of this Specifier according to the format name:className(arg1,arg2,argn)
        Overrides:
        toString in class Object
        Returns:
        A string representation of this specifier, according to the format above.
      • getArgSeparator

        public static char getArgSeparator()
      • getEscapeChar

        public static Character getEscapeChar()
      • parseSpecifierList

        public static Vector parseSpecifierList​(String specsLine)
                                         throws Exception
        This static utility method can parse the string representation of a list of specifiers. The general format of a specifier is used, with a comma as argument separator, i.e.:

        name:className(comma-separated arglist)

        While comma is the separator character within a specifier arguments, the semicolon is used to separate the different specifiers in the list.
        Parameters:
        specsLine - The string containing the representation of the specifier list, according to the format above.
        Returns:
        A vector containing the parsed specifiers.
        Throws:
        Exception
      • encodeSpecifierList

        public static String encodeSpecifierList​(Vector v)
        This static utility method produces a string representation of a list of Specifier objects.
      • parseList

        public static final Vector parseList​(String list,
                                             char delimiter)
      • encodeList

        public static String encodeList​(Vector v,
                                        char delimiter)
      • parseSpecifier

        public static Specifier parseSpecifier​(String specString,
                                               char argsDelimiter)
                                        throws Exception
        Utility method that parses a stringified object specifier in the form

        name:className(separated arglist)

        a Specifier object. Both the name and the list of arguments are optional.
        Parameters:
        specString - A string containing the representation of the specifier, according to the format above.
        argsDelimiter - The character to use as a delimiter within the argument list.
        Returns:
        A specifier object, built according to the parsed information.
        Throws:
        Exception