Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm
In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/tool/class2hbm
Modified Files:
MapGenerator.java ReflectedArrayProperty.java
ReflectedClass.java ReflectedCollectionProperty.java
ReflectedComponent.java ReflectedListProperty.java
ReflectedMapProperty.java ReflectedProperty.java
ReflectedSetProperty.java
Log Message:
reformatted code with beautiful, shiny, happy TABS!
improved an exception
Index: MapGenerator.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/MapGenerator.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** MapGenerator.java 1 Jan 2003 13:57:22 -0000 1.1.1.1
--- MapGenerator.java 4 Jan 2003 11:15:30 -0000 1.2
***************
*** 75,84 ****
*/
public class MapGenerator {
!
private static String defaultKeys[] = { "uid", "UID", "id", "ID", "key", "KEY", "pk", "PK" };
private ClassLoader classLoader;
private boolean verbose = true;
!
public static void main(String[] args) {
--- 75,84 ----
*/
public class MapGenerator {
!
private static String defaultKeys[] = { "uid", "UID", "id", "ID", "key", "KEY", "pk", "PK" };
private ClassLoader classLoader;
private boolean verbose = true;
!
public static void main(String[] args) {
***************
*** 87,99 ****
if( len == 0 ) {
System.out.println( "<!-- No args provided, no classes reflected! -->" );
! } else if( len == 1 && "--interact".equals(args[0]) ){
MapGenerator map = new MapGenerator( null, ClassLoader.getSystemClassLoader() );
map.interact();
! } else {
//MapGenerator map = new MapGenerator( args );
MapGenerator map = new MapGenerator( null, ClassLoader.getSystemClassLoader() );
for( int i=0; i<len; i++ ) {
if(args[i].startsWith("--")) {
!
/* Shouldn't all of these options be else if? (Everman) */
if(args[i].startsWith("--setUID=")) {
--- 87,101 ----
if( len == 0 ) {
System.out.println( "<!-- No args provided, no classes reflected! -->" );
! }
! else if( len == 1 && "--interact".equals(args[0]) ){
MapGenerator map = new MapGenerator( null, ClassLoader.getSystemClassLoader() );
map.interact();
! }
! else {
//MapGenerator map = new MapGenerator( args );
MapGenerator map = new MapGenerator( null, ClassLoader.getSystemClassLoader() );
for( int i=0; i<len; i++ ) {
if(args[i].startsWith("--")) {
!
/* Shouldn't all of these options be else if? (Everman) */
if(args[i].startsWith("--setUID=")) {
***************
*** 109,113 ****
catch( NumberFormatException e ) {
System.err.println("<!-- Can't set maxDepth "
! + e.getMessage() + "-->");
}
}
--- 111,115 ----
catch( NumberFormatException e ) {
System.err.println("<!-- Can't set maxDepth "
! + e.getMessage() + "-->");
}
}
***************
*** 118,122 ****
outputWriter = makeWriter( args[i].substring(9) );
}
!
//Next option added by Eric Everman 5-16-2002
//See protected abstractClasses for details
--- 120,124 ----
outputWriter = makeWriter( args[i].substring(9) );
}
!
//Next option added by Eric Everman 5-16-2002
//See protected abstractClasses for details
***************
*** 143,147 ****
}
}
!
private static FileWriter makeWriter( String fileName ) {
try {
--- 145,149 ----
}
}
!
private static FileWriter makeWriter( String fileName ) {
try {
***************
*** 155,163 ****
}
}
!
/** how low will you go? the depth of component nesting followed
*/
protected int maxDepth = 0;
!
/** candidate UID property names; presence of one of these with a
* supported type (String, Long, long) will stop
--- 157,165 ----
}
}
!
/** how low will you go? the depth of component nesting followed
*/
protected int maxDepth = 0;
!
/** candidate UID property names; presence of one of these with a
* supported type (String, Long, long) will stop
***************
*** 166,180 ****
*/
protected String[] niceKeys = defaultKeys;
!
/** the XML we make; this buffer is shared by all string emitters
* created by this MapGenerator instance
*/
protected StringBuffer buf;
!
/** a cache of seen reflected classes; Class -> ReflectedClass
* <br>also necessary to avoid infinite regress
*/
protected Hashtable rClasses;
!
/**
* <p>A list of class names which are treated as 'abstract' in that they are not
--- 168,182 ----
*/
protected String[] niceKeys = defaultKeys;
!
/** the XML we make; this buffer is shared by all string emitters
* created by this MapGenerator instance
*/
protected StringBuffer buf;
!
/** a cache of seen reflected classes; Class -> ReflectedClass
* <br>also necessary to avoid infinite regress
*/
protected Hashtable rClasses;
!
/**
* <p>A list of class names which are treated as 'abstract' in that they are not
***************
*** 197,201 ****
*/
protected Hashtable abstractClasses = new Hashtable(5);
!
/** a cache of emitted components for the current property; Class -> Integer
* <br>also necessary to avoid infinite regress by tracking
--- 199,203 ----
*/
protected Hashtable abstractClasses = new Hashtable(5);
!
/** a cache of emitted components for the current property; Class -> Integer
* <br>also necessary to avoid infinite regress by tracking
***************
*** 203,227 ****
*/
protected Hashtable cycleBuster;
!
/** just to prevent duplicate table names; String -> Integer
*/
private Hashtable usedTableNames;
!
/** just to prevent duplicate column names; String -> Integer
*/
private Hashtable usedColumnNames;
!
/** the top level collections; <br> currently just a placeholder
* because top level collections are not supported
*/
private Vector entities;
!
/** the top level (most souper) ReflectedClasses;
* <br>these are the classes eventually dumped as <class> in the XML
*/
private Vector roots;
!
private char[] prefix = StringHelper.repeat("\t", 100).toCharArray();
!
/** the only MapGenerator constructor
*
--- 205,229 ----
*/
protected Hashtable cycleBuster;
!
/** just to prevent duplicate table names; String -> Integer
*/
private Hashtable usedTableNames;
!
/** just to prevent duplicate column names; String -> Integer
*/
private Hashtable usedColumnNames;
!
/** the top level collections; <br> currently just a placeholder
* because top level collections are not supported
*/
private Vector entities;
!
/** the top level (most souper) ReflectedClasses;
* <br>these are the classes eventually dumped as <class> in the XML
*/
private Vector roots;
!
private char[] prefix = StringHelper.repeat("\t", 100).toCharArray();
!
/** the only MapGenerator constructor
*
***************
*** 238,244 ****
}
}
!
private String interact_usage = "usage: class.name | uid=<newUID> | done";
!
/** won't somebody please make a GUI?
*/
--- 240,246 ----
}
}
!
private String interact_usage = "usage: class.name | uid=<newUID> | done";
!
/** won't somebody please make a GUI?
*/
***************
*** 249,253 ****
System.out.println(interact_usage);
System.out.print("? ");
! boolean allIsWell = true;
while( allIsWell ) {
int tt;
--- 251,255 ----
System.out.println(interact_usage);
System.out.print("? ");
! boolean allIsWell = true;
while( allIsWell ) {
int tt;
***************
*** 263,291 ****
case StreamTokenizer.TT_EOL: st.eolIsSignificant(false); break;
case StreamTokenizer.TT_NUMBER:
! System.out.println("number!? ");
! System.out.println(interact_usage);
! System.out.print("? ");
! break;
case StreamTokenizer.TT_WORD:
! String name = st.sval;
! if( "done".equals(name) ) {
! allIsWell = false;
! }
! else if( name.startsWith("uid=") ) {
! String uid = name.substring(4);
! System.out.print("niceKey(" + uid + ")=>" ); // debug
! addUID( uid );
! for( int i=0; i<niceKeys.length; i++ ) {
! System.out.print(" ");
! System.out.print(niceKeys[i]);
! }
! System.out.print("\n? ");
! }
! else {
! System.out.println("addClass(" + name + ")" ); // debug
! addClass( name, true );
! System.out.print("? ");
}
! break;
default: /* ignore */ break;
}
--- 265,293 ----
case StreamTokenizer.TT_EOL: st.eolIsSignificant(false); break;
case StreamTokenizer.TT_NUMBER:
! System.out.println("number!? ");
! System.out.println(interact_usage);
! System.out.print("? ");
! break;
case StreamTokenizer.TT_WORD:
! String name = st.sval;
! if( "done".equals(name) ) {
! allIsWell = false;
! }
! else if( name.startsWith("uid=") ) {
! String uid = name.substring(4);
! System.out.print("niceKey(" + uid + ")=>" ); // debug
! addUID( uid );
! for( int i=0; i<niceKeys.length; i++ ) {
! System.out.print(" ");
! System.out.print(niceKeys[i]);
}
! System.out.print("\n? ");
! }
! else {
! System.out.println("addClass(" + name + ")" ); // debug
! addClass( name, true );
! System.out.print("? ");
! }
! break;
default: /* ignore */ break;
}
***************
*** 293,297 ****
System.out.println( getXML() );
}
!
/**
* start over
--- 295,299 ----
System.out.println( getXML() );
}
!
/**
* start over
***************
*** 304,312 ****
this.usedTableNames = new Hashtable();
buf.append("<?xml version=\"1.0\"?>\n")
! .append("<!DOCTYPE hibernate-mapping PUBLIC\n")
! .append("\t\"-//Hibernate/Hibernate Mapping DTD//EN\"\n")
! .append("\t\"http://hibernate.sourceforge.net/hibernate-mapping.dtd\">\n");
}
!
/**
* add a class to the map and reflect upon it
--- 306,314 ----
this.usedTableNames = new Hashtable();
buf.append("<?xml version=\"1.0\"?>\n")
! .append("<!DOCTYPE hibernate-mapping PUBLIC\n")
! .append("\t\"-//Hibernate/Hibernate Mapping DTD//EN\"\n")
! .append("\t\"http://hibernate.sourceforge.net/hibernate-mapping.dtd\">\n");
}
!
/**
* add a class to the map and reflect upon it
***************
*** 321,330 ****
if( rc == null && verbose ) {
buf.append("<!-- ")
! .append(clazz.getName())
! .append(" cannot be added, no UID found! -->\n");
}
}
}
!
/**
* set the list of candidate UIDs to a single name
--- 323,332 ----
if( rc == null && verbose ) {
buf.append("<!-- ")
! .append(clazz.getName())
! .append(" cannot be added, no UID found! -->\n");
}
}
}
!
/**
* set the list of candidate UIDs to a single name
***************
*** 335,339 ****
niceKeys = uida;
}
!
/**
* add a new name to the front of the list of candidate UIDs
--- 337,341 ----
niceKeys = uida;
}
!
/**
* add a new name to the front of the list of candidate UIDs
***************
*** 353,357 ****
}
}
!
/** used by gui */
public ReflectedClass[] getRoots() {
--- 355,359 ----
}
}
!
/** used by gui */
public ReflectedClass[] getRoots() {
***************
*** 360,376 ****
return v;
}
!
private ReflectedClass reallyAdd( Class clazz, boolean verbose ) {
ReflectedClass rc = (ReflectedClass) rClasses.get(clazz);
! Class superclass = clazz.getSuperclass();
if( rc == null ) {
// not already added
rc = new ReflectedClass( this, clazz );
! }
else if( rc.isPersistent() ) {
if( verbose ) {
buf.append("<!-- ")
! .append(clazz.getName())
! .append(" already added -->\n");
}
return rc;
--- 362,378 ----
return v;
}
!
private ReflectedClass reallyAdd( Class clazz, boolean verbose ) {
ReflectedClass rc = (ReflectedClass) rClasses.get(clazz);
! Class superclass = clazz.getSuperclass();
if( rc == null ) {
// not already added
rc = new ReflectedClass( this, clazz );
! }
else if( rc.isPersistent() ) {
if( verbose ) {
buf.append("<!-- ")
! .append(clazz.getName())
! .append(" already added -->\n");
}
return rc;
***************
*** 381,405 ****
// add properties from superclasses
rc.addSuperclassProps();
! roots.add( rc );
! }
else if ( // added by Eric Everman on 5-16-2002
! superclass!=null &&
! abstractClasses.containsKey( superclass.getName() )
) {
//The user has requested that class diving go no farther by
//marking the next class up the chain as abstract.
!
rc.addSuperclassProps(); //add superclass props
!
if( rc.getUidProp( niceKeys ) != null ) {
//Thank goodness, its persistable
roots.add( rc );
! } else {
//User specified an abstract 'root' class which is not persistable
rc.setPersistent( false );
return null; //generic can't add message generated by addClass
}
!
! }
else {
// add superclasses 'til root is found
--- 383,408 ----
// add properties from superclasses
rc.addSuperclassProps();
! roots.add( rc );
! }
else if ( // added by Eric Everman on 5-16-2002
! superclass!=null &&
! abstractClasses.containsKey( superclass.getName() )
) {
//The user has requested that class diving go no farther by
//marking the next class up the chain as abstract.
!
rc.addSuperclassProps(); //add superclass props
!
if( rc.getUidProp( niceKeys ) != null ) {
//Thank goodness, its persistable
roots.add( rc );
! }
! else {
//User specified an abstract 'root' class which is not persistable
rc.setPersistent( false );
return null; //generic can't add message generated by addClass
}
!
! }
else {
// add superclasses 'til root is found
***************
*** 410,414 ****
// report!? (addClass will do it when it sees null)
return null;
! }
else {
ReflectedClass sup = reallyAdd( superclass, false ); // recurse
--- 413,417 ----
// report!? (addClass will do it when it sees null)
return null;
! }
else {
ReflectedClass sup = reallyAdd( superclass, false ); // recurse
***************
*** 423,427 ****
return rc;
}
!
class PEntity {
// we don't make these yet
--- 426,430 ----
return rc;
}
!
class PEntity {
// we don't make these yet
***************
*** 430,434 ****
}
}
!
/** used to make unique table and column names
* @param best is the desired name
--- 433,437 ----
}
}
!
/** used to make unique table and column names
* @param best is the desired name
***************
*** 457,461 ****
return nextName( best, usedColumnNames );
}
!
/** adds spaces to the front of lines in buf for indentation
* @param n indentation level
--- 460,464 ----
return nextName( best, usedColumnNames );
}
!
/** adds spaces to the front of lines in buf for indentation
* @param n indentation level
***************
*** 466,470 ****
buf.append( prefix, 0, e );
}
!
/** after all classes are added
* @return the XML
--- 469,473 ----
buf.append( prefix, 0, e );
}
!
/** after all classes are added
* @return the XML
***************
*** 489,493 ****
return buf.toString();
}
!
private Class checkClassNamed( String className, boolean v ) {
try {
--- 492,496 ----
return buf.toString();
}
!
private Class checkClassNamed( String className, boolean v ) {
try {
***************
*** 497,508 ****
catch( Exception e ) {
if(v) buf.append("<!-- Class ")
! .append(className)
! .append(" gave exception ")
! .append(e)
! .append(" -->\n");
return null;
}
}
!
/** this is the factory to make a ReflectedProperty
* <br>using this factory will insure that the property
--- 500,511 ----
catch( Exception e ) {
if(v) buf.append("<!-- Class ")
! .append(className)
! .append(" gave exception ")
! .append(e)
! .append(" -->\n");
return null;
}
}
!
/** this is the factory to make a ReflectedProperty
* <br>using this factory will insure that the property
***************
*** 516,520 ****
String tynm = cls.getName();
Type htyp = TypeFactory.basic(tynm);
!
if ( htyp != null ) {
return new ReflectedProperty( name, cls, this, "basic" );
--- 519,523 ----
String tynm = cls.getName();
Type htyp = TypeFactory.basic(tynm);
!
if ( htyp != null ) {
return new ReflectedProperty( name, cls, this, "basic" );
***************
*** 557,561 ****
}
}
!
/** verify that a class is <b>hibernate-persistable</b>
*
--- 560,564 ----
}
}
!
/** verify that a class is <b>hibernate-persistable</b>
*
***************
*** 603,607 ****
return null;
}
! */
// must have a default constructor
Constructor z;
--- 606,610 ----
return null;
}
! */
// must have a default constructor
Constructor z;
***************
*** 616,621 ****
// ugh
if(v) buf.append(c)
! .append(className)
! .append(" cannot be reflected due to a SecurityException! -->\n");
return null;
}
--- 619,624 ----
// ugh
if(v) buf.append(c)
! .append(className)
! .append(" cannot be reflected due to a SecurityException! -->\n");
return null;
}
***************
*** 634,639 ****
// ugh
if(v) buf.append(c)
! .append(className)
! .append(" cannot be reflected due to a SecurityException! -->\n");
return null;
}
--- 637,642 ----
// ugh
if(v) buf.append(c)
! .append(className)
! .append(" cannot be reflected due to a SecurityException! -->\n");
return null;
}
***************
*** 641,646 ****
if( z == null ) {
if(v) buf.append(c)
! .append(className)
! .append(" has no 0-arg constructor! -->\n");
return null;
}
--- 644,649 ----
if( z == null ) {
if(v) buf.append(c)
! .append(className)
! .append(" has no 0-arg constructor! -->\n");
return null;
}
***************
*** 648,657 ****
return clazz;
}
!
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
!
!
}
--- 651,660 ----
return clazz;
}
!
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
!
!
}
***************
*** 670,672 ****
--- 673,678 ----
*
*/
+
+
+
Index: ReflectedArrayProperty.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/ReflectedArrayProperty.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReflectedArrayProperty.java 1 Jan 2003 13:57:23 -0000 1.1.1.1
--- ReflectedArrayProperty.java 4 Jan 2003 11:15:30 -0000 1.2
***************
*** 6,10 ****
*/
class ReflectedArrayProperty extends ReflectedProperty {
!
protected ReflectedProperty element;
--- 6,10 ----
*/
class ReflectedArrayProperty extends ReflectedProperty {
!
protected ReflectedProperty element;
***************
*** 28,32 ****
this.element = map.makeProperty( roleName, elmcls );
// TO DO
! // if elmcls is a collection, it would be nice to make
// the top level collection template here with role name roleName
}
--- 28,32 ----
this.element = map.makeProperty( roleName, elmcls );
// TO DO
! // if elmcls is a collection, it would be nice to make
// the top level collection template here with role name roleName
}
***************
*** 41,49 ****
emitCollectionInCompositeStr(level);
}
!
! //<!ELEMENT array (key, index, (element|one-to-many|many-to-many|subcollection|composite-element))>
! // <!ATTLIST array role CDATA #REQUIRED>
! // <!ATTLIST array table CDATA #IMPLIED>
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
--- 41,49 ----
emitCollectionInCompositeStr(level);
}
!
! //<!ELEMENT array (key, index, (element|one-to-many|many-to-many|subcollection|composite-element))>
! // <!ATTLIST array role CDATA #REQUIRED>
! // <!ATTLIST array table CDATA #IMPLIED>
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
***************
*** 64,65 ****
--- 64,68 ----
}
}
+
+
+
Index: ReflectedClass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/ReflectedClass.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReflectedClass.java 1 Jan 2003 13:57:24 -0000 1.1.1.1
--- ReflectedClass.java 4 Jan 2003 11:15:30 -0000 1.2
***************
*** 10,16 ****
/** a ReflectedClass is created by MapGenerator instances for
! * every class encountered, from map.addClass(), while chasing the
* superclass chain, or grokking properties
! *
* @version 1.x
* @author <a href="mailto:dou...@al...">e</a>
--- 10,16 ----
/** a ReflectedClass is created by MapGenerator instances for
! * every class encountered, from map.addClass(), while chasing the
* superclass chain, or grokking properties
! *
* @version 1.x
* @author <a href="mailto:dou...@al...">e</a>
***************
*** 25,30 ****
private ReflectedProperty uid;
private boolean persistent; // true => persistent class or subclass
! // false => component or serializable
!
private Hashtable setprops;
private Hashtable getprops;
--- 25,30 ----
private ReflectedProperty uid;
private boolean persistent; // true => persistent class or subclass
! // false => component or serializable
!
private Hashtable setprops;
private Hashtable getprops;
***************
*** 44,48 ****
return clazz.getName();
}
!
/** used by gui */
public ReflectedProperty[] getProperties() {
--- 44,48 ----
return clazz.getName();
}
!
/** used by gui */
public ReflectedProperty[] getProperties() {
***************
*** 55,59 ****
return rp;
}
!
/** used by gui */
public ReflectedClass[] getSubclasses() {
--- 55,59 ----
return rp;
}
!
/** used by gui */
public ReflectedClass[] getSubclasses() {
***************
*** 62,66 ****
return v;
}
!
protected void addReflectedClass( ReflectedClass rc ) {
subs.add( rc );
--- 62,66 ----
return v;
}
!
protected void addReflectedClass( ReflectedClass rc ) {
subs.add( rc );
***************
*** 92,96 ****
return ( props.size() != 0 );
}
!
/** add to this class the properties of all its superclasses
*/
--- 92,96 ----
return ( props.size() != 0 );
}
!
/** add to this class the properties of all its superclasses
*/
***************
*** 105,110 ****
}
}
!
! /** dump the OR-Mapping XML for a root class and all of its subclasses
* that share a table and UID
*/
--- 105,110 ----
}
}
!
! /** dump the OR-Mapping XML for a root class and all of its subclasses
* that share a table and UID
*/
***************
*** 117,130 ****
map.emitPrefix(level);;
buf.append("<!-- ")
! .append(name)
! .append(" root -->\n");
// a root class -- polymorphic style
map.emitPrefix(level);;
buf.append("<class name=\"")
! .append(name)
! .append("\" table=\"")
! .append(map.tableNameFor(name))
! .append((subs.size() > 0) ? "\" discriminator-value=\"" + shortName : "")
! .append("\">\n");
// first find the uid
if( uid == null ) {
--- 117,130 ----
map.emitPrefix(level);;
buf.append("<!-- ")
! .append(name)
! .append(" root -->\n");
// a root class -- polymorphic style
map.emitPrefix(level);;
buf.append("<class name=\"")
! .append(name)
! .append("\" table=\"")
! .append(map.tableNameFor(name))
! .append((subs.size() > 0) ? "\" discriminator-value=\"" + shortName : "")
! .append("\">\n");
// first find the uid
if( uid == null ) {
***************
*** 132,138 ****
map.emitPrefix(level);
buf.append("<!-- NO UID!? class=\"")
! .append(name)
! .append("\" -->\n");
! } else {
uid.getUidXML(level+1, buf);
}
--- 132,139 ----
map.emitPrefix(level);
buf.append("<!-- NO UID!? class=\"")
! .append(name)
! .append("\" -->\n");
! }
! else {
uid.getUidXML(level+1, buf);
}
***************
*** 160,165 ****
buf.append("</class>\n");
}
!
! /** dump the OR-Mapping XML for a non-root class and all of its
* subclasses that share its table and UID
*/
--- 161,166 ----
buf.append("</class>\n");
}
!
! /** dump the OR-Mapping XML for a non-root class and all of its
* subclasses that share its table and UID
*/
***************
*** 171,181 ****
map.emitPrefix(level);;
buf.append("<!-- ")
! .append(name)
! .append(" -->\n");
// a sub class -- polymorphic style
map.emitPrefix(level);;
buf.append("<subclass name=\"")
! .append(name)
! .append("\">\n");
// now the properties already classified by heuristic
Enumeration ps = props.elements();
--- 172,182 ----
map.emitPrefix(level);;
buf.append("<!-- ")
! .append(name)
! .append(" -->\n");
// a sub class -- polymorphic style
map.emitPrefix(level);;
buf.append("<subclass name=\"")
! .append(name)
! .append("\">\n");
// now the properties already classified by heuristic
Enumeration ps = props.elements();
***************
*** 194,200 ****
buf.append("</subclass>\n");
}
!
/** dump the OR-Mapping XML for a class used as a component
! *
* @param propName the property name of the property containing this component
*/
--- 195,201 ----
buf.append("</subclass>\n");
}
!
/** dump the OR-Mapping XML for a class used as a component
! *
* @param propName the property name of the property containing this component
*/
***************
*** 206,218 ****
map.emitPrefix(level);;
buf.append("<!-- ")
! .append(name)
! .append(" -->\n");*/
// a component
map.emitPrefix(level);;
buf.append("<component name=\"")
! .append(propName)
! .append("\" class=\"")
! .append(name)
! .append("\">\n");
// now the properties already classified by heuristic
Enumeration ps = props.elements();
--- 207,219 ----
map.emitPrefix(level);;
buf.append("<!-- ")
! .append(name)
! .append(" -->\n");*/
// a component
map.emitPrefix(level);;
buf.append("<component name=\"")
! .append(propName)
! .append("\" class=\"")
! .append(name)
! .append("\">\n");
// now the properties already classified by heuristic
Enumeration ps = props.elements();
***************
*** 233,238 ****
map.emitPrefix(level);;
buf.append("<composite-element class=\"")
! .append(name)
! .append("\">\n");
// now the properties already classified by heuristic
Enumeration ps = props.elements();
--- 234,239 ----
map.emitPrefix(level);;
buf.append("<composite-element class=\"")
! .append(name)
! .append("\">\n");
// now the properties already classified by heuristic
Enumeration ps = props.elements();
***************
*** 247,251 ****
buf.append("</composite-element>\n");
}
!
protected void getXMLasMany2Many(int level) {
// dumps in buf
--- 248,252 ----
buf.append("</composite-element>\n");
}
!
protected void getXMLasMany2Many(int level) {
// dumps in buf
***************
*** 255,264 ****
map.emitPrefix(level);;
buf.append("<many-to-many class=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\"/>\n");
}
!
private String capitalize( String s ) {
char c = s.charAt(0);
--- 256,265 ----
map.emitPrefix(level);;
buf.append("<many-to-many class=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\"/>\n");
}
!
private String capitalize( String s ) {
char c = s.charAt(0);
***************
*** 269,273 ****
/** called to determine if the class has a UID property
! *
* @param niceKeys an array of candidate UID names
* @return the UID ReflectedProperty
--- 270,274 ----
/** called to determine if the class has a UID property
! *
* @param niceKeys an array of candidate UID names
* @return the UID ReflectedProperty
***************
*** 327,331 ****
private void maybeAddProp( String name, Class type
! , Hashtable thisprops, Hashtable thatprops ) {
Object ty = thatprops.get( name );
if( ty == type ) {
--- 328,332 ----
private void maybeAddProp( String name, Class type
! , Hashtable thisprops, Hashtable thatprops ) {
Object ty = thatprops.get( name );
if( ty == type ) {
***************
*** 344,348 ****
maybeAddProp( name, type, setprops, getprops );
}
!
private void addGetter( String name, Class type ) {
maybeAddProp( name, type, getprops, setprops );
--- 345,349 ----
maybeAddProp( name, type, setprops, getprops );
}
!
private void addGetter( String name, Class type ) {
maybeAddProp( name, type, getprops, setprops );
***************
*** 377,381 ****
if( restyp == void.class && name.startsWith("set") ) {
addSetter( Introspector.decapitalize(name.substring(3))
! , argtyp[0] );
}
}
--- 378,382 ----
if( restyp == void.class && name.startsWith("set") ) {
addSetter( Introspector.decapitalize(name.substring(3))
! , argtyp[0] );
}
}
***************
*** 383,391 ****
if( name.startsWith("get") ) {
addGetter( Introspector.decapitalize(name.substring(3))
! , restyp );
}
else if( restyp == boolean.class && name.startsWith("is") ) {
addGetter( Introspector.decapitalize(name.substring(2))
! , restyp );
}
}
--- 384,392 ----
if( name.startsWith("get") ) {
addGetter( Introspector.decapitalize(name.substring(3))
! , restyp );
}
else if( restyp == boolean.class && name.startsWith("is") ) {
addGetter( Introspector.decapitalize(name.substring(2))
! , restyp );
}
}
***************
*** 396,401 ****
}
}
!
}
--- 397,405 ----
}
}
!
}
+
+
+
Index: ReflectedCollectionProperty.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/ReflectedCollectionProperty.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReflectedCollectionProperty.java 1 Jan 2003 13:57:24 -0000 1.1.1.1
--- ReflectedCollectionProperty.java 4 Jan 2003 11:15:31 -0000 1.2
***************
*** 6,10 ****
*/
class ReflectedCollectionProperty extends ReflectedProperty {
!
/**
* Constructor for ReflectedListProperty.
--- 6,10 ----
*/
class ReflectedCollectionProperty extends ReflectedProperty {
!
/**
* Constructor for ReflectedListProperty.
***************
*** 15,29 ****
super(name, type, map, "bag");
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitSubCollectionStr(level, name);
}
!
protected void getXMLinComposite( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionInCompositeStr(level);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
--- 15,29 ----
super(name, type, map, "bag");
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitSubCollectionStr(level, name);
}
!
protected void getXMLinComposite( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionInCompositeStr(level);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
***************
*** 37,38 ****
--- 37,41 ----
}
}
+
+
+
Index: ReflectedComponent.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/ReflectedComponent.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReflectedComponent.java 1 Jan 2003 13:57:25 -0000 1.1.1.1
--- ReflectedComponent.java 4 Jan 2003 11:15:31 -0000 1.2
***************
*** 16,22 ****
private ReflectedClass component; // my component
private int kind = KIND_UNKNOWN;
!
protected ReflectedComponent( String name, Class type
! , MapGenerator map, ReflectedClass comp )
{
super( name, type, map, "prospective-component" );
--- 16,22 ----
private ReflectedClass component; // my component
private int kind = KIND_UNKNOWN;
!
protected ReflectedComponent( String name, Class type
! , MapGenerator map, ReflectedClass comp )
{
super( name, type, map, "prospective-component" );
***************
*** 26,30 ****
private int determineKind() {
// this decision has to be delayed to avoid circularities
! // e.g., a component which includes itself will not have
// access to this info until it is fully processed
// but we cache it here...
--- 26,30 ----
private int determineKind() {
// this decision has to be delayed to avoid circularities
! // e.g., a component which includes itself will not have
// access to this info until it is fully processed
// but we cache it here...
***************
*** 55,82 ****
else {
buf.append("<!-- BUG unknown kind! name=\"")
! .append(name)
! .append("\" type=\"")
! .append(type.getName())
! .append("\" -->\n");
kind = KIND_BASIC;
return KIND_BASIC;
}
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
switch( determineKind() ) {
case KIND_BASIC:
! super.getXML( level, buf );
! break;
case KIND_COMPONENT:
! getXMLas(level, true);
! break;
case KIND_ASSOCIATION:
! component.getXMLasMany2Many(level);
! break;
default:
! emitPCommentStr(level, "BUG! unknown component kind", name, type.getName());
! break;
}
}
--- 55,82 ----
else {
buf.append("<!-- BUG unknown kind! name=\"")
! .append(name)
! .append("\" type=\"")
! .append(type.getName())
! .append("\" -->\n");
kind = KIND_BASIC;
return KIND_BASIC;
}
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
switch( determineKind() ) {
case KIND_BASIC:
! super.getXML( level, buf );
! break;
case KIND_COMPONENT:
! getXMLas(level, true);
! break;
case KIND_ASSOCIATION:
! component.getXMLasMany2Many(level);
! break;
default:
! emitPCommentStr(level, "BUG! unknown component kind", name, type.getName());
! break;
}
}
***************
*** 86,116 ****
getXMLinArray( level, buf );
}
!
protected void emitMany2OneStr(int level) {
map.emitPrefix(level);
buf.append("<many-to-one name=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\" class=\"")
! .append(tynm)
! .append("\"/>\n");
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
switch( determineKind() ) {
case KIND_BASIC:
! super.getXML( level, buf );
! return;
case KIND_COMPONENT:
! getXMLas(level, false); //go on...
! return;
case KIND_ASSOCIATION:
! emitMany2OneStr(level);
! return;
default:
! emitPCommentStr(level, "BUG! unknown component kind", name, type.getName());
! return;
}
}
--- 86,116 ----
getXMLinArray( level, buf );
}
!
protected void emitMany2OneStr(int level) {
map.emitPrefix(level);
buf.append("<many-to-one name=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\" class=\"")
! .append(tynm)
! .append("\"/>\n");
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
switch( determineKind() ) {
case KIND_BASIC:
! super.getXML( level, buf );
! return;
case KIND_COMPONENT:
! getXMLas(level, false); //go on...
! return;
case KIND_ASSOCIATION:
! emitMany2OneStr(level);
! return;
default:
! emitPCommentStr(level, "BUG! unknown component kind", name, type.getName());
! return;
}
}
***************
*** 144,147 ****
}
}
!
}
--- 144,150 ----
}
}
!
}
+
+
+
Index: ReflectedListProperty.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/ReflectedListProperty.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReflectedListProperty.java 1 Jan 2003 13:57:25 -0000 1.1.1.1
--- ReflectedListProperty.java 4 Jan 2003 11:15:31 -0000 1.2
***************
*** 6,10 ****
*/
class ReflectedListProperty extends ReflectedProperty {
!
/**
* Constructor for ReflectedListProperty.
--- 6,10 ----
*/
class ReflectedListProperty extends ReflectedProperty {
!
/**
* Constructor for ReflectedListProperty.
***************
*** 15,29 ****
super(name, type, map, "list");
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitSubCollectionStr(level, name);
}
!
protected void getXMLinComposite( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionInCompositeStr(level);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
--- 15,29 ----
super(name, type, map, "list");
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitSubCollectionStr(level, name);
}
!
protected void getXMLinComposite( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionInCompositeStr(level);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
***************
*** 38,39 ****
--- 38,42 ----
}
}
+
+
+
Index: ReflectedMapProperty.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/ReflectedMapProperty.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReflectedMapProperty.java 1 Jan 2003 13:57:25 -0000 1.1.1.1
--- ReflectedMapProperty.java 4 Jan 2003 11:15:31 -0000 1.2
***************
*** 6,10 ****
*/
class ReflectedMapProperty extends ReflectedProperty {
!
/**
* Constructor for ReflectedMapProperty.
--- 6,10 ----
*/
class ReflectedMapProperty extends ReflectedProperty {
!
/**
* Constructor for ReflectedMapProperty.
***************
*** 15,29 ****
super(name, type, map, "map");
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitSubCollectionStr(level, name);
}
!
protected void getXMLinComposite( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionInCompositeStr(level);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
--- 15,29 ----
super(name, type, map, "map");
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitSubCollectionStr(level, name);
}
!
protected void getXMLinComposite( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionInCompositeStr(level);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
***************
*** 38,39 ****
--- 38,42 ----
}
}
+
+
+
Index: ReflectedProperty.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/ReflectedProperty.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReflectedProperty.java 1 Jan 2003 13:57:27 -0000 1.1.1.1
--- ReflectedProperty.java 4 Jan 2003 11:15:31 -0000 1.2
***************
*** 14,27 ****
import net.sf.hibernate.type.CurrencyType;
! /** a ReflectedProperty is made by an instance of MapGenerator
* to model properties of Reflected classes;<br>
* basic properties are handled here: primitive, enum, custom;<br>
* subclasses handle more involved cases
! *
* @version 1.x
* @author <a href="mailto:dou...@al...">e</a>
*/
public class ReflectedProperty {
!
protected boolean isUid;
protected Class type;
--- 14,27 ----
import net.sf.hibernate.type.CurrencyType;
! /** a ReflectedProperty is made by an instance of MapGenerator
* to model properties of Reflected classes;<br>
* basic properties are handled here: primitive, enum, custom;<br>
* subclasses handle more involved cases
! *
* @version 1.x
* @author <a href="mailto:dou...@al...">e</a>
*/
public class ReflectedProperty {
!
protected boolean isUid;
protected Class type;
***************
*** 53,60 ****
shortTypeNames.put( Timestamp.class.getName(), Hibernate.TIMESTAMP.getName() );
shortTypeNames.put( java.util.Date.class.getName(), Hibernate.TIMESTAMP.getName() );
! shortTypeNames.put( java.sql.Date.class.getName(), Hibernate.DATE.getName() );
shortTypeNames.put( byte[].class.getName(), Hibernate.BINARY.getName() ); // not shorter, but nicer
! shortTypeNames.put( Blob.class.getName(), Hibernate.BLOB.getName() );
! shortTypeNames.put( Clob.class.getName(), Hibernate.CLOB.getName() );
}
--- 53,60 ----
shortTypeNames.put( Timestamp.class.getName(), Hibernate.TIMESTAMP.getName() );
shortTypeNames.put( java.util.Date.class.getName(), Hibernate.TIMESTAMP.getName() );
! shortTypeNames.put( java.sql.Date.class.getName(), Hibernate.DATE.getName() );
shortTypeNames.put( byte[].class.getName(), Hibernate.BINARY.getName() ); // not shorter, but nicer
! shortTypeNames.put( Blob.class.getName(), Hibernate.BLOB.getName() );
! shortTypeNames.put( Clob.class.getName(), Hibernate.CLOB.getName() );
}
***************
*** 65,69 ****
ReflectedProperty( String name, Class type
! , MapGenerator map, String comment ) {
this.name = name;
this.type = type;
--- 65,69 ----
ReflectedProperty( String name, Class type
! , MapGenerator map, String comment ) {
this.name = name;
this.type = type;
***************
*** 78,87 ****
return name;
}
!
/** used by gui */
public String getTypeName() {
return tynm;
}
!
protected boolean isUidOK() {
/*if( long.class == type ) return true;
--- 78,87 ----
return name;
}
!
/** used by gui */
public String getTypeName() {
return tynm;
}
!
protected boolean isUidOK() {
/*if( long.class == type ) return true;
***************
*** 92,105 ****
return ( !type.isArray() ); // since arrays never implement equals properly
}
!
protected void emitIntUidStr(int level) {
map.emitPrefix(level);
buf.append("<id name=\"")
! .append(name)
! .append("\" type=\"")
! .append(tynm) // or just use "long" ?
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\">\n");
map.emitPrefix(level+1);
buf.append("<generator class=\"hilo.long\"/>\n");
--- 92,105 ----
return ( !type.isArray() ); // since arrays never implement equals properly
}
!
protected void emitIntUidStr(int level) {
map.emitPrefix(level);
buf.append("<id name=\"")
! .append(name)
! .append("\" type=\"")
! .append(tynm) // or just use "long" ?
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\">\n");
map.emitPrefix(level+1);
buf.append("<generator class=\"hilo.long\"/>\n");
***************
*** 107,137 ****
buf.append("</id>\n");
}
!
protected void emitStrUidStr(int level) {
map.emitPrefix(level);
buf.append("<id name=\"" )
! .append(name)
! .append("\" type=\"")
! .append(tynm) // or just use "string" ?
! .append("\">\n");
map.emitPrefix(level+1);
buf.append("<column name=\"")
! .append(map.columnNameFor(name))
! .append("\" length=\"16\"/>\n");
map.emitPrefix(level+1);
buf.append("<generator class=\"hilo.hex\"/>\n");
map.emitPrefix(level);
buf.append("</id>\n");
! }
protected void emitPropertyStr(int level) {
map.emitPrefix(level);
buf.append("<property name=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\" type=\"")
! .append(tynm)
! .append("\"/>\n");
}
--- 107,137 ----
buf.append("</id>\n");
}
!
protected void emitStrUidStr(int level) {
map.emitPrefix(level);
buf.append("<id name=\"" )
! .append(name)
! .append("\" type=\"")
! .append(tynm) // or just use "string" ?
! .append("\">\n");
map.emitPrefix(level+1);
buf.append("<column name=\"")
! .append(map.columnNameFor(name))
! .append("\" length=\"16\"/>\n");
map.emitPrefix(level+1);
buf.append("<generator class=\"hilo.hex\"/>\n");
map.emitPrefix(level);
buf.append("</id>\n");
! }
protected void emitPropertyStr(int level) {
map.emitPrefix(level);
buf.append("<property name=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\" type=\"")
! .append(tynm)
! .append("\"/>\n");
}
***************
*** 139,159 ****
/*map.emitPrefix(level);
buf.append("<!-- ")
! .append(comment)
! .append(" name=\"")
! .append(name)
! .append("\" type=\"")
! .append(tynm)
! .append("\" -->\n");*/
}
protected void emitCollectionStrL( int level, String collection
! , String name, boolean lazy ) {
map.emitPrefix(level);
buf.append("<")
! .append(collection)
! .append(" role=\"" )
! .append(name)
! .append("\" table=\"")
! .append(map.tableNameFor(name));
if( lazy ) {
buf.append("\" lazy=\"true");
--- 139,159 ----
/*map.emitPrefix(level);
buf.append("<!-- ")
! .append(comment)
! .append(" name=\"")
! .append(name)
! .append("\" type=\"")
! .append(tynm)
! .append("\" -->\n");*/
}
protected void emitCollectionStrL( int level, String collection
! , String name, boolean lazy ) {
map.emitPrefix(level);
buf.append("<")
! .append(collection)
! .append(" role=\"" )
! .append(name)
! .append("\" table=\"")
! .append(map.tableNameFor(name));
if( lazy ) {
buf.append("\" lazy=\"true");
***************
*** 164,203 ****
map.emitPrefix(level);
buf.append("<key column=\"")
! .append(map.columnNameFor(key))
! .append("\"/>\n");
}
protected void emitCollectionStrI( int level, String idx ) {
map.emitPrefix(level);
buf.append("<index column=\"")
! .append(map.columnNameFor(idx))
! .append("\"/>\n");
}
protected void emitCollectionStrIT( int level, String idx, String type ) {
map.emitPrefix(level);
buf.append("<index column=\"")
! .append(map.columnNameFor(idx))
! .append("\" type =\"")
! .append(type)
! .append("\"/>\n");
}
protected void emitCollectionStrE( int level, String elm ) {
map.emitPrefix(level);
buf.append("<element column=\"")
! .append(map.columnNameFor(elm))
! .append("\"/>\n");
}
protected void emitCollectionStrET( int level, String elm, String type ) {
map.emitPrefix(level);
buf.append("<element column=\"")
! .append(map.columnNameFor(elm))
! .append("\" type =\"")
! .append(type)
! .append("\"/>\n");
}
protected void emitCollectionStrR( int level, String collection ) {
map.emitPrefix(level);
buf.append("</")
! .append(collection)
! .append(">\n");
}
//protected void emitCollectionStrLazy(int level) {
--- 164,203 ----
map.emitPrefix(level);
buf.append("<key column=\"")
! .append(map.columnNameFor(key))
! .append("\"/>\n");
}
protected void emitCollectionStrI( int level, String idx ) {
map.emitPrefix(level);
buf.append("<index column=\"")
! .append(map.columnNameFor(idx))
! .append("\"/>\n");
}
protected void emitCollectionStrIT( int level, String idx, String type ) {
map.emitPrefix(level);
buf.append("<index column=\"")
! .append(map.columnNameFor(idx))
! .append("\" type =\"")
! .append(type)
! .append("\"/>\n");
}
protected void emitCollectionStrE( int level, String elm ) {
map.emitPrefix(level);
buf.append("<element column=\"")
! .append(map.columnNameFor(elm))
! .append("\"/>\n");
}
protected void emitCollectionStrET( int level, String elm, String type ) {
map.emitPrefix(level);
buf.append("<element column=\"")
! .append(map.columnNameFor(elm))
! .append("\" type =\"")
! .append(type)
! .append("\"/>\n");
}
protected void emitCollectionStrR( int level, String collection ) {
map.emitPrefix(level);
buf.append("</")
! .append(collection)
! .append(">\n");
}
//protected void emitCollectionStrLazy(int level) {
***************
*** 206,240 ****
//}
! //<!ELEMENT subcollection (column*)>
! // <!ATTLIST subcollection column CDATA #IMPLIED>
! // <!ATTLIST subcollection role CDATA #REQUIRED>
! // <!ATTLIST subcollection length CDATA #IMPLIED>
! // <!ATTLIST subcollection not-null CDATA #IMPLIED>
!
protected void emitSubCollectionStr( int level, String name ) {
map.emitPrefix(level);
buf.append("<subcollection role=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\">\n");
}
!
! //<!ELEMENT collection (column*)>
! // <!ATTLIST collection name CDATA #REQUIRED>
! // <!ATTLIST collection role CDATA #IMPLIED>
! // <!ATTLIST collection column CDATA #IMPLIED>
! // <!ATTLIST collection length CDATA #IMPLIED>
! // <!ATTLIST collection not-null CDATA #IMPLIED>
!
protected void emitCollectionInCompositeStr(int level) {
map.emitPrefix(level);
buf.append("<collection name=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\">\n");
}
!
protected void getUidXML(int level, StringBuffer buf) {
this.buf = buf;
--- 206,240 ----
//}
! //<!ELEMENT subcollection (column*)>
! // <!ATTLIST subcollection column CDATA #IMPLIED>
! // <!ATTLIST subcollection role CDATA #REQUIRED>
! // <!ATTLIST subcollection length CDATA #IMPLIED>
! // <!ATTLIST subcollection not-null CDATA #IMPLIED>
!
protected void emitSubCollectionStr( int level, String name ) {
map.emitPrefix(level);
buf.append("<subcollection role=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\">\n");
}
!
! //<!ELEMENT collection (column*)>
! // <!ATTLIST collection name CDATA #REQUIRED>
! // <!ATTLIST collection role CDATA #IMPLIED>
! // <!ATTLIST collection column CDATA #IMPLIED>
! // <!ATTLIST collection length CDATA #IMPLIED>
! // <!ATTLIST collection not-null CDATA #IMPLIED>
!
protected void emitCollectionInCompositeStr(int level) {
map.emitPrefix(level);
buf.append("<collection name=\"" )
! .append(name)
! .append("\" column=\"")
! .append(map.columnNameFor(name))
! .append("\">\n");
}
!
protected void getUidXML(int level, StringBuffer buf) {
this.buf = buf;
***************
*** 253,262 ****
emitPropertyStr(level);
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionStrET(level, "elm", tynm);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
--- 253,262 ----
emitPropertyStr(level);
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionStrET(level, "elm", tynm);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
***************
*** 267,268 ****
--- 267,271 ----
}
}
+
+
+
Index: ReflectedSetProperty.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/class2hbm/ReflectedSetProperty.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ReflectedSetProperty.java 1 Jan 2003 13:57:27 -0000 1.1.1.1
--- ReflectedSetProperty.java 4 Jan 2003 11:15:31 -0000 1.2
***************
*** 6,10 ****
*/
class ReflectedSetProperty extends ReflectedProperty {
!
/**
* Constructor for ReflectedListProperty.
--- 6,10 ----
*/
class ReflectedSetProperty extends ReflectedProperty {
!
/**
* Constructor for ReflectedListProperty.
***************
*** 15,29 ****
super(name, type, map, "set");
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitSubCollectionStr(level, name);
}
!
protected void getXMLinComposite( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionInCompositeStr(level);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
--- 15,29 ----
super(name, type, map, "set");
}
!
protected void getXMLinArray( int level, StringBuffer buf ) {
this.buf = buf;
emitSubCollectionStr(level, name);
}
!
protected void getXMLinComposite( int level, StringBuffer buf ) {
this.buf = buf;
emitCollectionInCompositeStr(level);
}
!
protected void getXML( int level, StringBuffer buf ) {
this.buf = buf;
***************
*** 37,38 ****
--- 37,41 ----
}
}
+
+
+
|