From 45929ed2f639c304cea95128c80c855633908fda Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sat, 12 Jan 2002 23:40:09 +0000 Subject: [PATCH] Use LogLevel and thus remove the need for VerbosityLevelChoices git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270699 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/taskdefs/Recorder.java | 19 +++++--------- .../ant/taskdefs/VerbosityLevelChoices.java | 26 ------------------- .../apache/tools/ant/taskdefs/Recorder.java | 19 +++++--------- .../ant/taskdefs/VerbosityLevelChoices.java | 26 ------------------- 4 files changed, 14 insertions(+), 76 deletions(-) delete mode 100644 proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java delete mode 100644 proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java index 309558aa1..f1873dfa5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java @@ -15,6 +15,7 @@ import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; +import org.apache.antlib.core.LogLevel; /** * This task is the manager for RecorderEntry's. It is this class that holds all @@ -87,30 +88,25 @@ public class Recorder * @param level The new Loglevel value * @see VerbosityLevelChoices */ - public void setLoglevel( final VerbosityLevelChoices level ) + public void setLoglevel( final LogLevel level ) { //I hate cascading if/elseif clauses !!! - String lev = level.getValue(); - if( lev.equalsIgnoreCase( "error" ) ) + if( LogLevel.ERROR == level ) { loglevel = Project.MSG_ERR; } - else if( lev.equalsIgnoreCase( "warn" ) ) + else if( LogLevel.WARN == level ) { loglevel = Project.MSG_WARN; } - else if( lev.equalsIgnoreCase( "info" ) ) + else if( LogLevel.INFO == level ) { loglevel = Project.MSG_INFO; } - else if( lev.equalsIgnoreCase( "verbose" ) ) + else if( LogLevel.DEBUG == level ) { loglevel = Project.MSG_VERBOSE; } - else if( lev.equalsIgnoreCase( "debug" ) ) - { - loglevel = Project.MSG_DEBUG; - } } /** @@ -193,7 +189,6 @@ public class Recorder outputStream = new FileOutputStream( name, m_append.booleanValue() ); } - final PrintStream out = new PrintStream( outputStream ); - return out; + return new PrintStream( outputStream ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java deleted file mode 100644 index 15170406c..000000000 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.tools.ant.taskdefs; - -import org.apache.tools.ant.types.EnumeratedAttribute; - -/** - * A list of possible values for the setLoglevel() method. - * Possible values include: error, warn, info, verbose, debug. - */ -public class VerbosityLevelChoices - extends EnumeratedAttribute -{ - private final static String[] values = - {"error", "warn", "info", "verbose", "debug"}; - - public String[] getValues() - { - return values; - } -} diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java index 309558aa1..f1873dfa5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java @@ -15,6 +15,7 @@ import java.util.Hashtable; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; +import org.apache.antlib.core.LogLevel; /** * This task is the manager for RecorderEntry's. It is this class that holds all @@ -87,30 +88,25 @@ public class Recorder * @param level The new Loglevel value * @see VerbosityLevelChoices */ - public void setLoglevel( final VerbosityLevelChoices level ) + public void setLoglevel( final LogLevel level ) { //I hate cascading if/elseif clauses !!! - String lev = level.getValue(); - if( lev.equalsIgnoreCase( "error" ) ) + if( LogLevel.ERROR == level ) { loglevel = Project.MSG_ERR; } - else if( lev.equalsIgnoreCase( "warn" ) ) + else if( LogLevel.WARN == level ) { loglevel = Project.MSG_WARN; } - else if( lev.equalsIgnoreCase( "info" ) ) + else if( LogLevel.INFO == level ) { loglevel = Project.MSG_INFO; } - else if( lev.equalsIgnoreCase( "verbose" ) ) + else if( LogLevel.DEBUG == level ) { loglevel = Project.MSG_VERBOSE; } - else if( lev.equalsIgnoreCase( "debug" ) ) - { - loglevel = Project.MSG_DEBUG; - } } /** @@ -193,7 +189,6 @@ public class Recorder outputStream = new FileOutputStream( name, m_append.booleanValue() ); } - final PrintStream out = new PrintStream( outputStream ); - return out; + return new PrintStream( outputStream ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java deleted file mode 100644 index 15170406c..000000000 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/VerbosityLevelChoices.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.tools.ant.taskdefs; - -import org.apache.tools.ant.types.EnumeratedAttribute; - -/** - * A list of possible values for the setLoglevel() method. - * Possible values include: error, warn, info, verbose, debug. - */ -public class VerbosityLevelChoices - extends EnumeratedAttribute -{ - private final static String[] values = - {"error", "warn", "info", "verbose", "debug"}; - - public String[] getValues() - { - return values; - } -}