01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.object.field;
06:
07: import com.tc.aspectwerkz.reflect.impl.java.JavaClassInfo;
08: import com.tc.object.TCClass;
09: import com.tc.object.config.DSOClientConfigHelper;
10: import com.tc.object.config.TransparencyClassSpec;
11:
12: import java.lang.reflect.Field;
13: import java.lang.reflect.Modifier;
14:
15: /**
16: * @author orion
17: */
18: public class TCFieldFactory {
19: private DSOClientConfigHelper configuration;
20:
21: public TCFieldFactory(DSOClientConfigHelper configuration) {
22: this .configuration = configuration;
23: }
24:
25: public TCField getInstance(TCClass tcClass, Field field) {
26: TransparencyClassSpec spec = configuration.getSpec(tcClass
27: .getName());
28: boolean trans = false;
29: if (spec != null) {
30: trans = spec.isTransient(field.getModifiers(), //
31: JavaClassInfo.getClassInfo(tcClass.getPeerClass()), //
32: field.getName());
33: }
34: return new GenericTCField(tcClass, field, !Modifier
35: .isStatic(field.getModifiers())
36: && !trans);
37: }
38:
39: }
|