Add the parse method to the Level class
Review at http://gwt-code-reviews.appspot.com/640801
Review by: fredsa@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8282 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/logging/impl/LevelImpl.java b/user/src/com/google/gwt/logging/impl/LevelImpl.java
index f1a8426..3fc9eb9 100644
--- a/user/src/com/google/gwt/logging/impl/LevelImpl.java
+++ b/user/src/com/google/gwt/logging/impl/LevelImpl.java
@@ -33,6 +33,7 @@
Level info();
int intValue();
Level off();
+ Level parse(String name);
void setName(String newName);
void setValue(int newValue);
Level severe();
diff --git a/user/src/com/google/gwt/logging/impl/LevelImplNull.java b/user/src/com/google/gwt/logging/impl/LevelImplNull.java
index c202711..0cd3259 100644
--- a/user/src/com/google/gwt/logging/impl/LevelImplNull.java
+++ b/user/src/com/google/gwt/logging/impl/LevelImplNull.java
@@ -60,6 +60,10 @@
return null;
}
+ public Level parse(String name) {
+ return null;
+ }
+
public void setName(String newName) {
}
diff --git a/user/src/com/google/gwt/logging/impl/LevelImplRegular.java b/user/src/com/google/gwt/logging/impl/LevelImplRegular.java
index f2a8e30..2ae4e77 100644
--- a/user/src/com/google/gwt/logging/impl/LevelImplRegular.java
+++ b/user/src/com/google/gwt/logging/impl/LevelImplRegular.java
@@ -93,6 +93,29 @@
public Level off() {
return LevelImplRegular.OFF;
}
+
+ public Level parse(String name) {
+ if (name.equalsIgnoreCase(all().getName())) {
+ return all();
+ } else if (name.equalsIgnoreCase(config().getName())) {
+ return config();
+ } else if (name.equalsIgnoreCase(fine().getName())) {
+ return fine();
+ } else if (name.equalsIgnoreCase(finer().getName())) {
+ return finer();
+ } else if (name.equalsIgnoreCase(finest().getName())) {
+ return finest();
+ } else if (name.equalsIgnoreCase(info().getName())) {
+ return info();
+ } else if (name.equalsIgnoreCase(off().getName())) {
+ return off();
+ } else if (name.equalsIgnoreCase(severe().getName())) {
+ return severe();
+ } else if (name.equalsIgnoreCase(warning().getName())) {
+ return warning();
+ }
+ return null;
+ }
public void setName(String newName) {
name = newName;
diff --git a/user/super/com/google/gwt/emul/java/util/logging/Level.java b/user/super/com/google/gwt/emul/java/util/logging/Level.java
index 478bbbc..5129d33 100644
--- a/user/super/com/google/gwt/emul/java/util/logging/Level.java
+++ b/user/super/com/google/gwt/emul/java/util/logging/Level.java
@@ -39,6 +39,10 @@
public static Level SEVERE = staticImpl.severe();
public static Level WARNING = staticImpl.warning();
+ public static Level parse(String name) {
+ return staticImpl.parse(name);
+ }
+
private LevelImpl impl;
protected Level(String name, int value) {
@@ -61,7 +65,6 @@
}
/* Not Implemented */
- // public static Level parse(String name) {}
// public boolean equals(Object ox) {}
// protected Level(String name, int value, String resourceBundleName) {}
// public String getLocalizedName() {}