KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > phoenix > BlockEvent


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.phoenix;
9
10 import java.util.EventObject JavaDoc;
11 import org.apache.avalon.phoenix.metainfo.BlockInfo;
12
13 /**
14  * This is the class that is used to deliver notifications
15  * about {@link Block}s state changes to the
16  * {@link BlockListener}s of a Server Application.
17  *
18  * @author <a HREF="mailto:peter at apache.org">Peter Donald</a>
19  */

20 public final class BlockEvent
21     extends EventObject JavaDoc
22 {
23     private final String JavaDoc m_name;
24
25     private final Object JavaDoc m_block;
26
27     private final BlockInfo m_blockInfo;
28
29     /**
30      * Construct the <tt>BlockEvent</tt>.
31      *
32      * @param name the name of block
33      * @param block the block object
34      * @param blockInfo the BlockInfo object for block
35      */

36     public BlockEvent( final String JavaDoc name,
37                        final Object JavaDoc block,
38                        final BlockInfo blockInfo )
39     {
40         super( name );
41
42         if( null == name )
43         {
44             throw new NullPointerException JavaDoc( "name property is null" );
45         }
46         if( null == block )
47         {
48             throw new NullPointerException JavaDoc( "block property is null" );
49         }
50         if( null == blockInfo )
51         {
52             throw new NullPointerException JavaDoc( "blockInfo property is null" );
53         }
54
55         m_name = name;
56         m_block = block;
57         m_blockInfo = blockInfo;
58     }
59
60     /**
61      * Retrieve name of block.
62      *
63      * @return the name of block
64      */

65     public String JavaDoc getName()
66     {
67         return m_name;
68     }
69
70     /**
71      * Retrieve the block instance.
72      *
73      * @return the block instance
74      */

75     public Object JavaDoc getObject()
76     {
77         return m_block;
78     }
79
80     /**
81      * Retrieve the block instance.
82      *
83      * @return the block instance
84      * @deprecated Use getObject() instead as this may
85      * cause a ClassCastException
86      */

87     public Block getBlock()
88     {
89         return (Block)m_block;
90     }
91
92     /**
93      * Retrieve the BlockInfo for block.
94      *
95      * @return the BlockInfo for block
96      */

97     public BlockInfo getBlockInfo()
98     {
99         return m_blockInfo;
100     }
101 }
102
Popular Tags