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 java.util.ArrayList; 019import java.util.Collections; 020import java.util.List; 021 022import javax.xml.bind.annotation.XmlAttribute; 023import javax.xml.bind.annotation.XmlElement; 024 025import org.kuali.common.util.Assert; 026import org.kuali.common.util.CollectionUtils; 027import org.kuali.common.util.nullify.Null; 028 029public final class Layout { 030 031 public static final Layout NONE = new Layout(); 032 033 @XmlAttribute(name = "class") 034 private final Class<?> layoutClass; 035 036 @XmlElement(name = "param") 037 private final List<Param> params; 038 039 private Layout() { 040 this(Null.class, Param.EMPTY); 041 } 042 043 public Layout(Class<?> layoutClass, Param param) { 044 this(layoutClass, CollectionUtils.singletonList(param)); 045 } 046 047 public Layout(Class<?> layoutClass, List<Param> params) { 048 Assert.noNulls(layoutClass, params); 049 this.layoutClass = layoutClass; 050 this.params = new ArrayList<Param>(params); 051 } 052 053 public List<Param> getParams() { 054 return Collections.unmodifiableList(params); 055 } 056 057 public Class<?> getLayoutClass() { 058 return layoutClass; 059 } 060 061}