Class LocalizedMessage

    • Constructor Detail

      • LocalizedMessage

        public LocalizedMessage​(String resource,
                                String id)
                         throws NullPointerException
        Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.
        Parameters:
        resource - base name of the resource file
        id - the id of the corresponding bundle in the resource file
        Throws:
        NullPointerException - if resource or id is null
      • LocalizedMessage

        public LocalizedMessage​(String resource,
                                String id,
                                String encoding)
                         throws NullPointerException,
                                UnsupportedEncodingException
        Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.
        Parameters:
        resource - base name of the resource file
        id - the id of the corresponding bundle in the resource file
        encoding - the encoding of the resource file
        Throws:
        NullPointerException - if resource or id is null
        UnsupportedEncodingException - if the encoding is not supported
      • LocalizedMessage

        public LocalizedMessage​(String resource,
                                String id,
                                Object[] arguments)
                         throws NullPointerException
        Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.
        Parameters:
        resource - base name of the resource file
        id - the id of the corresponding bundle in the resource file
        arguments - an array containing the arguments for the message
        Throws:
        NullPointerException - if resource or id is null
      • LocalizedMessage

        public LocalizedMessage​(String resource,
                                String id,
                                String encoding,
                                Object[] arguments)
                         throws NullPointerException,
                                UnsupportedEncodingException
        Constructs a new LocalizedMessage using resource as the base name for the RessourceBundle and id as the message bundle id the resource file.
        Parameters:
        resource - base name of the resource file
        id - the id of the corresponding bundle in the resource file
        encoding - the encoding of the resource file
        arguments - an array containing the arguments for the message
        Throws:
        NullPointerException - if resource or id is null
        UnsupportedEncodingException - if the encoding is not supported
    • Method Detail

      • getEntry

        public String getEntry​(String key,
                               Locale loc,
                               TimeZone timezone)
                        throws MissingEntryException
        Reads the entry id + "." + key from the resource file and returns a formated message for the given Locale and TimeZone.
        Parameters:
        key - second part of the entry id
        loc - the used Locale
        timezone - the used TimeZone
        Returns:
        a Strng containing the localized message
        Throws:
        MissingEntryException - if the resource file is not available or the entry does not exist.
      • setFilter

        public void setFilter​(Filter filter)
        Sets the Filter that is used to filter the arguments of this message
        Parameters:
        filter - the Filter to use. null to disable filtering.
      • getFilter

        public Filter getFilter()
        Returns the current filter.
        Returns:
        the current filter
      • setClassLoader

        public void setClassLoader​(ClassLoader loader)
        Set the ClassLoader which loads the resource files. If it is set to null then the default ClassLoader is used.
        Parameters:
        loader - the ClassLoader which loads the resource files
      • getClassLoader

        public ClassLoader getClassLoader()
        Returns the ClassLoader which loads the resource files or null if the default ClassLoader is used.
        Returns:
        the ClassLoader which loads the resource files
      • getId

        public String getId()
        Returns the id of the message in the resource bundle.
        Returns:
        the id of the message
      • getResource

        public String getResource()
        Returns the name of the resource bundle for this message
        Returns:
        name of the resource file
      • getArguments

        public Object[] getArguments()
        Returns an Object[] containing the message arguments.
        Returns:
        the message arguments
      • setExtraArgument

        public void setExtraArgument​(Object extraArg)
        Parameters:
        extraArg -
      • setExtraArguments

        public void setExtraArguments​(Object[] extraArgs)
        Parameters:
        extraArgs -
      • getExtraArgs

        public Object[] getExtraArgs()
        Returns: