DebugLevel.java revision 59dd4e51b41d4317eab7eed8962531c1bb5c0676
/**
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014-2015 ForgeRock AS.
*/
/**
* Debug level enum
*/
public enum DebugLevel {
/**
* flags the disabled debug state.
*/
/**
* flags the state where error debugging is enabled. When debugging is set
* to less than <code>ERROR</code>, error debugging is also disabled.
*/
/**
* flags the state where warning debugging is enabled, but message debugging
* is disabled. When debugging is set to less than <code>WARNING</code>,
* warning debugging is also disabled.
*/
/**
* This state enables debugging of messages, warnings and errors.
*/
/**
* flags the enabled debug state for warnings, errors and messages. Printing
* to a file is disabled. All printing is done on System.out.
*/
private int level;
}
/**
* Get Debug level from its name
*
* @param strName name in string
* @return debug level associated to this name
* @throws IllegalArgumentException if no debug names are associated to this name,
* an illegal argument exception is throw
*/
}
/**
* Get Debug level from its name
*
* @param strLevel level in string
* @return debug level associated to this level
* @throws IllegalArgumentException if no debug names are associated to this level,
* an illegal argument exception is throw
*/
return OFF;
return ERROR;
return WARNING;
return MESSAGE;
return ON;
}
}
/**
* Get level that can be used for level comparison
*
* @return level number
*/
public int getLevel() {
return this.level;
}
/**
* Get Name associated with this debug level
*
* @return name
*/
return this.name;
}
/**
* Compares the debug level with the specified debug for order. Returns a negative integer, zero,
* or a positive integer as this level is less than, equal to, or greater than the specified object.
*
* @param o the object to be compared.
* @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than
* the specified object.
*/
public int compareLevel(DebugLevel o) {
return 0;
return -1;
} else {
return 1;
}
}
return this.name;
}
}