Class PolyglotProperties.PolyglotPropertiesFactory

    • Method Detail

      • getFilenameExtensions

        public java.lang.String[] getFilenameExtensions()
        Returns the filename extensions of the ResourcePropertiesFactory in the given order.
        Specified by:
        getFilenameExtensions in interface org.refcodes.mixin.FilenameExtensionsAccessor
      • toProperties

        public ResourceProperties toProperties​(java.lang.Class<?> aResourceClass,
                                               java.lang.String aFilePath,
                                               org.refcodes.runtime.ConfigLocator aConfigLocator,
                                               char... aDelimiters)
                                        throws java.io.IOException,
                                               java.text.ParseException
        Loads the properties from the given file's path. A provided ConfigLocator describes the locations to additional crawl for the desired file. Finally (if nothing else succeeds) the properties are loaded by the provided class's class loader which takes care of loading the properties (in case the file path is a relative path, also the absolute path with a prefixed path delimiter "/" is probed).
        Specified by:
        toProperties in interface ResourcePropertiesFactory
        Parameters:
        aResourceClass - The class which's class loader is to take care of loading the properties (from inside a JAR).
        aFilePath - The file path of the class's resources from which to load the properties.
        aConfigLocator - The ConfigLocator describes the locations to additional crawl for the desired file.
        aDelimiters - The path delimiters to be used when parsing the source's properties.
        Returns:
        The accordingly constructed ResourceProperties.
        Throws:
        java.io.IOException - thrown in case accessing or processing the properties file failed.
        java.text.ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      • toProperties

        public ResourceProperties toProperties​(java.io.File aFile,
                                               org.refcodes.runtime.ConfigLocator aConfigLocator,
                                               char... aDelimiters)
                                        throws java.io.IOException,
                                               java.text.ParseException
        Loads or seeks the properties from the given File. A provided ConfigLocator describes the locations to additional crawl for the desired file.
        Specified by:
        toProperties in interface ResourcePropertiesFactory
        Parameters:
        aFile - The File from which to load the properties.
        aConfigLocator - The ConfigLocator describes the locations to additional crawl for the desired file.
        aDelimiters - The path delimiters to be used when parsing the source's properties.
        Returns:
        The accordingly constructed ResourceProperties.
        Throws:
        java.io.IOException - thrown in case accessing or processing the properties file failed.
        java.text.ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      • toProperties

        public ResourceProperties toProperties​(java.io.InputStream aInputStream,
                                               char... aDelimiters)
                                        throws java.io.IOException,
                                               java.text.ParseException
        Reads the properties from the given InputStream.
        Specified by:
        toProperties in interface ResourcePropertiesFactory
        Parameters:
        aInputStream - The InputStream from which to read the properties.
        aDelimiters - The path delimiters to be used when parsing the source's properties.
        Returns:
        The accordingly constructed ResourceProperties.
        Throws:
        java.io.IOException - thrown in case accessing or processing the properties file failed.
        java.text.ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      • toProperties

        public ResourceProperties toProperties​(java.lang.Object aObj)
        Will return ResourceProperties created by the first added ResourcePropertiesFactory instance. Create a ResourceProperties instance containing the elements as of PathMap.MutablePathMap.insert(Object) using the path delimiter "/" (Delimiter.PATH) for the path declarations: "Inspects the given object and adds all elements found in the given object. Elements of type Map, Collection and arrays are identified and handled as of their type: The path for each value in a Map is appended with its according key. The path for each value in a Collection or array is appended with its according index of occurrence (in case of a List or an array, its actual index). In case of reflection, the path for each member is appended with its according mamber's name. All elements (e.g. the members and values) are inspected recursively which results in the according paths of the terminating values."
        Specified by:
        toProperties in interface ResourcePropertiesFactory
        Parameters:
        aObj - The object from which the elements are to be added.
        Returns:
        The accordingly constructed ResourceProperties.
      • toProperties

        public ResourceProperties toProperties​(java.lang.String aFilePath,
                                               org.refcodes.runtime.ConfigLocator aConfigLocator,
                                               char... aDelimiters)
                                        throws java.io.IOException,
                                               java.text.ParseException
        Loads the properties from the given file's path. A provided ConfigLocator describes the locations to additional crawl for the desired file.
        Specified by:
        toProperties in interface ResourcePropertiesFactory
        Parameters:
        aFilePath - The path to the file from which to load the properties.
        aConfigLocator - The ConfigLocator describes the locations to additional crawl for the desired file.
        aDelimiters - The path delimiters to be used when parsing the source's properties.
        Returns:
        The accordingly constructed ResourceProperties.
        Throws:
        java.io.IOException - thrown in case accessing or processing the properties file failed.
        java.text.ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      • toProperties

        public ResourceProperties toProperties​(java.net.URL aUrl,
                                               char... aDelimiters)
                                        throws java.io.IOException,
                                               java.text.ParseException
        Loads the properties from the given URL.
        Specified by:
        toProperties in interface ResourcePropertiesFactory
        Parameters:
        aUrl - The URL from which to read the properties.
        aDelimiters - The path delimiters to be used when parsing the source's properties.
        Returns:
        The accordingly constructed ResourceProperties.
        Throws:
        java.io.IOException - thrown in case accessing or processing the properties file failed.
        java.text.ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      • toByteArray

        public static byte[] toByteArray​(java.io.InputStream aInputStream)
                                  throws java.io.IOException
        Converts a byte array from an InputStream.
        Parameters:
        aInputStream - The InputStream to be converted.
        Returns:
        The byte array from the InputStream.
        Throws:
        java.io.IOException - Thrown in case there were problems reading the InputStream.