Author: vyemialyanchyk
Date: 2010-04-02 14:54:14 -0400 (Fri, 02 Apr 2010)
New Revision: 21246
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/base/
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/base/HObject.java
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationOptionsTab.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/Messages.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/Messages.properties
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/AbstractTypeStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/AnyStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ArrayStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ArtifactCollectorStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/BagStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/Cfg2HbmToolStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/CollectionStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ConfigurationStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ConfigurationStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ExporterStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/FetchModeStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/HibernateMappingExporterStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/IndexedCollectionStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/JoinedSubclassStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/KeyValueStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ListStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ManyToOneStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/MapStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/MappingsStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/NamingStrategyStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/OneToManyStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/OneToOneStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PersistentClassStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PersistentClassStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PrimitiveArrayStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PropertyStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/RootClassStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SelectableStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SessionStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SetStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SimpleValueStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SubclassStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TableStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ToOneStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TypeStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TypeStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ValueStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ValueStubFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ClassHelper.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - create/invoke by string name
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationOptionsTab.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationOptionsTab.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationOptionsTab.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -121,7 +121,7 @@
}
private void handleNamingStrategyBrowse() {
- String string =
DialogSelectionHelper.chooseImplementation(NamingStrategyStub.getClassName(),
namingStrategyClassNameText.getText(),
HibernateConsoleMessages.ConsoleConfigurationOptionsTab_select_naming_strategy_class,
getShell());
+ String string = DialogSelectionHelper.chooseImplementation(NamingStrategyStub.CL,
namingStrategyClassNameText.getText(),
HibernateConsoleMessages.ConsoleConfigurationOptionsTab_select_naming_strategy_class,
getShell());
if(string!=null) {
namingStrategyClassNameText.setText(string);
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/Messages.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/Messages.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/Messages.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -38,6 +38,7 @@
public static String DynamicSQLPreviewView_caused_by;
public static String DynamicSQLPreviewView_manipulation_of;
public static String Stub_create_null_stub_prohibit;
+ public static String HObject_incompatible_object_types;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/Messages.properties
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/Messages.properties 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/Messages.properties 2010-04-02
18:54:14 UTC (rev 21246)
@@ -31,4 +31,5 @@
EntityPropertySource_properties=Properties
DynamicSQLPreviewView_caused_by=\nCaused by:\n
DynamicSQLPreviewView_manipulation_of=Manipulation of
-Stub_create_null_stub_prohibit=Create stub for null obj reference prohibit
\ No newline at end of file
+Stub_create_null_stub_prohibit=Create stub for null obj reference prohibit
+HObject_incompatible_object_types=Incompatible object types.
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/base/HObject.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/base/HObject.java
(rev 0)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/base/HObject.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -0,0 +1,170 @@
+package org.hibernate.mediator.base;
+
+import java.beans.Expression;
+
+import org.hibernate.mediator.Messages;
+import org.hibernate.mediator.stubs.HibernateConsoleRuntimeException;
+import org.hibernate.mediator.stubs.util.ClassHelper;
+import org.hibernate.mediator.stubs.util.ReflectHelper;
+
+public class HObject {
+ // store object
+ protected final Object obj;
+
+ // TODO: get rid of this!!!
+ private HObject(Object obj) {
+ this.obj = obj;
+ }
+
+ //
+ public HObject(Object obj, String cn) {
+ if (obj == null) {
+ throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
+ }
+ if (obj instanceof HObject) {
+ this.obj = ((HObject) obj).obj;
+ } else {
+ this.obj = obj;
+ }
+ if (!ClassHelper.isClassOrOffspring(Cl(), cn)) {
+ throw new
HibernateConsoleRuntimeException(Messages.HObject_incompatible_object_types);
+ }
+ }
+
+ // type of store object
+ public final Class<?> Cl() {
+ return obj.getClass();
+ }
+
+ //
+ public final Object Obj() {
+ return obj;
+ }
+
+ //
+ public Object invoke(final String methodName) {
+ return invoke(methodName, new HObject[0]);
+ }
+
+ // TODO: get rid of Object -> HObject
+ public Object invoke(final String methodName, Object param0) {
+ return invoke(methodName, new HObject[] { new HObject(param0) });
+ }
+
+ // TODO: get rid of Object -> HObject
+ public Object invoke(final String methodName, Object param0, Object param1) {
+ return invoke(methodName, new HObject[] { new HObject(param0), new HObject(param1) });
+ }
+
+ // TODO: get rid of Object -> HObject
+ public Object invoke(final String methodName, Object param0, Object param1, Object
param2) {
+ return invoke(methodName, new HObject[] { new HObject(param0), new HObject(param1),
+ new HObject(param2) });
+ }
+
+ // TODO: get rid of Object -> HObject
+ public Object invoke(final String methodName, Object param0, Object param1, Object
param2,
+ Object param3) {
+ return invoke(methodName, new HObject[] { new HObject(param0), new HObject(param1),
+ new HObject(param2), new HObject(param3) });
+ }
+
+ // TODO: get rid of Object -> HObject
+ public Object invoke(final String methodName, Object param0, Object param1, Object
param2,
+ Object param3, Object param4) {
+ return invoke(methodName, new HObject[] { new HObject(param0), new HObject(param1),
+ new HObject(param2), new HObject(param3), new HObject(param4) });
+ }
+
+ // TODO: get rid of Object -> HObject
+ public Object invoke(final String methodName, Object param0, Object param1, Object
param2,
+ Object param3, Object param4, Object param5) {
+ return invoke(methodName,
+ new HObject[] { new HObject(param0), new HObject(param1), new HObject(param2),
+ new HObject(param3), new HObject(param4), new HObject(param5) });
+ }
+
+ //
+ public Object invoke(final String methodName, HObject param) {
+ return invoke(methodName, new HObject[] { param });
+ }
+
+ //
+ public Object invoke(final String methodName, HObject[] params) {
+ // Class<?>[] signature = new Class<?>[params.length];
+ Object[] vals = new Object[params.length];
+ for (int i = 0; i < params.length; i++) {
+ // signature[i] = params[i].Cl();
+ vals[i] = params[i].obj;
+ }
+ Expression expression = new Expression(obj, methodName, vals);
+ try {
+ return expression.getValue();
+ } catch (Exception e) {
+ throw new HibernateConsoleRuntimeException(e);
+ }
+ }
+
+ //
+ public static Object newInstance(final String cn) {
+ return newInstance(cn, new HObject[0]);
+ }
+
+ // TODO: get rid of Object -> HObject
+ public static Object newInstance(final String cn, Object param0) {
+ return newInstance(cn, new HObject[] { new HObject(param0) });
+ }
+
+ // TODO: get rid of Object -> HObject
+ public static Object newInstance(final String cn, Object param0, Object param1) {
+ return newInstance(cn, new HObject[] { new HObject(param0), new HObject(param1) });
+ }
+
+ // TODO: get rid of Object -> HObject
+ public static Object newInstance(final String cn, Object param0, Object param1, Object
param2) {
+ return newInstance(cn, new HObject[] { new HObject(param0), new HObject(param1),
+ new HObject(param2) });
+ }
+
+ //
+ public static Object newInstance(final String cn, HObject[] params) {
+ Class<?> clazz;
+ try {
+ clazz = ReflectHelper.classForName(cn);
+ } catch (ClassNotFoundException e) {
+ throw new HibernateConsoleRuntimeException(e);
+ }
+ // Class<?>[] signature = new Class<?>[params.length];
+ Object[] vals = new Object[params.length];
+ for (int i = 0; i < params.length; i++) {
+ // signature[i] = params[i].Cl();
+ vals[i] = params[i].obj;
+ }
+ Expression expression = new Expression(clazz, "new", vals); //$NON-NLS-1$
+ try {
+ return expression.getValue();
+ } catch (Exception e) {
+ throw new HibernateConsoleRuntimeException(e);
+ }
+ }
+ //
+ public static String mn() {
+ StackTraceElement[] stes = Thread.currentThread().getStackTrace();
+ return trace(stes);
+ }
+ //
+ public static String trace(StackTraceElement e[]) {
+ boolean doNext1 = false, doNext2 = false;
+ for (StackTraceElement s : e) {
+ if (doNext2) {
+ return s.getMethodName();
+ }
+ if (doNext1) {
+ doNext2 = true;
+ continue;
+ }
+ doNext1 = s.getMethodName().equals("getStackTrace"); //$NON-NLS-1$
+ }
+ return ""; //$NON-NLS-1$
+ }
+}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/AbstractTypeStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/AbstractTypeStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/AbstractTypeStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,18 +1,9 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mediator.Messages;
-import org.hibernate.type.AbstractType;
-
public class AbstractTypeStub extends TypeStub {
public static final String CL = "org.hibernate.type.AbstractType";
//$NON-NLS-1$
- protected AbstractType abstractType;
-
protected AbstractTypeStub(Object abstractType) {
- super(abstractType);
- if (abstractType == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.abstractType = (AbstractType)abstractType;
+ super(abstractType, CL);
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/AnyStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/AnyStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/AnyStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,19 +1,10 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.Any;
-import org.hibernate.mediator.Messages;
-
public class AnyStub extends SimpleValueStub {
public static final String CL = "org.hibernate.mapping.Any"; //$NON-NLS-1$
- protected Any any;
-
protected AnyStub(Object any) {
- super(any);
- if (any == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.any = (Any)any;
+ super(any, CL);
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ArrayStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ArrayStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ArrayStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,42 +1,39 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.Array;
-import org.hibernate.mediator.Messages;
+import org.hibernate.mediator.base.HObject;
public class ArrayStub extends ListStub {
public static final String CL = "org.hibernate.mapping.Array"; //$NON-NLS-1$
- protected Array array;
-
protected ArrayStub(Object array) {
- super(array);
- if (array == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.array = (Array)array;
+ super(array, CL);
}
+
+ protected ArrayStub(Object array, String cn) {
+ super(array, cn);
+ }
- public static ArrayStub newInstance(PersistentClassStub owner) {
- return new ArrayStub(new Array(owner.persistentClass));
+ public static ArrayStub newInstance(PersistentClassStub persistentClass) {
+ return new ArrayStub(HObject.newInstance(CL, persistentClass));
}
public void setElement(ValueStub element) {
- array.setElement(element.value);
+ invoke("setElement", element); //$NON-NLS-1$
}
public void setCollectionTable(TableStub table) {
- array.setCollectionTable(table.table);
+ invoke("setCollectionTable", table); //$NON-NLS-1$
}
public void setElementClassName(String elementClassName) {
- array.setElementClassName(elementClassName);
+ invoke("setElementClassName", elementClassName); //$NON-NLS-1$
}
public void setIndex(ValueStub index) {
- array.setIndex(index.value);
+ invoke("setIndex", index); //$NON-NLS-1$
}
public String getElementClassName() {
- return array.getElementClassName();
+ return (String)invoke("getElementClassName"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ArtifactCollectorStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ArtifactCollectorStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ArtifactCollectorStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -2,31 +2,25 @@
import java.io.File;
-import org.hibernate.mediator.Messages;
-import org.hibernate.tool.hbm2x.ArtifactCollector;
+import org.hibernate.mediator.base.HObject;
-public class ArtifactCollectorStub {
+public class ArtifactCollectorStub extends HObject {
public static final String CL = "org.hibernate.tool.hbm2x.ArtifactCollector";
//$NON-NLS-1$
- protected ArtifactCollector artifactCollector;
-
protected ArtifactCollectorStub(Object artifactCollector) {
- if (artifactCollector == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.artifactCollector = (ArtifactCollector)artifactCollector;
+ super(artifactCollector, CL);
}
public static ArtifactCollectorStub newInstance() {
- return new ArtifactCollectorStub(new ArtifactCollector());
+ return new ArtifactCollectorStub(newInstance(CL));
}
public File[] getFiles(String string) {
- return artifactCollector.getFiles(string);
+ return (File[])invoke("getFiles", string); //$NON-NLS-1$
}
public void formatFiles() {
- artifactCollector.formatFiles();
+ invoke("formatFiles"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/BagStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/BagStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/BagStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,23 +1,14 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.Bag;
-import org.hibernate.mediator.Messages;
-
public class BagStub extends CollectionStub {
public static final String CL = "org.hibernate.mapping.Bag"; //$NON-NLS-1$
- protected Bag bag;
-
protected BagStub(Object bag) {
- super(bag);
- if (bag == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.bag = (Bag)bag;
+ super(bag, CL);
}
- public static BagStub newInstance(PersistentClassStub owner) {
- return new BagStub(new Bag(owner.persistentClass));
+ public static BagStub newInstance(PersistentClassStub persistentClass) {
+ return new BagStub(newInstance(CL, persistentClass));
}
@Override
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/Cfg2HbmToolStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/Cfg2HbmToolStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/Cfg2HbmToolStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,29 +1,23 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mediator.Messages;
-import org.hibernate.tool.hbm2x.Cfg2HbmTool;
+import org.hibernate.mediator.base.HObject;
-public class Cfg2HbmToolStub {
+public class Cfg2HbmToolStub extends HObject {
public static final String CL = "org.hibernate.tool.hbm2x.Cfg2HbmTool";
//$NON-NLS-1$
- protected Cfg2HbmTool cfg2HbmTool;
-
protected Cfg2HbmToolStub(Object cfg2HbmTool) {
- if (cfg2HbmTool == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.cfg2HbmTool = (Cfg2HbmTool)cfg2HbmTool;
+ super(cfg2HbmTool, CL);
}
public static Cfg2HbmToolStub newInstance() {
- return new Cfg2HbmToolStub(new Cfg2HbmTool());
+ return new Cfg2HbmToolStub(newInstance(CL));
}
public String getTag(PersistentClassStub persistentClass) {
- return cfg2HbmTool.getTag(persistentClass.persistentClass);
+ return (String)invoke("getTag", persistentClass); //$NON-NLS-1$
}
public String getTag(PropertyStub property) {
- return cfg2HbmTool.getTag(property.property);
+ return (String)invoke("getTag", property); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/CollectionStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/CollectionStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/CollectionStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,59 +1,46 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.FetchMode;
-import org.hibernate.mapping.Collection;
-import org.hibernate.mediator.Messages;
-
public abstract class CollectionStub extends ValueStub {
public static final String CL = "org.hibernate.mapping.Collection";
//$NON-NLS-1$
- protected Collection collection;
-
protected CollectionStub(Object collection) {
- super(collection);
- if (collection == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.collection = (Collection)collection;
+ super(collection, CL);
}
+ protected CollectionStub(Object collection, String cn) {
+ super(collection, cn);
+ }
+
public void setCollectionTable(TableStub table) {
- collection.setCollectionTable(table.table);
+ invoke("setCollectionTable", table); //$NON-NLS-1$
}
public void setKey(KeyValueStub key) {
- collection.setKey(key.keyValue);
+ invoke("setKey", key); //$NON-NLS-1$
}
public void setLazy(boolean lazy) {
- collection.setLazy(lazy);
+ invoke("setLazy", lazy); //$NON-NLS-1$
}
public void setRole(String role) {
- collection.setRole(role);
+ invoke("setRole", role); //$NON-NLS-1$
}
public void setElement(ValueStub element) {
- collection.setElement(element.value);
+ invoke("setElement", element); //$NON-NLS-1$
}
public void setFetchMode(FetchModeStub fetchMode) {
- if (FetchModeStub.DEFAULT.equals(fetchMode)) {
- collection.setFetchMode(FetchMode.DEFAULT);
- } else if (FetchModeStub.SELECT.equals(fetchMode)) {
- collection.setFetchMode(FetchMode.SELECT);
- } else if (FetchModeStub.JOIN.equals(fetchMode)) {
- collection.setFetchMode(FetchMode.JOIN);
- } else if (FetchModeStub.SUBSELECT.equals(fetchMode)) {
- }
+ invoke("setFetchMode", fetchMode); //$NON-NLS-1$
}
public ValueStub getElement() {
- return ValueStubFactory.createValueStub(collection.getElement());
+ return ValueStubFactory.createValueStub(invoke("getElement")); //$NON-NLS-1$
}
public TableStub getCollectionTable() {
- Object obj = collection.getCollectionTable();
+ Object obj = invoke("getCollectionTable"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -61,14 +48,14 @@
}
public KeyValueStub getKey() {
- return (KeyValueStub)ValueStubFactory.createValueStub(collection.getKey());
+ return (KeyValueStub)ValueStubFactory.createValueStub(invoke("getKey"));
//$NON-NLS-1$
}
public boolean isOneToMany() {
- return collection.isOneToMany();
+ return (Boolean)invoke("isOneToMany"); //$NON-NLS-1$
}
public boolean isInverse() {
- return collection.isInverse();
+ return (Boolean)invoke("isInverse"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ConfigurationStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ConfigurationStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ConfigurationStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -15,30 +15,24 @@
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mediator.Messages;
import org.hibernate.mediator.FakeDelegatingDriver;
+import org.hibernate.mediator.base.HObject;
import org.hibernate.mediator.stubs.util.ReflectHelper;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.ide.completion.HQLCodeAssist;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
-public class ConfigurationStub {
+public class ConfigurationStub extends HObject {
public static final String CL = "org.hibernate.cfg.Configuration";
//$NON-NLS-1$
private Map<String, FakeDelegatingDriver> fakeDrivers = new HashMap<String,
FakeDelegatingDriver>();
- // configuration != null - by default
- protected Configuration configuration;
-
protected ConfigurationStub(Object configuration) {
- if (configuration == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.configuration = (Configuration)configuration;
+ super(configuration, CL);
}
- public static ConfigurationStub newInstance() throws ClassNotFoundException,
InstantiationException, IllegalAccessException {
- Class<?> clazz =
ReflectHelper.classForName("org.hibernate.cfg.Configuration"); //$NON-NLS-1$
- return new ConfigurationStub(clazz.newInstance());
+ public static ConfigurationStub newInstance() {
+ return new ConfigurationStub(newInstance(CL));
}
public void cleanUp() {
@@ -54,11 +48,11 @@
}
public void buildMappings() {
- configuration.buildMappings();
+ invoke("buildMappings"); //$NON-NLS-1$
}
public SettingsStub buildSettings() {
- Object obj = configuration.buildSettings();
+ Object obj = invoke("buildSettings"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -66,7 +60,7 @@
}
public SessionFactoryStub buildSessionFactory() {
- Object obj = configuration.buildSessionFactory();
+ Object obj = invoke(mn());
if (obj == null) {
return null;
}
@@ -74,15 +68,16 @@
}
public EntityResolver getEntityResolver() {
- return configuration.getEntityResolver();
+ return (EntityResolver)invoke("getEntityResolver"); //$NON-NLS-1$
}
public IHQLCodeAssistStub getHQLCodeAssist() {
- return new IHQLCodeAssistStub(new HQLCodeAssist(configuration));
+ // TODO: fix this
+ return new IHQLCodeAssistStub(new HQLCodeAssist((Configuration)Obj()));
}
public NamingStrategyStub getNamingStrategy() {
- Object obj = configuration.getNamingStrategy();
+ Object obj = invoke("getNamingStrategy"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -90,12 +85,12 @@
}
public boolean hasNamingStrategy() {
- return (configuration.getNamingStrategy() != null);
+ return (invoke("getNamingStrategy") != null); //$NON-NLS-1$
}
@SuppressWarnings("unchecked")
public Iterator<PersistentClassStub> getClassMappings() {
- Iterator<PersistentClass> it =
(Iterator<PersistentClass>)configuration.getClassMappings();
+ Iterator<PersistentClass> it =
(Iterator<PersistentClass>)invoke("getClassMappings"); //$NON-NLS-1$
ArrayList<PersistentClassStub> arr = new ArrayList<PersistentClassStub>();
while (it.hasNext()) {
arr.add(PersistentClassStubFactory.createPersistentClassStub(it.next()));
@@ -104,11 +99,11 @@
}
public PersistentClassStub getClassMapping(String entityName) {
- return
PersistentClassStubFactory.createPersistentClassStub(configuration.getClassMapping(entityName));
+ return
PersistentClassStubFactory.createPersistentClassStub(invoke("getClassMapping",
entityName)); //$NON-NLS-1$
}
public MappingsStub createMappings() {
- Object obj = configuration.createMappings();
+ Object obj = invoke("createMappings"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -116,7 +111,7 @@
}
public MappingStub buildMapping() {
- Object obj = configuration.buildMapping();
+ Object obj = invoke("buildMapping"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -145,7 +140,8 @@
@SuppressWarnings("unchecked")
public Iterator<Throwable> doSchemaExport() {
- SchemaExport export = new SchemaExport(configuration);
+ // TODO: fix this
+ SchemaExport export = new SchemaExport((Configuration)Obj());
export.create(false, true);
if (!export.getExceptions().isEmpty()) {
return (Iterator<Throwable>)export.getExceptions().iterator();
@@ -158,11 +154,11 @@
}
public Properties getProperties() {
- return configuration.getProperties();
+ return (Properties)invoke("getProperties"); //$NON-NLS-1$
}
public String getProperty(String propertyName) {
- return configuration.getProperty(propertyName);
+ return (String)invoke("getProperty", propertyName); //$NON-NLS-1$
}
/**
@@ -212,39 +208,39 @@
}
public ConfigurationStub setProperties(Properties properties) {
- Configuration tmp = configuration.setProperties(properties);
- return (tmp == configuration ? this : new ConfigurationStub(tmp));
+ Object tmp = invoke("setProperties", properties); //$NON-NLS-1$
+ return (tmp == Obj() ? this : new ConfigurationStub(tmp));
}
public void setProperty(String propertyName, String value) {
- configuration.setProperty(propertyName, value);
+ invoke("setProperty", propertyName, value); //$NON-NLS-1$
}
public ConfigurationStub configure(Document document) {
- Configuration tmp = configuration.configure(document);
- return (tmp == configuration ? this : new ConfigurationStub(tmp));
+ Object tmp = invoke("configure", document); //$NON-NLS-1$
+ return (tmp == Obj() ? this : new ConfigurationStub(tmp));
}
public ConfigurationStub configure() {
- Configuration tmp = configuration.configure();
- return (tmp == configuration ? this : new ConfigurationStub(tmp));
+ Object tmp = invoke("configure"); //$NON-NLS-1$
+ return (tmp == Obj() ? this : new ConfigurationStub(tmp));
}
public ConfigurationStub configure(File configFile) {
- Configuration tmp = configuration.configure(configFile);
- return (tmp == configuration ? this : new ConfigurationStub(tmp));
+ Object tmp = invoke("configure", configFile); //$NON-NLS-1$
+ return (tmp == Obj() ? this : new ConfigurationStub(tmp));
}
public void setEntityResolver(EntityResolver entityResolver) {
- configuration.setEntityResolver(entityResolver);
+ invoke("setEntityResolver", entityResolver); //$NON-NLS-1$
}
public void setNamingStrategy(NamingStrategyStub ns) {
- configuration.setNamingStrategy(ns.namingStrategy);
+ invoke("setNamingStrategy", ns); //$NON-NLS-1$
}
public ConfigurationStub addFile(File xmlFile) {
- Configuration tmp = configuration.addFile(xmlFile);
- return (tmp == configuration ? this : new ConfigurationStub(tmp));
+ Object tmp = invoke("addFile", xmlFile); //$NON-NLS-1$
+ return (tmp == Obj() ? this : new ConfigurationStub(tmp));
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ConfigurationStubFactory.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ConfigurationStubFactory.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ConfigurationStubFactory.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -44,15 +44,7 @@
}
public ConfigurationStub createConfiguration() {
- try {
- return ConfigurationStub.newInstance();
- } catch (ClassNotFoundException e) {
- throw new HibernateConsoleRuntimeException(e);
- } catch (InstantiationException e) {
- throw new HibernateConsoleRuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new HibernateConsoleRuntimeException(e);
- }
+ return ConfigurationStub.newInstance();
}
public ConfigurationStubJDBCMetaData createConfigurationJDBCMetaData() {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ExporterStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ExporterStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ExporterStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -3,7 +3,9 @@
import java.io.File;
import java.util.Properties;
+import org.hibernate.cfg.Configuration;
import org.hibernate.mediator.Messages;
+import org.hibernate.tool.hbm2x.ArtifactCollector;
import org.hibernate.tool.hbm2x.Exporter;
public class ExporterStub {
@@ -23,7 +25,7 @@
}
public void setConfiguration(ConfigurationStub configuration) {
- exporter.setConfiguration(configuration.configuration);
+ exporter.setConfiguration((Configuration)configuration.Obj());
}
public void setProperties(Properties props) {
@@ -31,7 +33,7 @@
}
public void setArtifactCollector(ArtifactCollectorStub collector) {
- exporter.setArtifactCollector(collector.artifactCollector);
+ exporter.setArtifactCollector((ArtifactCollector)collector.Obj());
}
public void setOutputDirectory(File file) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/FetchModeStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/FetchModeStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/FetchModeStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,8 +1,16 @@
package org.hibernate.mediator.stubs;
-public enum FetchModeStub {
- DEFAULT,
- SELECT,
- JOIN,
- SUBSELECT
+import org.hibernate.FetchMode;
+import org.hibernate.mediator.base.HObject;
+
+public class FetchModeStub extends HObject {
+ public static final String CL = "org.hibernate.FetchMode"; //$NON-NLS-1$
+
+ public FetchModeStub(Object fetchMode) {
+ super(fetchMode, CL);
+ }
+
+ public static final FetchModeStub DEFAULT = new FetchModeStub(FetchMode.DEFAULT);
+ public static final FetchModeStub SELECT = new FetchModeStub(FetchMode.SELECT);
+ public static final FetchModeStub JOIN = new FetchModeStub(FetchMode.JOIN);
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/HibernateMappingExporterStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/HibernateMappingExporterStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/HibernateMappingExporterStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -5,6 +5,7 @@
import java.lang.reflect.Method;
import java.util.Map;
+import org.hibernate.cfg.Configuration;
import org.hibernate.mediator.Messages;
import org.hibernate.tool.hbm2x.HibernateMappingExporter;
@@ -14,10 +15,10 @@
protected HibernateMappingExporter hibernateMappingExporter;
protected HibernateMappingExporterStub(ConfigurationStub cfg, File outputdir) {
- if (cfg.configuration == null) {
+ if (cfg.Obj() == null) {
throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
}
- hibernateMappingExporter = new HibernateMappingExporter(cfg.configuration, outputdir);
+ hibernateMappingExporter = new HibernateMappingExporter((Configuration)cfg.Obj(),
outputdir);
}
public void setGlobalSettings(HibernateMappingGlobalSettingsStub hmgs) {
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/IndexedCollectionStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/IndexedCollectionStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/IndexedCollectionStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,23 +1,18 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.IndexedCollection;
-import org.hibernate.mediator.Messages;
-
public abstract class IndexedCollectionStub extends CollectionStub {
public static final String CL = "org.hibernate.mapping.IndexedCollection";
//$NON-NLS-1$
- protected IndexedCollection indexedCollection;
-
protected IndexedCollectionStub(Object indexedCollection) {
- super(indexedCollection);
- if (indexedCollection == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.indexedCollection = (IndexedCollection)indexedCollection;
+ super(indexedCollection, CL);
}
+ protected IndexedCollectionStub(Object indexedCollection, String cn) {
+ super(indexedCollection, cn);
+ }
+
public void setIndex(ValueStub index) {
- indexedCollection.setIndex(index.value);
+ invoke("setIndex", index); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/JoinedSubclassStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/JoinedSubclassStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/JoinedSubclassStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,31 +1,22 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.JoinedSubclass;
-import org.hibernate.mediator.Messages;
-
public class JoinedSubclassStub extends SubclassStub {
public static final String CL = "org.hibernate.mapping.JoinedSubclass";
//$NON-NLS-1$
- protected JoinedSubclass joinedSubclass;
-
protected JoinedSubclassStub(Object joinedSubclass) {
- super(joinedSubclass);
- if (joinedSubclass == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.joinedSubclass = (JoinedSubclass)joinedSubclass;
+ super(joinedSubclass, CL);
}
public static JoinedSubclassStub newInstance(PersistentClassStub persistentClass) {
- return new JoinedSubclassStub(persistentClass);
+ return new JoinedSubclassStub(newInstance(CL, persistentClass));
}
public void setTable(TableStub table) {
- joinedSubclass.setTable(table.getTable());
+ invoke("setTable", table); //$NON-NLS-1$
}
public void setKey(KeyValueStub key) {
- joinedSubclass.setKey(key.keyValue);
+ invoke("ssetKey", key); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/KeyValueStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/KeyValueStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/KeyValueStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,21 +1,16 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.KeyValue;
-import org.hibernate.mediator.Messages;
-
public abstract class KeyValueStub extends ValueStub {
public static final String CL = "org.hibernate.mapping.KeyValue";
//$NON-NLS-1$
- protected KeyValue keyValue;
-
protected KeyValueStub(Object keyValue) {
- super(keyValue);
- if (keyValue == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.keyValue = (KeyValue)keyValue;
+ super(keyValue, CL);
}
+ protected KeyValueStub(Object keyValue, String cn) {
+ super(keyValue, cn);
+ }
+
@Override
public abstract Object accept(ValueVisitorStub visitor);
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ListStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ListStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ListStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,23 +1,18 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.List;
-import org.hibernate.mediator.Messages;
-
public class ListStub extends IndexedCollectionStub {
public static final String CL = "org.hibernate.mapping.List"; //$NON-NLS-1$
- protected List list;
-
protected ListStub(Object list) {
- super(list);
- if (list == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.list = (List)list;
+ super(list, CL);
}
+
+ protected ListStub(Object list, String cn) {
+ super(list, cn);
+ }
public static ListStub newInstance(PersistentClassStub owner) {
- return new ListStub(new List(owner.persistentClass));
+ return new ListStub(newInstance(CL, owner));
}
@Override
@@ -26,7 +21,7 @@
}
public ValueStub getIndex() {
- return ValueStubFactory.createValueStub(list.getIndex());
+ return ValueStubFactory.createValueStub(invoke("getIndex")); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ManyToOneStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ManyToOneStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ManyToOneStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,27 +1,18 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.ManyToOne;
-import org.hibernate.mediator.Messages;
-
public class ManyToOneStub extends ToOneStub {
public static final String CL = "org.hibernate.mapping.ManyToOne";
//$NON-NLS-1$
- protected ManyToOne manyToOne;
-
protected ManyToOneStub(Object manyToOne) {
- super(manyToOne);
- if (manyToOne == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.manyToOne = (ManyToOne)manyToOne;
+ super(manyToOne, CL);
}
public static ManyToOneStub newInstance(TableStub table) {
- return new ManyToOneStub(new ManyToOne(table.table));
+ return new ManyToOneStub(newInstance(CL, table));
}
public String getReferencedEntityName() {
- return manyToOne.getReferencedEntityName();
+ return (String)invoke("getReferencedEntityName"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/MapStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/MapStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/MapStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,23 +1,14 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.Map;
-import org.hibernate.mediator.Messages;
-
public class MapStub extends IndexedCollectionStub {
public static final String CL = "org.hibernate.mapping.Map"; //$NON-NLS-1$
- protected Map map;
-
protected MapStub(Object map) {
- super(map);
- if (map == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.map = (Map)map;
+ super(map, CL);
}
public static MapStub newInstance(PersistentClassStub owner) {
- return new MapStub(new Map(owner.persistentClass));
+ return new MapStub(newInstance(CL, owner));
}
@Override
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/MappingsStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/MappingsStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/MappingsStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,21 +1,15 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.cfg.Mappings;
-import org.hibernate.mediator.Messages;
+import org.hibernate.mediator.base.HObject;
-public class MappingsStub {
+public class MappingsStub extends HObject {
public static final String CL = "org.hibernate.cfg.Mappings"; //$NON-NLS-1$
- protected Mappings mappings;
-
protected MappingsStub(Object mappings) {
- if (mappings == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.mappings = (Mappings)mappings;
+ super(mappings, CL);
}
public void addClass(PersistentClassStub persistentClass) {
- mappings.addClass(persistentClass.getPersistentClass());
+ invoke("addClass", persistentClass); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/NamingStrategyStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/NamingStrategyStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/NamingStrategyStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,59 +1,48 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.cfg.NamingStrategy;
-import org.hibernate.mediator.Messages;
+import org.hibernate.mediator.base.HObject;
-public class NamingStrategyStub {
+public class NamingStrategyStub extends HObject {
public static final String CL = "org.hibernate.cfg.NamingStrategy";
//$NON-NLS-1$
- protected NamingStrategy namingStrategy;
-
protected NamingStrategyStub(Object namingStrategy) {
- if (namingStrategy == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.namingStrategy = (NamingStrategy)namingStrategy;
+ super(namingStrategy, CL);;
}
-
- @SuppressWarnings("nls")
- public static String getClassName() {
- return "org.hibernate.cfg.NamingStrategy";
- }
public String classToTableName(String className) {
- return namingStrategy.classToTableName(className);
+ return (String)invoke("classToTableName", className); //$NON-NLS-1$
}
public String tableName(String tableName) {
- return namingStrategy.tableName(tableName);
+ return (String)invoke("tableName", tableName); //$NON-NLS-1$
}
public String columnName(String columnName) {
- return namingStrategy.columnName(columnName);
+ return (String)invoke("columnName", columnName); //$NON-NLS-1$
}
public String propertyToColumnName(String propertyName) {
- return namingStrategy.propertyToColumnName(propertyName);
+ return (String)invoke("propertyToColumnName", propertyName); //$NON-NLS-1$
}
public String joinKeyColumnName(String joinedColumn, String joinedTable) {
- return namingStrategy.joinKeyColumnName(joinedColumn, joinedTable);
+ return (String)invoke("joinKeyColumnName", joinedColumn, joinedTable);
//$NON-NLS-1$
}
public String collectionTableName(String ownerEntity, String ownerEntityTable,
String associatedEntity, String associatedEntityTable,
String propertyName) {
- return namingStrategy.collectionTableName(ownerEntity, ownerEntityTable,
+ return (String)invoke("collectionTableName", ownerEntity, ownerEntityTable,
//$NON-NLS-1$
associatedEntity, associatedEntityTable, propertyName);
}
public String logicalColumnName(String columnName, String propertyName) {
- return namingStrategy.logicalColumnName(columnName, propertyName);
+ return (String)invoke("logicalColumnName", columnName, propertyName);
//$NON-NLS-1$
}
public String foreignKeyColumnName(String propertyName, String propertyEntityName,
String propertyTableName, String referencedColumnName) {
- return namingStrategy.foreignKeyColumnName(propertyName,
+ return (String)invoke("foreignKeyColumnName", propertyName, //$NON-NLS-1$
propertyEntityName, propertyTableName, referencedColumnName);
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/OneToManyStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/OneToManyStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/OneToManyStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,35 +1,26 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.OneToMany;
-import org.hibernate.mediator.Messages;
-
public class OneToManyStub extends ValueStub {
public static final String CL = "org.hibernate.mapping.OneToMany";
//$NON-NLS-1$
- protected OneToMany oneToMany;
-
protected OneToManyStub(Object oneToMany) {
- super(oneToMany);
- if (oneToMany == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.oneToMany = (OneToMany)oneToMany;
+ super(oneToMany, CL);
}
public static OneToManyStub newInstance(PersistentClassStub owner) {
- return new OneToManyStub(new OneToMany(owner.persistentClass));
+ return new OneToManyStub(newInstance(CL, owner));
}
public void setAssociatedClass(PersistentClassStub associatedClass) {
- oneToMany.setAssociatedClass(associatedClass.persistentClass);
+ invoke("setAssociatedClass", associatedClass); //$NON-NLS-1$
}
public void setReferencedEntityName(String referencedEntityName) {
- oneToMany.setReferencedEntityName(referencedEntityName);
+ invoke("setReferencedEntityName", referencedEntityName); //$NON-NLS-1$
}
public PersistentClassStub getAssociatedClass() {
- return
PersistentClassStubFactory.createPersistentClassStub(oneToMany.getAssociatedClass());
+ return
PersistentClassStubFactory.createPersistentClassStub(invoke("getAssociatedClass"));
//$NON-NLS-1$
}
public Object accept(ValueVisitorStub visitor) {
@@ -37,6 +28,6 @@
}
public String getReferencedEntityName() {
- return oneToMany.getReferencedEntityName();
+ return (String)invoke("getReferencedEntityName"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/OneToOneStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/OneToOneStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/OneToOneStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,27 +1,18 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.OneToOne;
-import org.hibernate.mediator.Messages;
-
public class OneToOneStub extends ToOneStub {
public static final String CL = "org.hibernate.mapping.OneToOne";
//$NON-NLS-1$
- protected OneToOne oneToOne;
-
protected OneToOneStub(Object oneToOne) {
- super(oneToOne);
- if (oneToOne == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.oneToOne = (OneToOne)oneToOne;
+ super(oneToOne, CL);
}
public static OneToOneStub newInstance(TableStub table, PersistentClassStub owner) {
- return new OneToOneStub(new OneToOne(table.table, owner.persistentClass));
+ return new OneToOneStub(newInstance(CL, table, owner));
}
public String getEntityName() {
- return oneToOne.getEntityName();
+ return (String)invoke("getEntityName"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PersistentClassStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PersistentClassStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PersistentClassStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -3,49 +3,37 @@
import java.util.ArrayList;
import java.util.Iterator;
-import org.hibernate.mapping.Join;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Property;
-import org.hibernate.mediator.Messages;
+import org.hibernate.mediator.base.HObject;
-public abstract class PersistentClassStub {
+public abstract class PersistentClassStub extends HObject {
public static final String CL = "org.hibernate.mapping.PersistentClass";
//$NON-NLS-1$
- protected PersistentClass persistentClass;
-
protected PersistentClassStub(Object persistentClass) {
- if (persistentClass == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- if (persistentClass instanceof PersistentClassStub) {
- this.persistentClass = ((PersistentClassStub)persistentClass).persistentClass;
- } else {
- this.persistentClass = (PersistentClass)persistentClass;
- }
+ super(persistentClass, CL);
}
-
- protected PersistentClass getPersistentClass() {
- return persistentClass;
+
+ protected PersistentClassStub(Object persistentClass, String cn) {
+ super(persistentClass, cn);
}
public Boolean isAbstract() {
- return persistentClass.isAbstract();
+ return (Boolean)invoke("isAbstract"); //$NON-NLS-1$
}
public ValueStub getDiscriminator() {
- return ValueStubFactory.createValueStub(persistentClass.getDiscriminator());
+ return ValueStubFactory.createValueStub(invoke("getDiscriminator"));
//$NON-NLS-1$
}
public String getClassName() {
- return persistentClass.getClassName();
+ return (String)invoke("getClassName"); //$NON-NLS-1$
}
public String getEntityName() {
- return persistentClass.getEntityName();
+ return (String)invoke("getEntityName"); //$NON-NLS-1$
}
public PropertyStub getIdentifierProperty() {
- Object obj = persistentClass.getIdentifierProperty();
+ Object obj = invoke("getIdentifierProperty"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -54,7 +42,7 @@
@SuppressWarnings("unchecked")
public Iterator<PropertyStub> getPropertyIterator() {
- Iterator<Property> it = persistentClass.getPropertyIterator();
+ Iterator it = (Iterator)invoke("getPropertyIterator"); //$NON-NLS-1$
ArrayList<PropertyStub> al = new ArrayList<PropertyStub>();
while (it.hasNext()) {
Object obj = it.next();
@@ -66,7 +54,7 @@
}
public RootClassStub getRootClass() {
- Object obj = persistentClass.getRootClass();
+ Object obj = invoke("getRootClass"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -74,7 +62,7 @@
}
public PropertyStub getVersion() {
- Object obj = persistentClass.getVersion();
+ Object obj = invoke("getVersion"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -82,7 +70,7 @@
}
public TableStub getTable() {
- Object obj = persistentClass.getTable();
+ Object obj = invoke("getTable"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -91,7 +79,7 @@
@SuppressWarnings("unchecked")
public Iterator<JoinStub> getJoinIterator() {
- Iterator<Join> it = (Iterator<Join>)persistentClass.getJoinIterator();
+ Iterator it = (Iterator)invoke("getJoinIterator"); //$NON-NLS-1$
ArrayList<JoinStub> al = new ArrayList<JoinStub>();
while (it.hasNext()) {
Object obj = it.next();
@@ -103,15 +91,15 @@
}
public KeyValueStub getIdentifier() {
- return
(KeyValueStub)ValueStubFactory.createValueStub(persistentClass.getIdentifier());
+ return
(KeyValueStub)ValueStubFactory.createValueStub(invoke("getIdentifier"));
//$NON-NLS-1$
}
public PersistentClassStub getSuperclass() {
- return
PersistentClassStubFactory.createPersistentClassStub(persistentClass.getSuperclass());
+ return
PersistentClassStubFactory.createPersistentClassStub(invoke("getSuperclass"));
//$NON-NLS-1$
}
public PropertyStub getProperty(String propertyName) {
- Object obj = persistentClass.getProperty(propertyName);
+ Object obj = invoke("getProperty", propertyName); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -119,12 +107,12 @@
}
public String getNodeName() {
- return persistentClass.getNodeName();
+ return (String)invoke("getNodeName"); //$NON-NLS-1$
}
@SuppressWarnings("unchecked")
public Iterator<PropertyStub> getPropertyClosureIterator() {
- Iterator<Property> it =
(Iterator<Property>)persistentClass.getPropertyClosureIterator();
+ Iterator it = (Iterator)invoke("getPropertyClosureIterator"); //$NON-NLS-1$
ArrayList<PropertyStub> al = new ArrayList<PropertyStub>();
while (it.hasNext()) {
Object obj = it.next();
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PersistentClassStubFactory.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PersistentClassStubFactory.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PersistentClassStubFactory.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -7,23 +7,23 @@
return null;
}
final Class cl = value.getClass();
- if (0 == "org.hibernate.mapping.RootClass".compareTo(cl.getName())) {
//$NON-NLS-1$
+ if (0 == RootClassStub.CL.compareTo(cl.getName())) {
return new RootClassStub(value);
- //} else if (0 ==
"org.hibernate.mapping.PersistentClass".compareTo(cl.getName())) {
//$NON-NLS-1$
+ //} else if (0 == PersistentClassStub.CL.compareTo(cl.getName())) {
// return new PersistentClassStub(value);
- } else if (0 == "org.hibernate.mapping.Subclass".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == SubclassStub.CL.compareTo(cl.getName())) {
return new SubclassStub(value);
- } else if (0 ==
"org.hibernate.mapping.JoinedSubclass".compareTo(cl.getName())) { //$NON-NLS-1$
+ } else if (0 == JoinedSubclassStub.CL.compareTo(cl.getName())) {
return new JoinedSubclassStub(value);
- } else if (0 ==
"org.hibernate.mapping.SingleTableSubclass".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == SingleTableSubclassStub.CL.compareTo(cl.getName())) {
return new SingleTableSubclassStub(value);
- } else if (0 ==
"org.hibernate.mapping.UnionSubclass".compareTo(cl.getName())) { //$NON-NLS-1$
+ } else if (0 == UnionSubclassStub.CL.compareTo(cl.getName())) {
return new UnionSubclassStub(value);
}
return null;
}
public static PersistentClassStub createPersistentClassStub(PersistentClassStub value)
{
- return createPersistentClassStub(value.persistentClass);
+ return createPersistentClassStub(value.Obj());
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PrimitiveArrayStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PrimitiveArrayStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PrimitiveArrayStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,27 +1,18 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.PrimitiveArray;
-import org.hibernate.mediator.Messages;
-
public class PrimitiveArrayStub extends ArrayStub {
public static final String CL = "org.hibernate.mapping.PrimitiveArray";
//$NON-NLS-1$
- protected PrimitiveArray primitiveArray;
-
protected PrimitiveArrayStub(Object primitiveArray) {
- super(primitiveArray);
- if (primitiveArray == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.primitiveArray = (PrimitiveArray)primitiveArray;
+ super(primitiveArray, CL);
}
public static PrimitiveArrayStub newInstance(PersistentClassStub owner) {
- return new PrimitiveArrayStub(new PrimitiveArray(owner.persistentClass));
+ return new PrimitiveArrayStub(newInstance(CL, owner));
}
public void setElement(ValueStub element) {
- primitiveArray.setElement(element.value);
+ invoke("setElement", element); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PropertyStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PropertyStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/PropertyStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,106 +1,96 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.Property;
-import org.hibernate.mediator.Messages;
+import org.hibernate.mediator.base.HObject;
-public class PropertyStub {
+public class PropertyStub extends HObject {
public static final String CL = "org.hibernate.mapping.Property";
//$NON-NLS-1$
- protected Property property;
-
protected PropertyStub(Object property) {
- if (property == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- if (property instanceof PropertyStub) {
- this.property = ((PropertyStub)property).property;
- } else {
- this.property = (Property)property;
- }
+ super(property, CL);
}
public static PropertyStub newInstance() {
- return new PropertyStub(new Property());
+ return new PropertyStub(newInstance(CL));
}
public void setName(String name) {
- property.setName(name);
+ invoke("setName", name); //$NON-NLS-1$
}
public void setValue(ValueStub value) {
- property.setValue(value.value);
+ invoke("setValue", value); //$NON-NLS-1$
}
public ValueStub getValue() {
- return ValueStubFactory.createValueStub(property.getValue());
+ return ValueStubFactory.createValueStub(invoke("getValue")); //$NON-NLS-1$
}
public void setCascade(String cascade) {
- property.setCascade(cascade);
+ invoke("setCascade", cascade); //$NON-NLS-1$
}
public String getName() {
- return property.getName();
+ return (String)invoke("getName"); //$NON-NLS-1$
}
public TypeStub getType() {
- return TypeStubFactory.createTypeStub(property.getType());
+ return TypeStubFactory.createTypeStub(invoke("getType")); //$NON-NLS-1$
}
public PersistentClassStub getPersistentClass() {
- return
PersistentClassStubFactory.createPersistentClassStub(property.getPersistentClass());
+ return
PersistentClassStubFactory.createPersistentClassStub(invoke("getPersistentClass"));
//$NON-NLS-1$
}
public void setPersistentClass(PersistentClassStub ownerClass) {
- property.setPersistentClass(ownerClass.persistentClass);
+ invoke("setPersistentClass", ownerClass); //$NON-NLS-1$
}
public boolean isSelectable() {
- return property.isSelectable();
+ return (Boolean)invoke("isSelectable"); //$NON-NLS-1$
}
public boolean isInsertable() {
- return property.isInsertable();
+ return (Boolean)invoke("isInsertable"); //$NON-NLS-1$
}
public boolean isUpdateable() {
- return property.isUpdateable();
+ return (Boolean)invoke("isUpdateable"); //$NON-NLS-1$
}
public boolean isLazy() {
- return property.isLazy();
+ return (Boolean)invoke("isLazy"); //$NON-NLS-1$
}
public boolean isOptional() {
- return property.isOptional();
+ return (Boolean)invoke("isOptional"); //$NON-NLS-1$
}
public boolean isNaturalIdentifier() {
- return property.isNaturalIdentifier();
+ return (Boolean)invoke("isNaturalIdentifier"); //$NON-NLS-1$
}
public boolean isOptimisticLocked() {
- return property.isOptimisticLocked();
+ return (Boolean)invoke("isOptimisticLocked"); //$NON-NLS-1$
}
public String getCascade() {
- return property.getCascade();
+ return (String)invoke("getCascade"); //$NON-NLS-1$
}
public String getNodeName() {
- return property.getNodeName();
+ return (String)invoke("getNodeName"); //$NON-NLS-1$
}
public boolean isBackRef() {
- return property.isBackRef();
+ return (Boolean)invoke("isBackRef"); //$NON-NLS-1$
}
public boolean isComposite() {
- return property.isComposite();
+ return (Boolean)invoke("isComposite"); //$NON-NLS-1$
}
public String getPropertyAccessorName() {
- return property.getPropertyAccessorName();
+ return (String)invoke("getPropertyAccessorName"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/RootClassStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/RootClassStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/RootClassStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -3,41 +3,27 @@
import java.util.ArrayList;
import java.util.Iterator;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.Subclass;
-import org.hibernate.mediator.Messages;
-
public class RootClassStub extends PersistentClassStub {
public static final String CL = "org.hibernate.mapping.RootClass";
//$NON-NLS-1$
- protected RootClass rootClass;
-
protected RootClassStub(Object rootClass) {
- super(rootClass);
- if (rootClass == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- if (rootClass instanceof RootClassStub) {
- this.rootClass = ((RootClassStub)rootClass).rootClass;
- } else {
- this.rootClass = (RootClass)rootClass;
- }
+ super(rootClass, CL);
}
public static RootClassStub newInstance() {
- return new RootClassStub(new RootClass());
+ return new RootClassStub(newInstance(CL));
}
public String getClassName() {
- return rootClass.getClassName();
+ return (String)invoke("getClassName"); //$NON-NLS-1$
}
public void setDiscriminator(ValueStub discr) {
- rootClass.setDiscriminator(discr.value);
+ invoke("setDiscriminator", discr); //$NON-NLS-1$
}
public TableStub getTable() {
- Object obj = rootClass.getTable();
+ Object obj = invoke("getTable"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -45,15 +31,15 @@
}
public void addProperty(PropertyStub p) {
- rootClass.addProperty(p.property);
+ invoke("addProperty", p); //$NON-NLS-1$
}
public void setIdentifierProperty(PropertyStub p) {
- rootClass.setIdentifierProperty(p.property);
+ invoke("setIdentifierProperty", p); //$NON-NLS-1$
}
public PropertyStub getIdentifierProperty() {
- Object obj = rootClass.getIdentifierProperty();
+ Object obj = invoke("getIdentifierProperty"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -61,144 +47,144 @@
}
public void setEntityName(String entityName) {
- rootClass.setEntityName(entityName);
+ invoke("setEntityName", entityName); //$NON-NLS-1$
}
public void setClassName(String className) {
- rootClass.setClassName(className);
+ invoke("setClassName", className); //$NON-NLS-1$
}
public void setProxyInterfaceName(String proxyInterfaceName) {
- rootClass.setProxyInterfaceName(proxyInterfaceName);
+ invoke("setProxyInterfaceName", proxyInterfaceName); //$NON-NLS-1$
}
public void setLazy(boolean lazy) {
- rootClass.setLazy(lazy);
+ invoke("setLazy", lazy); //$NON-NLS-1$
}
public void setTable(TableStub table) {
- rootClass.setTable(table.table);
+ invoke("setTable", table); //$NON-NLS-1$
}
public void setAbstract(Boolean isAbstract) {
- rootClass.setAbstract(isAbstract);
+ invoke("setAbstract", isAbstract); //$NON-NLS-1$
}
public String getNodeName() {
- return rootClass.getNodeName();
+ return (String)invoke("getNodeName"); //$NON-NLS-1$
}
public KeyValueStub getIdentifier() {
- return (KeyValueStub)ValueStubFactory.createValueStub(rootClass.getIdentifier());
+ return
(KeyValueStub)ValueStubFactory.createValueStub(invoke("getIdentifier"));
//$NON-NLS-1$
}
public boolean isCustomDeleteCallable() {
- return rootClass.isCustomDeleteCallable();
+ return (Boolean)invoke("isCustomDeleteCallable"); //$NON-NLS-1$
}
public boolean isCustomInsertCallable() {
- return rootClass.isCustomInsertCallable();
+ return (Boolean)invoke("isCustomInsertCallable"); //$NON-NLS-1$
}
public boolean isCustomUpdateCallable() {
- return rootClass.isCustomUpdateCallable();
+ return (Boolean)invoke("isCustomUpdateCallable"); //$NON-NLS-1$
}
public boolean isDiscriminatorInsertable() {
- return rootClass.isDiscriminatorInsertable();
+ return (Boolean)invoke("isDiscriminatorInsertable"); //$NON-NLS-1$
}
public boolean isDiscriminatorValueNotNull() {
- return rootClass.isDiscriminatorValueNotNull();
+ return (Boolean)invoke("isDiscriminatorValueNotNull"); //$NON-NLS-1$
}
public boolean isDiscriminatorValueNull() {
- return rootClass.isDiscriminatorValueNull();
+ return (Boolean)invoke("isDiscriminatorValueNull"); //$NON-NLS-1$
}
public boolean isExplicitPolymorphism() {
- return rootClass.isExplicitPolymorphism();
+ return (Boolean)invoke("isExplicitPolymorphism"); //$NON-NLS-1$
}
public boolean isForceDiscriminator() {
- return rootClass.isForceDiscriminator();
+ return (Boolean)invoke("isForceDiscriminator"); //$NON-NLS-1$
}
public boolean isInherited() {
- return rootClass.isInherited();
+ return (Boolean)invoke("isInherited"); //$NON-NLS-1$
}
public boolean isJoinedSubclass() {
- return rootClass.isJoinedSubclass();
+ return (Boolean)invoke("isJoinedSubclass"); //$NON-NLS-1$
}
public boolean isLazy() {
- return rootClass.isLazy();
+ return (Boolean)invoke("isLazy"); //$NON-NLS-1$
}
public boolean isLazyPropertiesCacheable() {
- return rootClass.isLazyPropertiesCacheable();
+ return (Boolean)invoke("isLazyPropertiesCacheable"); //$NON-NLS-1$
}
public boolean isMutable() {
- return rootClass.isMutable();
+ return (Boolean)invoke("isMutable"); //$NON-NLS-1$
}
public boolean isPolymorphic() {
- return rootClass.isPolymorphic();
+ return (Boolean)invoke("isPolymorphic"); //$NON-NLS-1$
}
public boolean isVersioned() {
- return rootClass.isVersioned();
+ return (Boolean)invoke("isVersioned"); //$NON-NLS-1$
}
public int getBatchSize() {
- return rootClass.getBatchSize();
+ return (Integer)invoke("getBatchSize"); //$NON-NLS-1$
}
public String getCacheConcurrencyStrategy() {
- return rootClass.getCacheConcurrencyStrategy();
+ return (String)invoke("getCacheConcurrencyStrategy"); //$NON-NLS-1$
}
public String getCustomSQLDelete() {
- return rootClass.getCustomSQLDelete();
+ return (String)invoke("getCustomSQLDelete"); //$NON-NLS-1$
}
public String getCustomSQLInsert() {
- return rootClass.getCustomSQLInsert();
+ return (String)invoke("getCustomSQLInsert"); //$NON-NLS-1$
}
public String getCustomSQLUpdate() {
- return rootClass.getCustomSQLUpdate();
+ return (String)invoke("getCustomSQLUpdate"); //$NON-NLS-1$
}
public String getDiscriminatorValue() {
- return rootClass.getDiscriminatorValue();
+ return (String)invoke("getDiscriminatorValue"); //$NON-NLS-1$
}
public String getLoaderName() {
- return rootClass.getLoaderName();
+ return (String)invoke("getLoaderName"); //$NON-NLS-1$
}
public int getOptimisticLockMode() {
- return rootClass.getOptimisticLockMode();
+ return (Integer)invoke("getOptimisticLockMode"); //$NON-NLS-1$
}
public String getTemporaryIdTableDDL() {
- return rootClass.getTemporaryIdTableDDL();
+ return (String)invoke("getTemporaryIdTableDDL"); //$NON-NLS-1$
}
public String getTemporaryIdTableName() {
- return rootClass.getTemporaryIdTableName();
+ return (String)invoke("getTemporaryIdTableName"); //$NON-NLS-1$
}
public String getWhere() {
- return rootClass.getWhere();
+ return (String)invoke("getWhere"); //$NON-NLS-1$
}
@SuppressWarnings("unchecked")
public Iterator<SubclassStub> getSubclassIterator() {
- Iterator<Subclass> it =
(Iterator<Subclass>)rootClass.getSubclassIterator();
+ Iterator it = (Iterator)invoke("getSubclassIterator"); //$NON-NLS-1$
ArrayList<SubclassStub> al = new ArrayList<SubclassStub>();
while (it.hasNext()) {
Object obj = it.next();
@@ -211,6 +197,6 @@
@Override
public ValueStub getDiscriminator() {
- return ValueStubFactory.createValueStub(rootClass.getDiscriminator());
+ return ValueStubFactory.createValueStub(invoke("getDiscriminator"));
//$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SelectableStubFactory.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SelectableStubFactory.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SelectableStubFactory.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -7,9 +7,9 @@
return null;
}
final Class cl = selectable.getClass();
- if (0 == "org.hibernate.mapping.Column".compareTo(cl.getName())) {
//$NON-NLS-1$
+ if (0 == ColumnStub.CL.compareTo(cl.getName())) {
return new ColumnStub(selectable);
- } else if (0 == "org.hibernate.mapping.Formula".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == FormulaStub.CL.compareTo(cl.getName())) {
return new FormulaStub(selectable);
}
return null;
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SessionStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SessionStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SessionStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -285,9 +285,9 @@
ConsoleQueryParameter parameter = qp[i];
try {
int pos = Integer.parseInt(parameter.getName());
- query.setParameter(pos, calcValue(parameter), parameter.getType().type);
+ query.setParameter(pos, calcValue(parameter), (Type)parameter.getType().Obj());
} catch (NumberFormatException nfe) {
- query.setParameter(parameter.getName(), calcValue(parameter),
parameter.getType().type);
+ query.setParameter(parameter.getName(), calcValue(parameter),
(Type)parameter.getType().Obj());
}
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SetStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SetStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SetStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,23 +1,14 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.Set;
-import org.hibernate.mediator.Messages;
-
public class SetStub extends CollectionStub {
public static final String CL = "org.hibernate.mapping.Set"; //$NON-NLS-1$
- protected Set set;
-
protected SetStub(Object set) {
- super(set);
- if (set == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.set = (Set)set;
+ super(set, CL);
}
public static SetStub newInstance(PersistentClassStub owner) {
- return new SetStub(new Set(owner.persistentClass));
+ return new SetStub(newInstance(CL, owner));
}
@Override
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SimpleValueStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SimpleValueStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SimpleValueStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -2,52 +2,47 @@
import java.util.Properties;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mediator.Messages;
-
public class SimpleValueStub extends KeyValueStub {
public static final String CL = "org.hibernate.mapping.SimpleValue";
//$NON-NLS-1$
- protected SimpleValue simpleValue;
-
protected SimpleValueStub(Object simpleValue) {
- super(simpleValue);
- if (simpleValue == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.simpleValue = (SimpleValue)simpleValue;
+ super(simpleValue, CL);
}
+
+ protected SimpleValueStub(Object simpleValue, String cn) {
+ super(simpleValue, cn);
+ }
public static SimpleValueStub newInstance() {
- return new SimpleValueStub(new SimpleValue());
+ return new SimpleValueStub(newInstance(CL));
}
public void setTypeName(String type) {
- simpleValue.setTypeName(type);
+ invoke("setTypeName", type); //$NON-NLS-1$
}
public void addColumn(ColumnStub column) {
- simpleValue.addColumn(column.column);
+ invoke("addColumn", column.column); //$NON-NLS-1$
}
public void setTable(TableStub table) {
- simpleValue.setTable(table.table);
+ invoke("setTable", table); //$NON-NLS-1$
}
public void setTypeParameters(Properties parameterMap) {
- simpleValue.setTypeParameters(parameterMap);
+ invoke("setTypeParameters" ,parameterMap); //$NON-NLS-1$
}
public String getForeignKeyName() {
- return simpleValue.getForeignKeyName();
+ return (String)invoke("getForeignKeyName"); //$NON-NLS-1$
}
public String getTypeName() {
- return simpleValue.getTypeName();
+ return (String)invoke("getTypeName"); //$NON-NLS-1$
}
public boolean isTypeSpecified() {
- return simpleValue.isTypeSpecified();
+ return (Boolean)invoke("isTypeSpecified"); //$NON-NLS-1$
}
@Override
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SubclassStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SubclassStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/SubclassStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,43 +1,38 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mapping.Subclass;
-import org.hibernate.mediator.Messages;
-
public class SubclassStub extends PersistentClassStub {
public static final String CL = "org.hibernate.mapping.Subclass";
//$NON-NLS-1$
- protected Subclass subclass;
-
protected SubclassStub(Object subclass) {
- super(subclass);
- if (subclass == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.subclass = (Subclass)subclass;
+ super(subclass, CL);
}
+ protected SubclassStub(Object subclass, String cn) {
+ super(subclass, cn);
+ }
+
public void setClassName(String className) {
- subclass.setClassName(className);
+ invoke("setClassName", className); //$NON-NLS-1$
}
public void setEntityName(String entityName) {
- subclass.setEntityName(entityName);
+ invoke("setEntityName", entityName); //$NON-NLS-1$
}
public void setDiscriminatorValue(String discriminatorValue) {
- subclass.setDiscriminatorValue(discriminatorValue);
+ invoke("setDiscriminatorValue", discriminatorValue); //$NON-NLS-1$
}
public void setAbstract(Boolean isAbstract) {
- subclass.setAbstract(isAbstract);
+ invoke("setAbstract", isAbstract); //$NON-NLS-1$
}
public void addProperty(PropertyStub p) {
- subclass.addProperty(p.property);
+ invoke("addProperty", p); //$NON-NLS-1$
}
public TableStub getRootTable() {
- Object obj = subclass.getRootTable();
+ Object obj = invoke("getRootTable"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -45,6 +40,6 @@
}
public boolean isJoinedSubclass() {
- return subclass.isJoinedSubclass();
+ return (Boolean)invoke("isJoinedSubclass"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TableStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TableStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TableStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -5,35 +5,26 @@
import org.hibernate.mapping.Column;
import org.hibernate.mapping.ForeignKey;
-import org.hibernate.mapping.Table;
import org.hibernate.mediator.Messages;
+import org.hibernate.mediator.base.HObject;
-public class TableStub {
+public class TableStub extends HObject {
public static final String CL = "org.hibernate.mapping.Table"; //$NON-NLS-1$
- protected Table table;
-
protected TableStub(Object table) {
- if (table == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.table = (Table)table;
+ super(table, CL);
}
- protected Table getTable() {
- return table;
- }
-
public static TableStub newInstance(String name) {
- return new TableStub(new Table(name));
+ return new TableStub(newInstance(CL, name));
}
public String getName() {
- return table.getName();
+ return (String)invoke("getName"); //$NON-NLS-1$
}
public PrimaryKeyStub getPrimaryKey() {
- Object obj = table.getPrimaryKey();
+ Object obj = invoke("getPrimaryKey"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -42,7 +33,7 @@
@SuppressWarnings("unchecked")
public Iterator<ForeignKeyStub> getForeignKeyIterator() {
- Iterator<ForeignKey> it =
(Iterator<ForeignKey>)table.getForeignKeyIterator();
+ Iterator<ForeignKey> it =
(Iterator<ForeignKey>)invoke("getForeignKeyIterator"); //$NON-NLS-1$
ArrayList<ForeignKeyStub> al = new ArrayList<ForeignKeyStub>();
while (it.hasNext()) {
Object obj = it.next();
@@ -54,15 +45,15 @@
}
public String getCatalog() {
- return table.getCatalog();
+ return (String)invoke("getCatalog"); //$NON-NLS-1$
}
public String getSchema() {
- return table.getSchema();
+ return (String)invoke("getSchema"); //$NON-NLS-1$
}
public KeyValueStub getIdentifierValue() {
- Object obj = table.getIdentifierValue();
+ Object obj = invoke("getIdentifierValue"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -75,7 +66,7 @@
@SuppressWarnings("unchecked")
public Iterator<ColumnStub> getColumnIterator() {
- Iterator<Column> it = (Iterator<Column>)table.getColumnIterator();
+ Iterator<Column> it =
(Iterator<Column>)invoke("getColumnIterator"); //$NON-NLS-1$
ArrayList<ColumnStub> al = new ArrayList<ColumnStub>();
while (it.hasNext()) {
Object obj = it.next();
@@ -87,30 +78,30 @@
}
public String getComment() {
- return table.getComment();
+ return (String)invoke("getComment"); //$NON-NLS-1$
}
public String getRowId() {
- return table.getRowId();
+ return (String)invoke("getRowId"); //$NON-NLS-1$
}
public String getSubselect() {
- return table.getSubselect();
+ return (String)invoke("getSubselect"); //$NON-NLS-1$
}
public boolean hasDenormalizedTables() {
- return table.hasDenormalizedTables();
+ return (Boolean)invoke("hasDenormalizedTables"); //$NON-NLS-1$
}
public boolean isAbstract() {
- return table.isAbstract();
+ return (Boolean)invoke("isAbstract"); //$NON-NLS-1$
}
public boolean isAbstractUnionTable() {
- return table.isAbstractUnionTable();
+ return (Boolean)invoke("isAbstractUnionTable"); //$NON-NLS-1$
}
public boolean isPhysicalTable() {
- return table.isPhysicalTable();
+ return (Boolean)invoke("isPhysicalTable"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ToOneStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ToOneStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ToOneStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,42 +1,29 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.FetchMode;
-import org.hibernate.mapping.ToOne;
-import org.hibernate.mediator.Messages;
-
public class ToOneStub extends SimpleValueStub {
public static final String CL = "org.hibernate.mapping.ToOne"; //$NON-NLS-1$
- protected ToOne toOne;
-
protected ToOneStub(Object toOne) {
- super(toOne);
- if (toOne == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.toOne = (ToOne)toOne;
+ super(toOne, CL);
}
+ protected ToOneStub(Object toOne, String cn) {
+ super(toOne, cn);
+ }
+
public void setReferencedEntityName(String referencedEntityName) {
- toOne.setReferencedEntityName(referencedEntityName);
+ invoke("setReferencedEntityName", referencedEntityName); //$NON-NLS-1$
}
public void setReferencedPropertyName(String name) {
- toOne.setReferencedPropertyName(name);
+ invoke("setReferencedPropertyName", name); //$NON-NLS-1$
}
public void setFetchMode(FetchModeStub fetchMode) {
- if (FetchModeStub.DEFAULT.equals(fetchMode)) {
- toOne.setFetchMode(FetchMode.DEFAULT);
- } else if (FetchModeStub.SELECT.equals(fetchMode)) {
- toOne.setFetchMode(FetchMode.SELECT);
- } else if (FetchModeStub.JOIN.equals(fetchMode)) {
- toOne.setFetchMode(FetchMode.JOIN);
- } else if (FetchModeStub.SUBSELECT.equals(fetchMode)) {
- }
+ invoke("setFetchMode", fetchMode); //$NON-NLS-1$
}
public boolean isEmbedded() {
- return toOne.isEmbedded();
+ return (Boolean)invoke("isEmbedded"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TypeStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TypeStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TypeStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -1,42 +1,40 @@
package org.hibernate.mediator.stubs;
-import org.hibernate.mediator.Messages;
-import org.hibernate.type.Type;
+import org.hibernate.mediator.base.HObject;
-public abstract class TypeStub {
+public abstract class TypeStub extends HObject {
public static final String CL = "org.hibernate.type.Type"; //$NON-NLS-1$
- protected Type type;
-
protected TypeStub(Object type) {
- if (type == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.type = (Type)type;
+ super(type, CL);
}
+ protected TypeStub(Object type, String cn) {
+ super(type, cn);
+ }
+
@SuppressWarnings("unchecked")
public Class getReturnedClass() {
- return type.getReturnedClass();
+ return (Class)invoke("getReturnedClass"); //$NON-NLS-1$
}
public boolean isCollectionType() {
- return type.isCollectionType();
+ return (Boolean)invoke("isCollectionType"); //$NON-NLS-1$
}
public boolean isEntityType() {
- return type.isEntityType();
+ return (Boolean)invoke("isEntityType"); //$NON-NLS-1$
}
public boolean isAnyType() {
- return type.isAnyType();
+ return (Boolean)invoke("isAnyType"); //$NON-NLS-1$
}
public boolean isComponentType() {
- return type.isComponentType();
+ return (Boolean)invoke("isComponentType"); //$NON-NLS-1$
}
public String getName() {
- return type.getName();
+ return (String)invoke("getName"); //$NON-NLS-1$
}
}
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TypeStubFactory.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TypeStubFactory.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/TypeStubFactory.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -9,13 +9,13 @@
return null;
}
final Class cl = value.getClass();
- if (ClassHelper.isClassOrOffspring(cl, "org.hibernate.type.CollectionType"))
{ //$NON-NLS-1$
+ if (ClassHelper.isClassOrOffspring(cl, CollectionTypeStub.CL)) {
return new CollectionTypeStub(value);
- //} else if (0 == "org.hibernate.type.Type".compareTo(cl.getName())) {
//$NON-NLS-1$
+ //} else if (0 == TypeStub.CL.compareTo(cl.getName())) {
// return new TypeStub(value);
- } else if (ClassHelper.isClassOrOffspring(cl,
"org.hibernate.type.EntityType")) { //$NON-NLS-1$
+ } else if (ClassHelper.isClassOrOffspring(cl, EntityTypeStub.CL)) {
return new EntityTypeStub(value);
- } else if (ClassHelper.isClassOrOffspring(cl,
"org.hibernate.type.NullableType")) { //$NON-NLS-1$
+ } else if (ClassHelper.isClassOrOffspring(cl, NullableTypeStub.CL)) {
return new NullableTypeStub(value);
}
return new AbstractTypeStub(value);
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ValueStub.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ValueStub.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ValueStub.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -4,23 +4,21 @@
import java.util.Iterator;
import org.hibernate.mapping.Selectable;
-import org.hibernate.mapping.Value;
-import org.hibernate.mediator.Messages;
+import org.hibernate.mediator.base.HObject;
-public abstract class ValueStub {
+public abstract class ValueStub extends HObject {
public static final String CL = "org.hibernate.mapping.Value"; //$NON-NLS-1$
- protected Value value;
-
protected ValueStub(Object value) {
- if (value == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.value = (Value)value;
+ super(value, CL);
}
+
+ protected ValueStub(Object value, String cn) {
+ super(value, cn);
+ }
public TableStub getTable() {
- Object obj = value.getTable();
+ Object obj = invoke("getTable"); //$NON-NLS-1$
if (obj == null) {
return null;
}
@@ -28,16 +26,16 @@
}
public boolean isSimpleValue() {
- return value.isSimpleValue();
+ return (Boolean)invoke("isSimpleValue"); //$NON-NLS-1$
}
public TypeStub getType() {
- return TypeStubFactory.createTypeStub(value.getType());
+ return TypeStubFactory.createTypeStub(invoke("getType")); //$NON-NLS-1$
}
@SuppressWarnings("unchecked")
public Iterator<SelectableStub> getColumnIterator() {
- Iterator<Selectable> it = (Iterator<Selectable>)value.getColumnIterator();
+ Iterator<Selectable> it =
(Iterator<Selectable>)invoke("getColumnIterator"); //$NON-NLS-1$
ArrayList<SelectableStub> al = new ArrayList<SelectableStub>();
while (it.hasNext()) {
Selectable obj = it.next();
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ValueStubFactory.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ValueStubFactory.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/ValueStubFactory.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -7,41 +7,41 @@
return null;
}
final Class cl = value.getClass();
- if (0 == "org.hibernate.mapping.Bag".compareTo(cl.getName())) {
//$NON-NLS-1$
+ if (0 == BagStub.CL.compareTo(cl.getName())) {
return new BagStub(value);
- //} else if (0 ==
"org.hibernate.mapping.IdentifierCollection".compareTo(cl.getName())) {
//$NON-NLS-1$
+ //} else if (0 ==
"org.hibernate.mapping.IdentifierCollection".compareTo(cl.getName())) {
// return new IdentifierCollectionStub(value);
- } else if (0 ==
"org.hibernate.mapping.IdentifierBag".compareTo(cl.getName())) { //$NON-NLS-1$
+ } else if (0 == IdentifierBagStub.CL.compareTo(cl.getName())) {
return new IdentifierBagStub(value);
- //} else if (0 ==
"org.hibernate.mapping.IndexedCollection".compareTo(cl.getName())) {
//$NON-NLS-1$
+ //} else if (0 ==
"org.hibernate.mapping.IndexedCollection".compareTo(cl.getName())) {
// return new IndexedCollectionStub(value);
- } else if (0 == "org.hibernate.mapping.List".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == ListStub.CL.compareTo(cl.getName())) {
return new ListStub(value);
- } else if (0 == "org.hibernate.mapping.Array".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == ArrayStub.CL.compareTo(cl.getName())) {
return new ArrayStub(value);
- } else if (0 ==
"org.hibernate.mapping.PrimitiveArray".compareTo(cl.getName())) { //$NON-NLS-1$
+ } else if (0 == PrimitiveArrayStub.CL.compareTo(cl.getName())) {
return new PrimitiveArrayStub(value);
- } else if (0 == "org.hibernate.mapping.Map".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == MapStub.CL.compareTo(cl.getName())) {
return new MapStub(value);
- } else if (0 == "org.hibernate.mapping.Set".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == SetStub.CL.compareTo(cl.getName())) {
return new SetStub(value);
- } else if (0 == "org.hibernate.mapping.OneToMany".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == OneToManyStub.CL.compareTo(cl.getName())) {
return new OneToManyStub(value);
- //} else if (0 == "org.hibernate.mapping.KeyValue".compareTo(cl.getName())) {
//$NON-NLS-1$
+ //} else if (0 == KeyValueStub.CL.compareTo(cl.getName())) {
// return new KeyValueStub(value);
- } else if (0 == "org.hibernate.mapping.SimpleValue".compareTo(cl.getName()))
{ //$NON-NLS-1$
+ } else if (0 == SimpleValueStub.CL.compareTo(cl.getName())) {
return new SimpleValueStub(value);
- } else if (0 == "org.hibernate.mapping.Any".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == AnyStub.CL.compareTo(cl.getName())) {
return new AnyStub(value);
- } else if (0 == "org.hibernate.mapping.Component".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == ComponentStub.CL.compareTo(cl.getName())) {
return new ComponentStub(value);
- } else if (0 ==
"org.hibernate.mapping.DependantValue".compareTo(cl.getName())) { //$NON-NLS-1$
+ } else if (0 == DependantValueStub.CL.compareTo(cl.getName())) {
return new DependantValueStub(value);
- } else if (0 == "org.hibernate.mapping.ToOne".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == ToOneStub.CL.compareTo(cl.getName())) {
return new ToOneStub(value);
- } else if (0 == "org.hibernate.mapping.ManyToOne".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == ManyToOneStub.CL.compareTo(cl.getName())) {
return new ManyToOneStub(value);
- } else if (0 == "org.hibernate.mapping.OneToOne".compareTo(cl.getName())) {
//$NON-NLS-1$
+ } else if (0 == OneToOneStub.CL.compareTo(cl.getName())) {
return new OneToOneStub(value);
}
return null;
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ClassHelper.java
===================================================================
---
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ClassHelper.java 2010-04-02
18:08:12 UTC (rev 21245)
+++
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ClassHelper.java 2010-04-02
18:54:14 UTC (rev 21246)
@@ -10,6 +10,12 @@
if (0 == name.compareTo(cl.getName())) {
return true;
}
+ Type[] types = cl.getInterfaces();
+ for (Type type : types) {
+ if (0 == name.compareTo(((Class<?>)type).getName())) {
+ return true;
+ }
+ }
Type type = cl.getGenericSuperclass();
if (type instanceof Class<?>) {
return isClassOrOffspring((Class<?>)type, name);