// 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.Composition.Data { using System; /// A entry descriptor declares the context entry import or creation criteria for /// a single context entry instance. /// ///

XML

///

A entry may contain either (a) a single nested import directive, or (b) a single param constructor directives.

///
	/// <context>
	/// 
	/// <!-- option (a) nested import -->
	/// <entry key="my-home-dir">
	/// <include key="urn:avalon:home"/>
	/// </entry>
	/// 
	/// <!-- option (b) param constructors -->
	/// <entry key="title">
	/// <param>Lord of the Rings</>
	/// </entry>
	/// <entry key="home">
	/// <param class="java.io.File">../home</param>
	/// </entry>
	/// 
	/// </context>
	/// 
/// ///
/// /// /// /// /// /// /// Avalon Development Team /// /// $Revision: 1.2 $ $Date: 2004/02/28 22:15:36 $ /// public class ConstructorDirective : EntryDirective { /// The constructor classname. private System.String m_classname; /// The constructor param. private Parameter[] m_params; /// The alternative argument. private System.String m_argument; /// Creation of a new entry directive using a constructor /// classname and single argument value. /// /// the entry key /// /// the single argument value /// public ConstructorDirective(System.String key, System.String valueObj):this(key, "java.lang.String", valueObj) { } /// Creation of a new entry directive using a constructor /// classname and single argument value. /// /// the entry key /// /// the classname of the entry implementation /// /// the single argument value /// public ConstructorDirective(System.String key, System.String classname, System.String valueObj):base(key) { if (null == (System.Object) classname) { throw new System.NullReferenceException("classname"); } m_params = new Parameter[0]; m_classname = classname; m_argument = valueObj; } /// Creation of a new entry directive using a parameter. /// the entry key /// /// implementation class constructor parameter directives /// public ConstructorDirective(System.String key, Parameter[] parameters):this(key, "java.lang.String", parameters) { } /// Creation of a new entry directive using a parameter. /// the entry key /// /// the classname of the entry implementation /// /// implementation class constructor parameter directives /// public ConstructorDirective(System.String key, System.String classname, Parameter[] paramsObj):base(key) { if (null == paramsObj) { throw new System.NullReferenceException("parameters"); } if (null == (System.Object) classname) { throw new System.NullReferenceException("classname"); } m_classname = classname; m_params = paramsObj; m_argument = null; } /// Return the constructor classname /// the classname /// public virtual System.String Classname { get { return m_classname; } } /// Return the parameter directive if the mode is PARAM else null. /// the directive /// public virtual Parameter[] Parameters { get { return m_params; } } /// Return the constructor single argument /// the costructor argument /// public virtual System.String Argument { get { return m_argument; } } } }