Uploaded image for project: 'Openfire'
  1. Openfire
  2. OF-1189

Get enum value from JiveGlobals

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.0
    • Component/s: None
    • Labels:
      None

      Description

      Openfire should have a generic function to replace boiler plate code like this:

      public static TypeOfNumber getTonProperty( String name, TypeOfNumber defaultValue )
      {
          final String value = JiveGlobals.getProperty( name );
          if ( value == null || value.isEmpty() )
          {
              return defaultValue;
          }
      
          try
          {
              return TypeOfNumber.valueOf( value );
          }
          catch ( RuntimeException e )
          {
              Log.warn( "Unable to parse property '{}' value '{}' as a TypeOfNumber. Returning default value '{}'.", value, name, defaultValue, e );
              return defaultValue;
          }
      }
      

        Attachments

          Activity

            People

            Assignee:
            guus Guus der Kinderen
            Reporter:
            guus Guus der Kinderen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: