001: /*--
002:
003: Copyright (C) 2000-2003 Anthony Eden.
004: All rights reserved.
005:
006: Redistribution and use in source and binary forms, with or without
007: modification, are permitted provided that the following conditions
008: are met:
009:
010: 1. Redistributions of source code must retain the above copyright
011: notice, this list of conditions, and the following disclaimer.
012:
013: 2. Redistributions in binary form must reproduce the above copyright
014: notice, this list of conditions, and the disclaimer that follows
015: these conditions in the documentation and/or other materials
016: provided with the distribution.
017:
018: 3. The name "EdenLib" must not be used to endorse or promote products
019: derived from this software without prior written permission. For
020: written permission, please contact me@anthonyeden.com.
021:
022: 4. Products derived from this software may not be called "EdenLib", nor
023: may "EdenLib" appear in their name, without prior written permission
024: from Anthony Eden (me@anthonyeden.com).
025:
026: In addition, I request (but do not require) that you include in the
027: end-user documentation provided with the redistribution and/or in the
028: software itself an acknowledgement equivalent to the following:
029: "This product includes software developed by
030: Anthony Eden (http://www.anthonyeden.com/)."
031:
032: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
033: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
034: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
035: DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
036: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
037: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
038: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
039: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
040: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
041: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
042: POSSIBILITY OF SUCH DAMAGE.
043:
044: For more information on EdenLib, please see <http://edenlib.sf.net/>.
045:
046: */
047:
048: package com.anthonyeden.lib.config;
049:
050: /**
051: * This interface provides information about where the configuration object was
052: * located in the configuration file.
053: *
054: * @author Anthony Eden
055: * @since 2.0
056: */
057:
058: public class Location implements Cloneable {
059:
060: private String sourceId;
061: private int lineNumber;
062: private int columnNumber;
063:
064: /**
065: * Construct a new Location object
066: *
067: * @param sourceId The source ID
068: * @param lineNumber The line number
069: * @param columnNumber The column number
070: */
071:
072: public Location(String sourceId, int lineNumber, int columnNumber) {
073: this .sourceId = sourceId;
074: this .lineNumber = lineNumber;
075: this .columnNumber = columnNumber;
076: }
077:
078: /**
079: * Get the source ID which is used to identify the source of the
080: * configuration data. This method should return a file path, URL or some
081: * other form of human readable location ID
082: *
083: * @return The source ID
084: */
085:
086: public String getSourceId() {
087: return sourceId;
088: }
089:
090: /**
091: * Get the line number
092: *
093: * @return The line number
094: */
095:
096: public int getLineNumber() {
097: return lineNumber;
098: }
099:
100: /**
101: * Get the column number
102: *
103: * @return The column number
104: */
105:
106: public int getColumnNumber() {
107: return columnNumber;
108: }
109:
110: public void setSourceId(String sourceId) {
111: this .sourceId = sourceId;
112: }
113:
114: public void setLineNumber(int lineNumber) {
115: this .lineNumber = lineNumber;
116: }
117:
118: public void setColumnNumber(int columnNumber) {
119: this .columnNumber = columnNumber;
120: }
121:
122: public Object clone() {
123: try {
124: return super .clone();
125: } catch (CloneNotSupportedException e) {
126: e.printStackTrace();
127: }
128: return null;
129: }
130:
131: }
|