Interface EntityPropertiesService


  • public interface EntityPropertiesService
    This provides the entity system with a way to access properties (and then exposes this to others via the developer helper service)
    Author:
    Aaron Zeckoski (azeckoski @ gmail.com)
    • Method Detail

      • getLocale

        Locale getLocale()
        Returns:
        the current Locale for the current session or user
      • loadProperties

        void loadProperties​(String prefix,
                            String baseName,
                            ClassLoader classLoader)
        Register the properties in this ClassLoader for this entity prefix
        Parameters:
        prefix - an entity prefix
        baseName - (optional) the part before the .properties or _en.properties, example: location/dir/myentity.properties, if null then prefix is used
        classLoader - (optional) the ClassLoader to find the properties files in, if null then the default thread ClassLoader is used
      • unloadProperties

        boolean unloadProperties​(String prefix)
        Unregister the properties stored for this prefix
        Parameters:
        prefix - an entity prefix
        Returns:
        true if unregistered, false if none found to unregister
      • getProperty

        String getProperty​(String prefix,
                           String key)
        Get a property for an entity if one is available, uses the default Locale
        Parameters:
        prefix - an entity prefix
        key - the property key
        Returns:
        the property value string OR null if none found
      • getProperty

        String getProperty​(String prefix,
                           String key,
                           Locale locale)
        Get a property for an entity if one is available
        Parameters:
        prefix - an entity prefix
        key - the property key
        locale - the Locale to get the message for
        Returns:
        the property value string OR null if none found
      • getProperty

        String getProperty​(String prefix,
                           String key,
                           Locale locale,
                           String defaultValue)
        Get a property for an entity if one is available
        Parameters:
        prefix - an entity prefix
        key - the property key
        locale - the Locale to get the message for
        defaultValue - the default value to return if the value is null
        Returns:
        the property value string OR defaultValue if none found