avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-sandbox/cscontainer/src/cs AvalonComponentFactory.cs
Date Tue, 05 Aug 2003 14:26:49 GMT
bloritsch    2003/08/05 07:26:49

  Added:       cscontainer/src/cs AvalonComponentFactory.cs
  Log:
  add start to component factory
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/cscontainer/src/cs/AvalonComponentFactory.cs
  
  Index: AvalonComponentFactory.cs
  ===================================================================
  using System;
  
  namespace Apache.Avalon.Container
  {
  	/// <summary>
  	/// Summary description for AvalonComponentFactory.
  	/// </summary>
  	public class AvalonComponentFactory : IComponentFactory
  	{
          private Type m_componentType;
  
  		public AvalonComponentFactory(Type componentType)
  		{
              if (componentType == null) throw new ArgumentNullException( "componentType",
"We must have a valid component type" );
              m_componentType = componentType;
          }
  
          public object create()
          {
              object component = m_componentType.TypeInitializer.Invoke( null );
              return component;
          }
  
          public void destroy(object component)
          {
              if ( typeof( component ) != typeof( m_componentType ) )
                  throw new ArgumentException( "The component passed in to destroy is the
wrong type", "component" );
          }
  	}
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message