View Javadoc

1   /**
2    * Copyright 2010-2013 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.metainf.model;
17  
18  import org.kuali.common.util.Assert;
19  
20  public class MetaInfResource implements Comparable<MetaInfResource> {
21  
22  	public static final long UNKNOWN_SIZE = -1;
23  	public static final long UNKNOWN_LINECOUNT = -1;
24  
25  	private final String location;
26  	private final long size;
27  	private final long lineCount;
28  
29  	public MetaInfResource(String location) {
30  		this(location, UNKNOWN_SIZE, UNKNOWN_LINECOUNT);
31  	}
32  
33  	public MetaInfResource(String location, long size, long lineCount) {
34  		Assert.noBlanks(location);
35  		this.location = location;
36  		this.size = size;
37  		this.lineCount = lineCount;
38  	}
39  
40  	@Override
41  	public int compareTo(MetaInfResource other) {
42  		return location.compareTo(other.getLocation());
43  	}
44  
45  	public String getLocation() {
46  		return location;
47  	}
48  
49  	public long getSize() {
50  		return size;
51  	}
52  
53  	public long getLineCount() {
54  		return lineCount;
55  	}
56  
57  }