Fields Summary |
---|
private static final long | serialVersionUID |
private static final List | levels |
public static final Level | OFFThe OFF level provides no logging messages. |
public static final Level | SEVEREThe SEVERE level provides severe failure messages. |
public static final Level | WARNINGThe WARNING level provides warnings. |
public static final Level | INFOThe INFO level provides informative messages. |
public static final Level | CONFIGThe CONFIG level provides static configuration messages. |
public static final Level | FINEThe FINE level provides tracing messages. |
public static final Level | FINERThe FINER level provides more detailed tracing messages. |
public static final Level | FINESTThe FINEST level provides highly detailed tracing messages. |
public static final Level | ALLThe ALL level provides all logging messages. |
private final String | nameThe name of this Level. |
private final int | valueThe integer value indicating the level. |
private final String | resourceBundleNameThe name of the resource bundle used to localize the level name. |
private transient ResourceBundle | rbThe resource bundle associated with this level, used to localize the
level name. |
Methods Summary |
---|
public boolean | equals(java.lang.Object o)Compares two {@code Level} objects for equality. They are considered to
be equal if they have the same level value.
if (this == o) {
return true;
}
if (!(o instanceof Level)) {
return false;
}
return ((Level) o).intValue() == this.value;
|
public java.lang.String | getLocalizedName()Gets the localized name of this level. The default locale is used. If no
resource bundle is associated with this level then the original level
name is returned.
if (rb == null) {
return name;
}
try {
return rb.getString(name);
} catch (MissingResourceException e) {
return name;
}
|
public java.lang.String | getName()Gets the name of this level.
return this.name;
|
public java.lang.String | getResourceBundleName()Gets the name of the resource bundle associated with this level.
return this.resourceBundleName;
|
public int | hashCode()Returns the hash code of this {@code Level} object.
return this.value;
|
public final int | intValue()Gets the integer value indicating this level.
return this.value;
|
public static java.util.logging.Level | parse(java.lang.String name)Parses a level name into a {@code Level} object. //$NON-NLS-1$
// BEGIN android-note
// final modifier removed and IAE added to get closer to the RI
// copied from newer version of harmony
// END android-note
if (name == null) {
// logging.1C=The 'name' parameter is null.
throw new NullPointerException(Messages.getString("logging.1C")); //$NON-NLS-1$
}
boolean isNameAnInt;
int nameAsInt;
try {
nameAsInt = Integer.parseInt(name);
isNameAnInt = true;
} catch (NumberFormatException e) {
nameAsInt = 0;
isNameAnInt = false;
}
synchronized (levels) {
for (Level level : levels) {
if (name.equals(level.getName())) {
return level;
}
}
if (isNameAnInt) {
/*
* Loop through levels a second time, so that the
* returned instance will be passed on the order of construction.
*/
for (Level level : levels) {
if (nameAsInt == level.intValue()) {
return level;
}
}
}
}
if (!isNameAnInt) {
// logging.1D=Cannot parse this name: {0}
throw new IllegalArgumentException(Messages.getString("logging.1D", name)); //$NON-NLS-1$
}
return new Level(name, nameAsInt);
|
private void | readObject(java.io.ObjectInputStream in)Serialization helper to setup transient resource bundle instance.
in.defaultReadObject();
if (resourceBundleName != null) {
try {
rb = ResourceBundle.getBundle(resourceBundleName);
} catch (MissingResourceException e) {
rb = null;
}
}
|
private java.lang.Object | readResolve()
Serialization helper method to maintain singletons and add any new
levels.
synchronized (levels) {
for (Level level : levels) {
if (value != level.value) {
continue;
}
if (!name.equals(name)) {
continue;
}
if (resourceBundleName == level.resourceBundleName) {
return level;
} else if (resourceBundleName != null
&& resourceBundleName.equals(level.resourceBundleName)) {
return level;
}
}
// This is a new value, so add it.
levels.add(this);
return this;
}
|
public final java.lang.String | toString()Returns the string representation of this {@code Level} object. In
this case, it is the level's name.
return this.name;
|