001 /*******************************************************************************
002 * Copyright (C) PicoContainer Organization. All rights reserved.
003 * ---------------------------------------------------------------------------
004 * The software in this package is published under the terms of the BSD style
005 * license a copy of which has been included with this distribution in the
006 * LICENSE.txt file.
007 ******************************************************************************/
008 package org.picocontainer.classname;
009
010 /**
011 * ClassName is a simple wrapper for a class name which is used as a key in
012 * the registration of components in PicoContainer.
013 *
014 * @author Paul Hammant
015 */
016 public class ClassName implements CharSequence {
017 private final String className;
018
019 public ClassName(String className) {
020 this.className = className;
021 }
022
023 public int length() {
024 return className.length();
025 }
026
027 public char charAt(int ix) {
028 return className.charAt(ix);
029 }
030
031 public CharSequence subSequence(int from, int to) {
032 return className.subSequence(from, to);
033 }
034
035 public String toString() {
036 return className.toString();
037 }
038
039 public int hashCode() {
040 return className.hashCode();
041 }
042
043 public boolean equals(Object o) {
044 return className.equals(o);
045 }
046 }