ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/core LogLevel.java
Date Sat, 29 Dec 2001 21:24:08 GMT
donaldp     01/12/29 13:24:08

  Added:       proposal/myrmidon/src/java/org/apache/antlib/core
                        LogLevel.java
  Log:
  A a class to hold enums for the level at which to log.
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/core/LogLevel.java
  
  Index: LogLevel.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.antlib.core;
  
  import java.util.HashMap;
  import java.util.Set;
  import org.apache.avalon.framework.Enum;
  
  /**
   * Type safe Enum for Log Levels.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   */
  public final class LogLevel
      extends Enum
  {
      //Map for all the levels
      private static final HashMap c_levels = new HashMap();
  
      //standard enums for version of JVM
      public final static LogLevel FATAL_ERROR = new LogLevel( "fatalError" );
      public final static LogLevel ERROR = new LogLevel( "error" );
      public final static LogLevel WARN = new LogLevel( "warn" );
      public final static LogLevel INFO = new LogLevel( "info" );
      public final static LogLevel DEBUG = new LogLevel( "debug" );
  
      /**
       * Retrieve the log level for the specified name.
       *
       * @param name the name of the LogLevel object to retrieve
       * @returns The LogLevel for specified name or null
       */
      public static LogLevel getByName( final String name )
      {
          return (LogLevel)c_levels.get( name );
      }
  
      /**
       * Retrieve the names of all the LogLevels.
       *
       * @returns The names of all the LogLevels
       */
      public static String[] getNames( )
      {
          final Set keys = c_levels.keySet();
          return (String[])keys.toArray( new String[ keys.size() ] );
      }
  
      /**
       * Private constructor so no instance except here can be defined.
       *
       * @param name the name of Log Level
       */
      private LogLevel( final String name )
      {
          super( name, c_levels );
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message