|
Struts example source code file (LocationImpl.java)
The Struts LocationImpl.java source code/* * Copyright 2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.opensymphony.xwork2.util.location; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Serializable; import java.net.URL; import java.util.ArrayList; import java.util.List; /** * A simple immutable and serializable implementation of {@link Location}. */ public class LocationImpl implements Location, Serializable { private final String uri; private final int line; private final int column; private final String description; // Package private: outside this package, use Location.UNKNOWN. static final LocationImpl UNKNOWN = new LocationImpl(null, null, -1, -1); /** * Build a location for a given URI, with unknown line and column numbers. * * @param uri the resource URI */ public LocationImpl(String description, String uri) { this(description, uri, -1, -1); } /** * Build a location for a given URI and line and column numbers. * * @param uri the resource URI * @param line the line number (starts at 1) * @param column the column number (starts at 1) */ public LocationImpl(String description, String uri, int line, int column) { if (uri == null || uri.length() == 0) { this.uri = null; this.line = -1; this.column = -1; } else { this.uri = uri; this.line = line; this.column = column; } if (description != null && description.length() == 0) { description = null; } this.description = description; } /** * Copy constructor. * * @param location the location to be copied */ public LocationImpl(Location location) { this(location.getDescription(), location.getURI(), location.getLineNumber(), location.getColumnNumber()); } /** * Create a location from an existing one, but with a different description */ public LocationImpl(String description, Location location) { this(description, location.getURI(), location.getLineNumber(), location.getColumnNumber()); } /** * Obtain a <code>LocationImpl from a {@link Location}. If Other Struts examples (source code examples)Here is a short list of links related to this Struts LocationImpl.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.