Revision: 8282
Author: [email protected]
Date: Fri Jun 18 10:49:21 2010
Log: Add the parse method to the Level class
Review at http://gwt-code-reviews.appspot.com/640801
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8282
Modified:
/trunk/user/src/com/google/gwt/logging/impl/LevelImpl.java
/trunk/user/src/com/google/gwt/logging/impl/LevelImplNull.java
/trunk/user/src/com/google/gwt/logging/impl/LevelImplRegular.java
/trunk/user/super/com/google/gwt/emul/java/util/logging/Level.java
=======================================
--- /trunk/user/src/com/google/gwt/logging/impl/LevelImpl.java Tue Jun 15
15:09:25 2010
+++ /trunk/user/src/com/google/gwt/logging/impl/LevelImpl.java Fri Jun 18
10:49:21 2010
@@ -33,6 +33,7 @@
Level info();
int intValue();
Level off();
+ Level parse(String name);
void setName(String newName);
void setValue(int newValue);
Level severe();
=======================================
--- /trunk/user/src/com/google/gwt/logging/impl/LevelImplNull.java Tue Jun
15 15:09:25 2010
+++ /trunk/user/src/com/google/gwt/logging/impl/LevelImplNull.java Fri Jun
18 10:49:21 2010
@@ -60,6 +60,10 @@
return null;
}
+ public Level parse(String name) {
+ return null;
+ }
+
public void setName(String newName) {
}
=======================================
--- /trunk/user/src/com/google/gwt/logging/impl/LevelImplRegular.java Tue
Jun 15 15:09:25 2010
+++ /trunk/user/src/com/google/gwt/logging/impl/LevelImplRegular.java Fri
Jun 18 10:49:21 2010
@@ -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;
=======================================
--- /trunk/user/super/com/google/gwt/emul/java/util/logging/Level.java Tue
Jun 15 15:09:25 2010
+++ /trunk/user/super/com/google/gwt/emul/java/util/logging/Level.java Fri
Jun 18 10:49:21 2010
@@ -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() {}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors