Generic class for deep cloning

How can I write generic class for deep cloning instead of implementing cloneable for each and every object

Yes, probably you'd need to use reflection. Though, generic deep copy brings up some issues not readily resolvable at run-time, such as, for example, does the object you want to copy refer to a shared or synchronized resource, such as a db connection? If so, by making a new, say, DBConnection object, you then take up a db connection that you really don't need or want to take up (db conns being scarce in many I.T. shops that own a limited number of Oracle or SQL Server, etc. db conn. licenses). Also, many classes these days are getting written that use "obj = classname.newInstance()" (with their constructors made private so you can't use "new SomeObject()") instead of the more commonsense and traditional "obj = new SomeObject()". [Hey, can anyone explain why it might be preferable to use "classname.newInstance()" at times over "new SomeObject()"?  I can't to this day tell why it might be better or why some hacks have started doing this.]
I am not saying either that you couldn't do it or that you shouldn't. In fact, if you wrote a really good generic deep copy class, it may very well suit your needs 95+% of the time. It'd be a great programming exercise that would likely result in something very useful to someone somewhere (yourself included), and would get you to really learn the reflect package, time generally well-spent. I also can see how it'd be a great exercise in writing recursive calls (if for example you'd like no limit to the depth of objects created within your deep-copied object). You may need to supply a few caveats for use, such as that there's no guarantee that objects within the object to be copied that don't have public constructors can be copied, and that objects that hold other objects that are limited in availablity due to their very natures, such as db connections, may not get fully copied. Another one may be that no object can be copied as long as a thread created and run from it is executing at the time the copy is done (because you couldn't guarantee the to-be-copied object instance's data or object reference state), or that perhaps in some cases, certain kinds of method-level (ie, what's officially called by Sun, "automatic") variables declared and used within, for example, blocks of code within methods, may not have their values copied correctly if they are not visible to the reflect pkg objects (though I'd have to look into that one myself to be sure it would be an issue).
Doing a search on "deep copy" or "deep clone" on java.sun.com as well as on the 'net reveals surprisingly little except suggestions for using object serialization to do all the dirty work for you.
I am surprised there isn't a kind of virtual working group trading ideas on the topic and trying collaboratively to come up with a good, solid generic deep copy class as a public service for all the Java brethren. Does anyone know of one? And if not, wanna start one?

Similar Messages

  • Hp LaserJet 1200 Generic Class: Waiting for device

    I have 2 computers that I want to print to my hp Laserjet 1200 printer. We are using an iogear 4-port usb 2.0 sharing switch. One computer prints fine but the other always displays a message "Generic Class: Waiting for device." Help!

    Both computers have the printer driver installed. The usb device does not have a driver to install. You just plug in the usb cords to each computer and the printer. You only install a driver if using a pc operating system.

  • Generic Java class for working with Context Nodes

    Hi,all
    I would like to write generic Java class for working with Context Nodes:
    populating node,
    add element to node,
    update node element,
    remove node element
    Any ideas how can I do it?

    Hi,Armin
    Thanks for your answer.
    I have many nodes with the same structure,but different data.
    I don't want to work with each one of them individually.
    This is the main reason.
    Regards,
    Michael
    Any ideas?

  • Support for generic classes

    hi,
    i m using creator 2 update 1, it does not support generic classes.
    it says use source 1.5 for generic classes.
    please tell me how to solve this problem
    thank you

    Well, not necessarily true... Most of the latest graphics cards work off of a common core, which is named depending on its maximum tested performance and on how many pipelines passed quality checks.
    Thus a 7300 is fundementally identical to a 7800, except that it uses fewer fragment/vertex pipelines and is clocked lower. This is done either artificially by disabling parts of the GPU, or if when they fail quality control.
    Either way, the drivers are the same, and have been unified for a long time for the entire product line. In fact if you look at the drivers for the card in yoru computer you will see they are more then likely for a different chipset. My MBP claims the drivers are for a X1000, even though the card is a X1600.

  • Deep Cloning problem

    I am having problems deep cloning a LinkedList object which contains serializable objects. I have tried using hand coded deep cloning and using the byteArray output and input streams.
    But nothing is working :(.
    My code currently looks like this:
    public LinkedList clones(LinkedList list){
       LinkedList deepCopy = new LinkedList();
       for(int x = 0; x < list.size(); x++){
          myClasstemp = new myClass((materials)list.get(x));
          deepCopy.add(new myClass(temp));
       return deepCopy;
    }cloning using just new myClass works when I am using individual objects, but when I try applying this to the new linkedlist, nothing happens. Is my error in the fact I am using .get? Or is it somewhere else in my code?
    My problem is that when I remove an object from the original LinkedList, the deepclone is changed as well.
    Message was edited by:
    DocterJ0208

    to be as detailed as possible, my problem is that I actually have 2 classes. One class is a structure object which contains basic properties like doubles and strings. And the other has doubles and strings as well and includes a LinkedList containing objects from the first class. To for an example, I have a student and School class where a School object contains a LinkedList holding all the students at the school.
    What I am trying to do is make a Cancel button. So, what I want is to make a copy of the original school, so if while editing the school, I decide I want to revert back to my original settings, I can by pressing the cancel button. So far, I can only accomplish this with the student class but not the School class. Does that make sense?

  • Deep Cloning of resultset object

    Hi, Is it possinble? Deep Cloning of resultset object?
    Resltset rs = pstmt.execute()
    Anyway to assign rs2 = rs1
    Because I am passing my resulset to a legacy application's method, that does a rs.close(). I need to use the same resultset later. JDK 1.4

    Write a dynamic proxy to the ResultSet where theclose() method does >nothing.
    What if the OP discovers that the app does a rs=null
    as well?How can that affect your code? Presumably the ResultSet is passed as an argument to a legacy method so the legacy method might set it's local reference to null it will not affect the reference held by the caller of the method.
    The op then runs thru hoops to get permission to
    modify a line in legacy code and is too distressed to
    post.He does not need to! You need to learn about Java argument passing.
    Anyway, thanks for the classrom solution. but i cant
    create another class file for extending rs.You have not presented any reason why not! This can be an inner class in the code you are writing and has no influence what so ever on the legacy application.
    >
    If you are too distressed by the posts here, you are
    under no obligation to reply to every one. Anyway , i
    found the postI replied because I had a viable solution to a problem you were having. Nothing you have said so far stops it being viable. Look at my posting history - I do not try to reply to everyone.
    >
    A Resultset is mainly a Java front end for adatabase
    cursor (which exists on the database server). When
    the ResultSet is closed, the cursor will be closed
    too so, even if you could copy everything in the
    ResultSet object, the handle for the cursor wouldno
    longer be valid.
    Which is why you use a Proxy so that you can control exactly what happens.
    >>
    To truely "deep copy" a resultset the depth would
    have to extend accros the database connection to
    cloning the cursor.I still don't see why you need to clone the ResultSet rather than use a proxy!
    >
    very much useful than the self pity expressed by
    you.No self pity! I just expressed annoyance at the lack of feedback from you and many others.
    No offence, none taken and none dealt.I still find it offensive when people don't bother with a simple acknowledgement. I don't ask many questions myself but when I do I make sure I track the responses and acknowledge those who try to help.
    I still think you should re-think your solution but you are free to totally ignore my very simple solution. I expect you will ignore it so the best of luck.

  • Problem in deep cloning

    Hai Friends,
    I am trying to use deep cloneing for copying objects and then setting the appropriate values to the properties of copied object. When we make deep clone copy, it is supposed to retain original property values. But in the example I tried, it shows only zeros. The source code and the output is given below. i seek your expertise and my advance thanks for any help to resolve my problem.
    * This class extends the class of Javas Point2D.Double
    import java.awt.geom.Point2D;
    import java.awt.Rectangle;
    import java.io.Serializable;
    import java.awt.Graphics2D;
    import javax.swing.JFrame;
    import java.awt.Graphics;
    import java.awt.Color;
    import java.awt.geom.AffineTransform;
    import java.util.ArrayList;
    import java.io.Serializable;
    import java.io.ObjectInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.ObjectOutputStream;
    import java.io.ByteArrayInputStream;
    import java.lang.ClassNotFoundException;
    import java.io.IOException;
    public class point2D extends Point2D.Double implements Cloneable, Serializable{
    // Properties
         Color drawColor =Color.red;
    * Constructor
    point2D(){ }
    point2D( double xx, double yy){ super(xx,yy); }
    public void setLocation( double xx, double yy){
         super.setLocation(xx,yy);}
    public void setDrawColor( Color drawColor){
         drawColor = this.drawColor;}
    * Draw a rectangle around through point.
    public Rectangle getPointRect(){
    int width = 4;
    return new Rectangle( (int)x-width/2,(int)y-width/2, width, width);
    * Check for a given point coinciding with point2D
    * location check is true, if it contains the point
    public boolean locationCheck( double x, double y){
         return getPointRect().contains((int)x,(int)y);
    * Draw method.
    public void draw( Graphics2D g2d ){
         g2d.setColor(drawColor);
    g2d.fill( getPointRect());
    public Object deepClone()
    try{
    ByteArrayOutputStream b = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(b);
    out.writeObject(this);
    out.close();
    ByteArrayInputStream bIn = new ByteArrayInputStream(b.toByteArray());
    ObjectInputStream oi = new ObjectInputStream(bIn);
    oi.close();
    return oi.readObject();
    catch (IOException e)
    { System.out.println("exception:"+e.getMessage());
    e.printStackTrace();
    return null;
    catch( ClassNotFoundException cnfe){
    System.out.println("exception:"+ cnfe.getMessage());
    cnfe.printStackTrace();
    return null;}          
    public static void main( String[] args){
         point2D pp = new point2D();
         pp.setLocation( 100.,150.);
         System.out.println( pp.locationCheck(100.5, 149.5));
    System.out.println( pp.getX() + " " + pp.getY());
         point2D ppp = (point2D)pp.deepClone();
    System.out.println( ppp.getX() + " " + ppp.getY());
    The output:
    true
    100.0 150.0
    0.0 0.0

    Hai sztejkat,
    I tried with adding methods to save and restore the state of the non-serializable class and it works.
    What is the reason to implement deep clone in point2D - this class does not contain any references >except Color, which is an immutable class and can be safely shared by multiple objects. In this case the >shallow copy will work fine. In my opinion the method you have choosen to implement deep copy is one >of the worst possible, looking from performance point of view. Shallow copy makes a new reference but pointing to the same object. My intension of deep copying was to create a new object. However, I fully agree with you that for simple instances of Point2D.Double, it is better to create a new onject using " new" operator than deepcopying.
    With best regards,
    Chinnaswamy

  • Deep cloning

    Hi i need to know how can I make deep cloning of own created array which will store the same array as well as other objects like Integer class and then array at element of array will again store another array or some other objects and then again at any element store array can store objects or array . I need to know how should i make deep cloning recuresively . and how should i write hash code and equals method for that class . please help me. I m feeling fustrated

    As a supplementary issue on this subject I am interested how to choose between the Arrays and the
    ArrayList classes. This thread suggests that Arrays is more versatile, although I usually use an
    ArrayList. Should I review this practice?Sorry. You read the thread incorrectly. :-)
    Arrays and ArrayList are completely different. java.util.Arrays has static methods for dealing with arrays. java.util.ArrayList is like a resizable array. java.util.Collections has static methods that can be used on java.util.ArrayList. Read the APIs, and you will see the difference.

  • Using static .values() method of Enum in Generic Class

    Hi *,
    I tried to do the following:
    public class AClass<E extends Enum<E> >  {
         public AClass() {
              E[] values = E.values(); // this DOESN'T work
              for (E e : values) { /* do something */ }
    }This is not possible. But how can I access all Enum constants if I use
    an Enum type parameter in a Generic class?
    Thanks for your help ;-) Stephan

    Here's a possible workaround. The generic class isn't adding much in this case; I originally wrote it as a static method that you simply passed the class to:
    public class Test21
      public static enum TestEnum { A, B, C };
      public static class AClass<E extends Enum<E>>
        private Class<E> clazz;
        public AClass(Class<E> _clazz)
        {  clazz = _clazz;  }
        public Class<E> getClazz()
        {  return clazz;  }
        public void printConstants()
          for (E e : clazz.getEnumConstants())
            System.out.println(e.toString());
      public static void main(String[] argv)
        AClass<TestEnum> a = new AClass<TestEnum>(TestEnum.class);
        a.printConstants();
    }

  • Error while creating the Generic Connector for flatfile

    Hi All,
    I was trying to create the Generic connector for the flat file reconciliation. But i was throwed into errors. I'm using 11.1.1.3 OIM and as well as SOA also. I have been following the OIM 9 document to create the GENERIC connector.
    i'm copying the error i got
    <Mar 14, 2012 3:48:12 PM IST> <Warning> <XELLERATE.SERVER> <BEA-000000> <readme.txt is not a valid connector resource file.>
    <Mar 14, 2012 3:48:12 PM IST> <Warning> <XELLERATE.SERVER> <BEA-000000> <readme.txt is not a valid connector resource file.>
    <Mar 14, 2012 3:48:12 PM IST> <Error> <XELLERATE.WEBAPP> <BEA-000000> <Class/Method: CreateConnectorAction/imageScreen encounter some problems: >
    java.lang.NullPointerException
    at oracle.iam.platform.utils.OIMMessageResourcesUtil.getConnectorResourcesFromFile(OIMMessageResourcesUtil.java:964)
    at oracle.iam.platform.utils.OIMMessageResourcesUtil.getConnectorResourceBundle(OIMMessageResourcesUtil.java:778)
    at oracle.iam.platform.utils.OIMMessageResourcesUtil.getConnectorResources(OIMMessageResourcesUtil.java:764)
    at com.thortech.xl.webclient.util.tcMessageResourcesUtil.getConnectorResources(tcMessageResourcesUtil.java:215)
    at com.thortech.xl.webclient.util.tcMessageResourcesUtil.getMsgFromConnectorRes(tcMessageResourcesUtil.java:238)
    at com.thortech.xl.webclient.util.tcMessageResourcesUtil.getLocalizedText(tcMessageResourcesUtil.java:66)
    at com.thortech.xl.webclient.util.UIFacade.getUserDefLocalizedLabels(UIFacade.java:3024)
    at com.thortech.xl.webclient.actions.CreateConnectorAction.imageScreen(CreateConnectorAction.java:1250)
    at com.thortech.xl.webclient.actions.CreateConnectorAction.goNext(CreateConnectorAction.java:521)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
    at com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(tcLookupDispatchAction.java:133)
    at com.thortech.xl.webclient.actions.tcActionBase.execute(tcActionBase.java:894)
    at com.thortech.xl.webclient.actions.tcAction.execute(tcAction.java:213)
    at com.thortech.xl.webclient.actions.CreateConnectorAction.execute(CreateConnectorAction.java:135)
    at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
    at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
    at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.am.agent.wls.filters.OAMServletAuthenticationFilter.doFilter(OAMServletAuthenticationFilter.java:260)
    at oracle.security.am.agent.wls.filters.OAMValidationSystemFilter.doFilter(OAMValidationSystemFilter.java:133)
    at oracle.security.wls.oamagent.OAMAgentWrapperFilter.doFilter(OAMAgentWrapperFilter.java:121)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.thortech.xl.webclient.security.XSSFilter.doFilter(XSSFilter.java:103)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.thortech.xl.webclient.security.CSRFFilter.doFilter(CSRFFilter.java:61)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.iam.platform.auth.web.PwdMgmtNavigationFilter.doFilter(PwdMgmtNavigationFilter.java:115)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.iam.platform.auth.web.OIMAuthContextFilter.doFilter(OIMAuthContextFilter.java:100)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    i'm just using a flat file which contents are normal.
    #GTC Trusted Source
    login,firstName,lastName,eMail,organization
    RDUDE,Robert,Dude,[email protected],Xellerate Users
    Can somebody help where i have done wrong for this. All my deployment is in oracle linux 4.5
    Thanks,
    Venkatesh

    Follow the doc for 11g, guide you might be missing something:
    http://docs.oracle.com/cd/E17904_01/doc.1111/e14309.pdf
    Highlevel configuration steps (not all and exact) are:
    -> Give it Name
    -> select Reconciliation
    -> Select Transport Provider and format provides
    -> select Trusted Source Reconciliation
    ->provide flat file details
    -> Source reconciliation staging and mapping
    ->finish
    regards,
    GP

  • Best way to call a function in a generic class from a base class

    Hi,
    I have a generic class that works with subclasses of some other baseclass. When I construct the subclass, I call the constructor of the baseclass which I want to call a function in the generic class. e.g. suppose I have the following classes
    public class List<T extends BaseClass>
        newTCreated(T t)
    }

    Sorry, I pressed Tab and Enter last time when typing the code so I posted without meaning to
    Hi,
    I have a generic class that works with subclasses of some other baseclass. When I construct the subclass, I call the constructor of the baseclass which I want to call a function in the generic class. e.g. suppose I have the following classes
    public class List<T extends BaseClass>
        public void newTCreated(T t)
            // add the t to some internal list
        public T getT(int index)
            // get the object from the internal list
    public class BaseClass
        public BaseClass(List<?> list)
            list.newTCreated(this);
    public class SubClass extends BaseClass
        public SubClass(List<SubCass> list)
            super(list);
    }This doesn't compile because of the call to newTCreated in the BaseClass constructor because BaseClass is not necessarily of type T. Is there any way of checking when I call the newTCreated function that the BaseClass is actually of type SubClass? I could either add the call explicitly in each SubClass's constructor or have a function addToList in BaseClass that is called from the BaseClass constructor but overloaded in each subclass but both of those rely on future subclasses doing the same. Or I could change the newTCreated function to take an argument of type BaseClass and then cast it to type T but this doesn't give a compilation error, only a runtime exception.
    It seems like there should be solution but having only recently started writing Generic classes I can't find it. Thanks in advance for any help,
    Tom

  • Getting the name of the generic class?

    I have a generic class declared as such:
    public class MyClass<T>
    and I want to access the name of the <T> class a member function in that class? I just can't figure out which syntax to use.
    Thank you!
    Joshua

    Sorry, I'm a little bit confused at your answer.
    I cannot seem to instantiate an object of class T, like: T item = new T();does not work. If I can't create an object of type T, then I can't get it's type. I need to get the class even if I don't have any instantiated objects (or if I can create a blank one), so that I can use the name to fetch the objects from the persistence engine. Here is the class, so you can see what I'm talking about. I have in there now what seems like it should be right, but doesn't compile.
    A small example of solution please?
    public class PersistentSelectorCellEditor<T> extends AbstractCellEditor
              implements TableCellEditor {
         JComboBox control;
         List<T> choices;
         Session session;
         public PersistentSelectorCellEditor() {
              initializeComponents();
         public PersistentSelectorCellEditor(Object value) {
              initializeComponents();
              this.control.setSelectedItem(value);
         private void initializePersistence() {
              session = LabApp.getSession();
              session.beginTransaction();
         private void initializeComponents() {
              initializePersistence();
              populateList();     //query for selections to fill combo box
              control = new JComboBox((ComboBoxModel)choices);
         private void populateList() {
              //query to populate drop down lists
              Query query = session.createQuery("from " + T.class.getName());
              choices = query.list();
         public void setValue(T value) {
              control.setSelectedItem(value);
         public T getValue() {
              return (T)control.getSelectedItem();
         //interface members
         public Object getCellEditorValue() {
              return control.getSelectedItem();
         public Component getTableCellEditorComponent(JTable table, Object value,
                   boolean isSelected, int row, int column) {
              return control;
    }Thank you!
    Joshua

  • What is the use of Generic class in java

    hi everyone,
    i want to know that
    what is the use of Generic class in java ?
    regards,
    dhruvang

    Simplistically...
    A method is a block of code that makes some Objects in the block of code abstract (those abstract Objects are the parameters of the method). This allows us to reuse the method passing in different Objects (arguments) each time.
    In a similar way, Generics allows us to take a Class and make some of the types in the class abstract. (These types are the type parameters of the class). This allows us to reuse the class, passing in different types each time we use it.
    We write type parameters (when we declare) and type arguments (when we use) inside < >.
    For example the List class has a Type Parameter which makes the type of the things in the list become abstract.
    A List<String> is a list of Strings, it has a method "void add(String)" and a method "String get(int)".
    A List<File> is a list of Files, it has a method "void add(File)" and a method "File get(int)".
    List is just one class (interface actually but don't worry about that), but we can specify different type arguments which means the methods use this abstract type rather than a fixed concrete type in their declarations.
    Why?
    You spend a little more effort describing your types (List<String> instead of just List), and as a benefit, you, and anyone else who reads your code, and the compiler (which also reads your code) know more accurately the types of things. Because more detail is known, the compiler is able to tell you when you screw up (as opposed to finding out at runtime). And people understand your code better.
    Once you get used to them, its a bit like the difference between black and white TV, and colour TV. When you see code that doesn't specify the type parameters, you just get the feeling that you are missing out on something. When I see an API with List as a return type or argument type, I think "List of what?". When I see List<String>, I know much more about that parameter or return type.
    Bruce

  • Dynamic Java bean classes for XSD using JAVA (not any external batch or sh)

    Hi,
    How can we generate dynamic Java bean classes for XSD (dynamically support All XSD at runtime)?
    Note: - Through java code via only needs to generate this process. (Not using any xjc.bat or xjc.sh from JAXB).
    Thanks

    Muthu wrote:
    How can we generate dynamic Java bean classes for XSD (dynamically support All XSD at runtime)?
    Pretty sure you can't. Probably can do a lot of them with years of work.
    And can probably can do a resonable subset suitable for the business at hand with only a moderate effort.
    Note: - Through java code via only needs to generate this process. (Not using any xjc.bat or xjc.sh from JAXB).The Sun jdk, not jre, comes with the java compiler as part of it. You can create in memory class (I believe in memory) based on java code you create.
    I believe BCEL alllows the same thing (in memory) but you start with byte codes.
    You could just create a dynamic meta data solution as well, via maps and generic methods. Not as fast though.

  • XI: How To Use JAVA generic Class to  perform SAP data Lookup........

    Hello All,
    I want to create a generic class which is used to perorm SAP data lookup.
    I don't want to use Jco or RFC channel..
    Is there any other way to do this?
    waiting for Reply 
    thank in advance.
    - AKSHAY.

    Hi,
    use RFC channel
    you can wrap it up like this:
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    why do you want to create something diffucult to maintin and non standard if
    you can use the RFC API ?
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

Maybe you are looking for