2 Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 package com.mysql.clusterj.core.spi;
20 import com.mysql.clusterj.core.CacheManager;
21 import com.mysql.clusterj.core.query.CandidateIndexImpl;
22 import com.mysql.clusterj.core.store.Column;
23 import com.mysql.clusterj.core.store.Operation;
24 import com.mysql.clusterj.core.store.PartitionKey;
25 import com.mysql.clusterj.core.store.ResultData;
26 import com.mysql.clusterj.core.store.Table;
28 import java.util.BitSet;
31 /** DomainTypeHandler is the interface that must be implemented to allow core
32 * components to manage instances of a persistent class or interface.
35 public interface DomainTypeHandler<T> {
37 public CandidateIndexImpl[] createCandidateIndexes();
39 public String getName();
41 public Class<?> getOidClass();
43 public boolean isSupportedType();
45 public String getTableName();
47 public DomainFieldHandler getFieldHandler(String fieldName);
49 public Class<T> getProxyClass();
51 public T newInstance();
53 public ValueHandler getValueHandler(Object instance);
55 public T getInstance(ValueHandler handler);
57 public void objectMarkModified(ValueHandler handler, String fieldName);
59 public void objectSetValues(ResultData rs, ValueHandler handler);
61 public void objectSetKeys(Object keys, Object instance);
63 public void objectSetCacheManager(CacheManager cm, Object instance);
65 public void objectResetModified(ValueHandler handler);
67 public void operationGetValues(Operation op);
69 public void operationGetValues(Operation op, BitSet fields);
71 public void operationSetKeys(ValueHandler handler, Operation op);
73 public void operationSetNonPKValues(ValueHandler handler, Operation op);
75 public void operationSetModifiedValues(ValueHandler handler, Operation op);
77 public void operationSetModifiedNonPKValues(ValueHandler valueHandler, Operation op);
79 public ValueHandler createKeyValueHandler(Object keys);
81 public int[] getKeyFieldNumbers();
83 public Set<Column> getStoreColumns(BitSet fields);
85 public Table getStoreTable();
87 public PartitionKey createPartitionKey(ValueHandler handler);
89 public String[] getFieldNames();
91 public void operationSetValues(ValueHandler valueHandler, Operation op);