View Javadoc
1   /**
2    * Copyright 2010-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.util.log.log4j.model;
17  
18  import java.util.ArrayList;
19  import java.util.Collections;
20  import java.util.List;
21  
22  import javax.xml.bind.annotation.XmlAttribute;
23  import javax.xml.bind.annotation.XmlElement;
24  
25  import org.kuali.common.util.Assert;
26  import org.kuali.common.util.CollectionUtils;
27  import org.kuali.common.util.nullify.Null;
28  
29  public final class Layout {
30  
31  	public static final Layout NONE = new Layout();
32  
33  	@XmlAttribute(name = "class")
34  	private final Class<?> layoutClass;
35  
36  	@XmlElement(name = "param")
37  	private final List<Param> params;
38  
39  	private Layout() {
40  		this(Null.class, Param.EMPTY);
41  	}
42  
43  	public Layout(Class<?> layoutClass, Param param) {
44  		this(layoutClass, CollectionUtils.singletonList(param));
45  	}
46  
47  	public Layout(Class<?> layoutClass, List<Param> params) {
48  		Assert.noNulls(layoutClass, params);
49  		this.layoutClass = layoutClass;
50  		this.params = new ArrayList<Param>(params);
51  	}
52  
53  	public List<Param> getParams() {
54  		return Collections.unmodifiableList(params);
55  	}
56  
57  	public Class<?> getLayoutClass() {
58  		return layoutClass;
59  	}
60  
61  }