001/**
002 * Copyright 2010-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.common.util.log.log4j.model;
017
018import javax.xml.bind.annotation.XmlAttribute;
019import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
020
021import org.kuali.common.util.Assert;
022import org.kuali.common.util.log.log4j.jaxb.OmitDefaultLog4JLevelClassAdapter;
023
024public final class Level {
025
026        public static final Class<org.apache.log4j.Level> DEFAULT_CLASS = org.apache.log4j.Level.class;
027        public static final Level DEFAULT = new Level();
028
029        @XmlAttribute(name = "class")
030        @XmlJavaTypeAdapter(OmitDefaultLog4JLevelClassAdapter.class)
031        private final Class<?> levelClass;
032
033        @XmlAttribute
034        private final Threshold value;
035
036        private Level() {
037                this(DEFAULT_CLASS, Threshold.DEFAULT_LOGGER_VALUE);
038        }
039
040        public Level(Threshold value) {
041                this(DEFAULT_CLASS, value);
042        }
043
044        public Level(Class<?> levelClass, Threshold value) {
045                Assert.noNulls(levelClass, value);
046                this.levelClass = levelClass;
047                this.value = value;
048        }
049
050        public Class<?> getLevelClass() {
051                return levelClass;
052        }
053
054        public Threshold getValue() {
055                return value;
056        }
057
058}