001// Copyright 2007 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry5.ioc.internal.services; 016 017import org.apache.tapestry5.ioc.Location; 018import org.apache.tapestry5.ioc.Resource; 019 020/** 021 * Implementation of {@link Location} used when the underlying resource isn't really known. 022 */ 023public final class StringLocation implements Location 024{ 025 private final String description; 026 027 private final int line; 028 029 public StringLocation(String description, int line) 030 { 031 this.description = description; 032 this.line = line; 033 } 034 035 @Override 036 public String toString() 037 { 038 return description; 039 } 040 041 /** 042 * Returns 0. 043 */ 044 public int getColumn() 045 { 046 return 0; 047 } 048 049 public int getLine() 050 { 051 return line; 052 } 053 054 /** 055 * Returns null; we don't know where the file really is (it's probably a class on the class path). 056 */ 057 public Resource getResource() 058 { 059 return null; 060 } 061 062}