Class Library


  • public class Library
    extends java.lang.Object
    Represent the scope of ZK libraries. Unlike System, the scope of Library depends how ZK libraries are installed. If they are installed in WEB-INF/lib of a ZK application, the scope is the application. In other words, the library properties (setProperty(java.lang.String, java.lang.String)) are shared by the application only.

    On the other hand, if ZK libraries are installed in a folder shared by all applications, the library properties are shared by all applications.

    Since:
    3.0.7
    Author:
    tomyeh
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.String> addProperties​(java.lang.String key, java.util.List<java.lang.String> values)
      Add library properties indicated by the specified key.
      static java.util.List<java.lang.String> addProperty​(java.lang.String key, java.lang.String value)
      Add a library property indicated by the specified key.
      static int getIntProperty​(java.lang.String key, int defVal)
      Parses the property value to an integer.
      static java.util.List<java.lang.String> getProperties​(java.lang.String key)
      Returns the library properties indicated by the specified key.
      static java.lang.String getProperty​(java.lang.String key)
      Returns the library property indicated by the specified key.
      static java.lang.String getProperty​(java.lang.String key, java.lang.String def)
      Returns the library property indicated by the specified key.
      static java.util.List<java.lang.String> setProperties​(java.lang.String key, java.util.List<java.lang.String> values)
      Sets the library properties indicated by the specified key.
      static java.lang.String setProperty​(java.lang.String key, java.lang.String value)
      Sets the library property indicated by the specified key.
      • Methods inherited from class java.lang.Object

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

      • getProperty

        public static java.lang.String getProperty​(java.lang.String key)
        Returns the library property indicated by the specified key. If no such library property, this method will call System.getProperty(java.lang.String) to look for a system property.

        The library property is shared by Java codes that access the same set of ZK libraries, since it is actually a static member of this class. Thus, if ZK libraries (including this class) are installed in WEB-INF/lib of an application, the library properties are accessible only in the application.

        Note: unlike System.getProperty(java.lang.String), this method won't throw SecurityException.

        Returns:
        the string value of the library property, or the system property, or null if no such property.
        See Also:
        setProperty(java.lang.String, java.lang.String)
      • getProperty

        public static java.lang.String getProperty​(java.lang.String key,
                                                   java.lang.String def)
        Returns the library property indicated by the specified key. If no such library property, this method will call System.getProperty(java.lang.String) to look for a system property.

        Note: unlike System.getProperty(java.lang.String), this method won't throw SecurityException.

        Parameters:
        key - the name of the library property
        def - a default value.
        Throws:
        java.lang.NullPointerException - if key is null
        java.lang.IllegalArgumentException - if key is empty
      • setProperty

        public static java.lang.String setProperty​(java.lang.String key,
                                                   java.lang.String value)
        Sets the library property indicated by the specified key.
        Returns:
        the previous value of the library property, or null if it did not have one.
        Throws:
        java.lang.NullPointerException - if key is null
        java.lang.IllegalArgumentException - if key is empty
        See Also:
        getProperty(java.lang.String)
      • getIntProperty

        public static int getIntProperty​(java.lang.String key,
                                         int defVal)
        Parses the property value to an integer. If the specified value is not an integer, the default value is returned (and a warning is logged).
        Parameters:
        defVal - the default value
        Since:
        3.6.1
      • addProperty

        public static java.util.List<java.lang.String> addProperty​(java.lang.String key,
                                                                   java.lang.String value)
        Add a library property indicated by the specified key.
        Returns:
        the previous value of the library properties, or null if it did not have any.
        Throws:
        java.lang.NullPointerException - if key is null
        java.lang.IllegalArgumentException - if key is empty
        See Also:
        getProperties(java.lang.String)
      • addProperties

        public static java.util.List<java.lang.String> addProperties​(java.lang.String key,
                                                                     java.util.List<java.lang.String> values)
        Add library properties indicated by the specified key.
        Returns:
        the previous value of the library properties, or null if it did not have any.
        Throws:
        java.lang.NullPointerException - if key is null
        java.lang.IllegalArgumentException - if key is empty
        See Also:
        getProperties(java.lang.String)
      • setProperties

        public static java.util.List<java.lang.String> setProperties​(java.lang.String key,
                                                                     java.util.List<java.lang.String> values)
        Sets the library properties indicated by the specified key.
        Returns:
        the previous value of the library properties, or null if it did not have any.
        Throws:
        java.lang.NullPointerException - if key is null
        java.lang.IllegalArgumentException - if key is empty
        See Also:
        getProperties(java.lang.String)
      • getProperties

        public static java.util.List<java.lang.String> getProperties​(java.lang.String key)
        Returns the library properties indicated by the specified key.

        The library properties is shared by Java codes that access the same set of ZK libraries, since it is actually a static member of this class. Thus, if ZK libraries (including this class) are installed in WEB-INF/lib of an application, the library properties are accessible only in the application.

        Returns:
        the List of values of the library properties, or null if no such property.
        See Also:
        setProperties(java.lang.String, java.util.List<java.lang.String>)