// Copyright 2003-2004 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.
namespace Apache.Avalon.Meta
{
using System;
using Apache.Avalon.Framework;
/// A descriptor that describes a name and inteface of a lifecycle stage.
///
///
/// Avalon Development Team
///
/// $Revision: 1.4 $ $Date: 2004/02/28 22:15:37 $
///
[Serializable]
public sealed class ExtensionDescriptor : Descriptor
{
/// The extension identifier.
private System.String m_urn;
/// Creation of an extension descriptor without attributes.
/// the extension identifier
///
/// NullPointerException if the urn identifer is null
///
public ExtensionDescriptor(System.String urn):this(urn, null)
{
}
/// Creation of a extension descriptor with attributes.
/// the extension identifier
///
/// a set of attributes to associate with the extension
///
/// NullPointerException if the supplied urn is null
///
public ExtensionDescriptor(System.String urn,
System.Collections.Specialized.NameValueCollection attributes) :
base(attributes, null)
{
if (null == (System.Object) urn)
{
throw new System.NullReferenceException("urn");
}
m_urn = urn;
}
/// Return the interface reference
///
///
/// the reference.
///
public System.String Key
{
get
{
return m_urn;
}
}
/// Test is the supplied object is equal to this object.
/// true if the object are equivalent
///
public override bool Equals(System.Object other)
{
if (other is ExtensionDescriptor)
{
if (base.Equals(other))
{
return m_urn.Equals(((ExtensionDescriptor) other).m_urn);
}
}
return false;
}
/// Return the hashcode for the object.
/// the hashcode value
///
public override int GetHashCode()
{
int hash = base.GetHashCode();
hash ^= m_urn.GetHashCode();
return hash;
}
/// Return a stringified representation of the instance.
/// the string representation
///
public override System.String ToString()
{
return "[extension " + Key + "]";
}
}
}