KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > picocontainer > gems > constraints > IsKey


1 /*****************************************************************************
2  * Copyright (C) PicoContainer Organization. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8
9 package org.picocontainer.gems.constraints;
10
11 import org.picocontainer.ComponentAdapter;
12
13 /**
14  * Constraint that accepts an adapter of a specific key.
15  *
16  * @author Nick Sieger
17  * @version 1.1
18  */

19 public class IsKey extends AbstractConstraint {
20
21     private Object JavaDoc key;
22
23     /**
24      * Creates a new <code>IsKey</code> instance.
25      *
26      * @param key the key to match
27      */

28     public IsKey(Object JavaDoc key) {
29         this.key = key;
30     }
31
32     public boolean evaluate(ComponentAdapter adapter) {
33         return key.equals(adapter.getComponentKey());
34     }
35
36 }
37
Popular Tags