01: /**********************************************************************
02: Copyright (c) 2004 Andy Jefferson and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15:
16: Contributors:
17: ...
18: **********************************************************************/package org.jpox.store.mapping;
19:
20: import java.util.BitSet;
21:
22: import org.jpox.ClassLoaderResolver;
23: import org.jpox.ClassNameConstants;
24: import org.jpox.exceptions.JPOXException;
25: import org.jpox.store.expression.LogicSetExpression;
26: import org.jpox.store.expression.QueryExpression;
27: import org.jpox.store.expression.ScalarExpression;
28:
29: /**
30: * Mapping for an array of bytes.
31: *
32: * @version $Revision: 1.13 $
33: **/
34: public class BitSetMapping extends SingleFieldMapping implements
35: SimpleDatastoreRepresentation {
36: private static BitSet mappingSampleValue = new BitSet();
37:
38: public Object getSampleValue(ClassLoaderResolver clr) {
39: return mappingSampleValue;
40: }
41:
42: public Class getJavaType() {
43: return BitSet.class;
44: }
45:
46: /**
47: * Accessor for the name of the java-type actually used when mapping the particular datastore
48: * field. Returns java.io.Serializable
49: * @param index requested datastore field index.
50: * @return the name of java-type for the requested datastore field.
51: */
52: public String getJavaTypeForDatastoreMapping(int index) {
53: return ClassNameConstants.JAVA_IO_SERIALIZABLE;
54: }
55:
56: public ScalarExpression newLiteral(QueryExpression qs, Object value) {
57: throw new JPOXException(getJavaType().getName()
58: + " is not supported in queries.").setFatal();
59: }
60:
61: public ScalarExpression newScalarExpression(QueryExpression qs,
62: LogicSetExpression te) {
63: throw new JPOXException(getJavaType().getName()
64: + " is not supported in queries.").setFatal();
65: }
66: }
|