01: package org.drools.spi;
02:
03: import org.drools.base.ClassObjectType;
04: import org.drools.base.ValueType;
05:
06: /*
07: * Copyright 2005 JBoss Inc
08: *
09: * Licensed under the Apache License, Version 2.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.apache.org/licenses/LICENSE-2.0
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: */
21:
22: /**
23: * Java class semantics <code>ObjectType</code>.
24: *
25: * @author <a href="mailto:bob@werken.com">bob@werken.com </a>
26: *
27: * @version $Id: MockObjectType.java,v 1.1 2005/07/26 01:06:34 mproctor Exp $
28: */
29: public class MockObjectType implements ObjectType {
30: // ------------------------------------------------------------
31: // Instance members
32: // ------------------------------------------------------------
33:
34: /**
35: *
36: */
37: private static final long serialVersionUID = 400L;
38: /** Java object class. */
39: private boolean matches;
40:
41: // ------------------------------------------------------------
42: // Constructors
43: // ------------------------------------------------------------
44:
45: /**
46: * Construct.
47: *
48: * @param objectTypeClass
49: * Java object class.
50: */
51: public MockObjectType(final boolean matches) {
52: this .matches = matches;
53: }
54:
55: // ------------------------------------------------------------
56: // Instance methods
57: // ------------------------------------------------------------
58:
59: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
60: // org.drools.spi.ObjectType
61: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
62:
63: /**
64: * Determine if the passed <code>Object</code> belongs to the object type
65: * defined by this <code>objectType</code> instance.
66: *
67: * @param object
68: * The <code>Object</code> to test.
69: *
70: * @return <code>true</code> if the <code>Object</code> matches this
71: * object type, else <code>false</code>.
72: */
73: public boolean matches(final Object object) {
74: return this .matches;
75: }
76:
77: public boolean isAssignableFrom(Object object) {
78: return this .matches;
79: }
80:
81: public boolean isAssignableFrom(ObjectType objectType) {
82: return this .matches;
83: }
84:
85: public ValueType getValueType() {
86: return ValueType.OBJECT_TYPE;
87: }
88:
89: }
|