How to copy the value of object in jdk 1.6

Hi,
I want to copy a object from another with out reference.
clone(0 is not accessable , only can use super.clone() , but if my class don't have the clone() method at all then ..
can any body tell me how i can do this..
thanks in advance

I think i have not able to describe the problem.
Well lets have a example
public class A{
String value1="";
public A(){
public String getValue1() {
          return value1;
     public void setValue1(String value1) {
          this.value1= value1;
Now ,
A object1 = new A();
object1.setValue1("first") ;
A object2 = new A();
object2 = object1;
here giving the reference ...so what is happening if i change object1, object2 will also be updated..
I don't want this ..instade of this i just want a copy of "object1" for object2 , so that object2 will always have same value and will not depend on object1 updation.
How to do that ? and i don't want also copying each variable value while coping.

Similar Messages

  • How to acess the value in object

    Hi All,
    I am trying to create a table and bound the arraylist object to it.so i created a method and set value to bean variables and added the bean object to arraylist
    and i created a datacontrol.The i dragged and dropped the dataHolder and created a table.when run this page its showing the object instead of value inside
    the object how to acess the value inside the object here.I also pasted the table code after dragging and dropping below
    public void setData() {
    TempleteBean bean =new TempleteBean();
    bean.setLanguage("english");
    bean.setOperation("test");
    dataHolder.add(bean);
    <af:table rows="#{bindings.dataHolder.rangeSize}"
    fetchSize="#{bindings.dataHolder.rangeSize}"
    emptyText="#{bindings.dataHolder.viewable ? 'No data to display.' : 'Access Denied.'}"
    var="row" rowBandingInterval="0"
    value="#{bindings.dataHolder.collectionModel}"
    selectedRowKeys="#{bindings.dataHolder.collectionModel.selectedRow}"
    selectionListener="#{bindings.dataHolder.collectionModel.makeCurrent}"
    rowSelection="single" id="t1">
    <af:forEach items="#{bindings.dataHolder.attributeDefs}" var="def">
    <af:column headerText="#{bindings.dataHolder.labels[def.name]}"
    sortable="true" sortProperty="#{def.name}" id="c1">
    <af:outputText value="#{row[def.name]}" id="ot1"/>
    </af:column>
    </af:forEach>
    </af:table>
    Regards,
    Smaran

    Hi,
    I think instead of
    #{row[def.name]}
    you would use
    #{row.bindings.row[def.name].inputValue}
    or something along this line.
    Frank

  • How to get the values from object ?

    hi everybody,
    i am experimenting with oops concept. first have a look at these coding and then tell me this.
    what do i have to do to get the value of an object created. i want to use the get method to get the name, food and quantity, without the use of the created object. i mean i want to make the process independent of how many objects i make so that i can find a value given the name of a person in the object.
    when this is done, i want to use this to create filed of a specific doc format for each object created. now when we are using the get method i want to read whats on the object value .
    Am i being clear or are thing very confusing, please let me know wht u think so i can clarify myself more.
    public class obj {
         String name;
         String food;
         int quantity;
         public void set(String ndata, String fdata,int qdata )
              this.name=ndata;
              this.food=fdata;
              this.quantity=qdata;
         public  void get()
              System.out.println( this.name+"  "+this.food+"  "+this.quantity);
         public static void main(String[] args) {
              obj obj1= new obj();
              obj1.set("varun", "burger", 2);
              obj obj2= new obj();
              obj1.set("roshan", "diet pepsi", 1);
              obj obj3= new obj();
              obj1.set("aman", "biryani", 2);
              obj2.get();
    }

    cyberpanther wrote:
    hi everybody,
    i am experimenting with oops concept. first have a look at these coding and then tell me this.
    what do i have to do to get the value of an object created. i want to use the get method to get the name, food and quantity, without the use of the created object. no. wrong.
    i mean i want to make the process independent of how many objects i make so that i can find a value given the name of a person in the object.no. sounds more like you're experimenting with drugs.
    when this is done, i want to use this to create filed of a specific doc format for each object created. now when we are using the get method i want to read whats on the object value .
    Am i being clear or are thing very confusing, please let me know wht u think so i can clarify myself more.you're clearly confused.
    public class obj {
         String name;
         String food;
         int quantity;
         public void set(String ndata, String fdata,int qdata )
              this.name=ndata;
              this.food=fdata;
              this.quantity=qdata;
         public  void get()
              System.out.println( this.name+"  "+this.food+"  "+this.quantity);
         public static void main(String[] args) {
              obj obj1= new obj();
              obj1.set("varun", "burger", 2);
              obj obj2= new obj();
              obj1.set("roshan", "diet pepsi", 1);
              obj obj3= new obj();
              obj1.set("aman", "biryani", 2);
              obj2.get();
    }utterly awful code. this is how it should not be done.
    %

  • How to copy the value to textbox ?

    Hi all,
    I have a web page coded with JSP and HTML tags.
    i am geting invoice amount (invamt) from previous page.
    In the current page, i have a textbox. for this text box, i want to assign the value of invamt as default. HOw do i do it?
    code as follows:
    <%String invamt=request.getParameter("invamt").trim();%>
    <FORM action="invreport1.jsp" method=post id=form2 name=form2 enctype="multipart/form-data">
    <TD>
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Inv.Amt.: </b></font>
    <input type="text"name="invamt"  title="Invoice Amount" value="<%=invamt%>"
    </td>my problem is: when i compile, it throws error as :
    undefined variable: invamt
    But, i want to assign this invamt value to the textbox value. HOw do i do it ??
    Thanks in advance for your time and help.
    Regards,
    Ashvini

    Try this way , hope it will work
    <%String invamt=""%>
    <% invamt=request.getParameter("invamt").trim();%>
    <FORM action="invreport1.jsp" method=post name=form2 enctype="multipart/form-data">
    <TD>
    <font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Inv.Amt.: </b></font>
    <input type="text"name="invamt" title="Invoice Amount" value="<%=invamt%>"
    </td>

  • How to copy the value of two tables into a view.

    Hi Experts ,
    I have a requirement in which i have been provided with two tables(T1,T2) of same table structure ,i need to copy their entries into a table view with the same structure as the two tables(T1,T2) .
    suppose T1 has entries name age T2 has entries
    A 20 D 40
    B 30 E 46
    C 40
    the view should have all the entries,duplicate values no issues ...
    Could you please suggest how can i do that ?
    Thanks and Regards
    Debashis

    if table have same structure then you can use
    select * from t1
    union all
    select * from t2

  • How to copy the value of default view textbox into another view textbox

    I create one form library and customizing in infopath 2010. on this default view one textbox is placed. in which user will enter his name.
    I create another view. in which i also place second textbox. I want when user put his name in default view textbox and save the form . then his name also copy into another view textbox .
    Kindly let me know how to do this ?

    Hi John,
    You can achieve in infopath. Steps are below:
    Default Text Box (Infopath Field A)
    Mirror Text Box (Infopath Field B)
    In Mirror Text Box, the default value would be the Field A. The default value you specified by right click on Mirror Text Box --> Properties...
    Thanks,

  • How to copy the contents of objects of one user to other without EXP ,IMP

    I have a user x, i want to copy all the object from x to y without exp and imp

    I suppose you could write a procedure using a bunch of DBMS_METADATA.GET_DDL() commands. Find out all the objects user x owns and loop through them, getting the ddl for each of them and executing the DDL for user y?

  • How to get the values of the objects inside an object??

    Hi,
    I am trying to write code to display name and memory usage of all session attributes, in a recursive way.
    I suppose reflection is needed here, but I can’t figure out how to get the values of the objects inside an object...
    private void handleIt(String attributeName, Object attributeValue) {
         boolean isPrimitiveOrNull = ((null == attributeValue) ||
              (attributeValue.getClass().isPrimitive()));                                         
         if (isPrimitiveOrNull) {
              sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "}");
         } else {
              sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "{");               
              Field[] fields = attributeValue.getClass().getDeclaredFields();
              int lim = fields.length;
              String name;
              Object value = null;
              for (int i = 0; i < lim; i++) {
                   name = fields.getName();
                   //LOOK AT THIS LINE: !!!!!!!!!!!!!!!!!!!!!!!!!!!
                   value = fields[i].get(obj); //I don´t know what 'obj' should be??
                   handleIt(name, value);
              sb.append("}");               
    Any suggestions will be greatly appreciated...

    I realized that massive int objects called MAX_VALUE, MIN_VALUE and SIZE where causing the StackOverflow, so I removed them from the analysis.
    This is the resultant code. But I think it isn’t accurate in calculating the real size of objects being got using reflexion.
    Do you or somebody have any more suggestions?
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.ObjectOutputStream;
    import java.lang.reflect.Field;
    import java.util.Enumeration;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class SessionMeasurer extends HttpServlet {
         private static final long serialVersionUID = 1470488362727841992L;
         private StringBuilder sb = new StringBuilder();
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              performTask(request, response);
         public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              performTask(request, response);
         public void performTask(HttpServletRequest request, HttpServletResponse response) {
              HttpSession     session = request.getSession(false);     
              String attributeName = "";
              Object attributeValue = null;
              for (Enumeration<?> attributeNames = session.getAttributeNames(); attributeNames.hasMoreElements();) {
                   attributeName = (String)attributeNames.nextElement();
                   attributeValue = session.getAttribute(attributeName);
                   handleIt(attributeName, attributeValue);               
              System.out.println(sb.toString());
         private void handleIt(String attributeName, Object attributeValue) {           
              if (attributeValue != null) {          
                   boolean isPrimitive = attributeValue.getClass().isPrimitive();
                   if (isPrimitive) {
                        sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "}");
                   } else {
                        sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "{");               
                        Field[] fields = attributeValue.getClass().getDeclaredFields();
                        String name;
                        Object value = null;
                        int lim = fields.length;
                        for (int i = 0; i < lim; i++) {
                             name = fields.getName();                                                                                                         
                             if (!name.endsWith("_VALUE") && !name.equals("SIZE") && !name.equals("serialVersionUID")) {
                                  try {
                                       value = fields[i].get(attributeValue);
                                  } catch(Exception e) {
                                       //PENDIENTE: Tratamiento excepción
                                  handleIt(name, value);
                        sb.append("}");               
         private int sizeOf(Object obj) {
              //Valid only for Serializables
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              ObjectOutputStream oos = null;     
              byte[] bytes = null;               
              try {          
                   oos = new ObjectOutputStream(baos);
                   oos.writeObject(obj);
                   bytes = baos.toByteArray();
              } catch(Exception e) {               
                   //PENDIENTE: Tratamiento excepción
              } finally {
                   if (oos != null) {
                        try {
                             oos.close();
                        } catch(Exception e) {
                             //PENDIENTE: Tratamiento excepción                         
                   if (baos != null) {
                        try {
                             baos.close();
                        } catch(Exception e) {
                             //PENDIENTE: Tratamiento excepción                         
              int size = -1;
              if (bytes != null) {
                   size = bytes.length;
              return size;          

  • How do I copy the value of a managed metadata field into a text column in the same list?

    I have a SharePoint designer workflow that I am trying to use to copy the value of a managed metadata field, into a text field. So basically my workflow is this...
    Stage 1: Set [MyColumnValue] to [%Current Item:MyColumn_0%]
    Go to End of Workflow
    This seems like a simple enough task, but each time an item is added or updated in my List, all I get for my new column [MyColumnValue] is just a link that says "Stage 1". Am I missing something here? Shouldn't this workflow be able to just copy
    the value from the managed metadata column to the text column?

    When you create a workflow on a list/library it automatically creates a new FIELD with the name of workflow and it's status. It sounds like you're viewing the Workflow status field, and not the field that the workflow is putting the values into. Make sense?
    So edit the view and add the new field in.

  • How to get the values from popup window to mainwindow

    HI all,
       I want to get the details from popup window.
          i have three input fields and one search button in my main window. when i click search button it should display popup window.whenever i click on selected row of the popup window table ,values should be visible in my main window input fields.(normal tables)
       now i am able to display popup window with values.How to get the values from popup window now.
       I can anybody explain me clearly.
    Thanks&Regards
    kranthi

    Hi Kranthi,
    Every webdynpro component has a global controller called the component controller which is visible to all other controllers within the component.So whenever you want to share some data in between 2 different views you can just make it a point to use the component controller's context for the same. For your requirement (within your popups view context) you will have have to copy the component controllers context to your view. You then will have to (programmatically) fill this context with your desired data in this popup view. You can then be able to read this context from whichever view you want. I hope that this would have made it clear for you. Am also giving you an [example|http://****************/Tutorials/WebDynproABAP/Modalbox/page1.htm] which you can go through which would give you a perfect understanding of all this. In this example the user has an input field in the main view. The user enters a customer number & presses on a pushbutton. The corresponding sales orders are then displayed in a popup window for the user. The user can then select any sales order & press on a button in the popup. These values would then get copied to the table in the main view.
    Regards,
    Uday

  • How to get the value from databank

    Hi,
    How to get the value from databank? and how to set the same value to visual script object?
    thanks,
    ra

    Hi,
    You can use GetDatabankValue(HeaderName, Value) to get the value from databank and SetDataBankValue(HeaderName, Value) to set the value to databank.
    You can refer to the API Reference to see list of associated functions and techniques we can use with related to Data Bank.
    This is the for OFT but if you are using Open Script then you have direct access for getting the databank value but when it comes to setting a value you have to use File operation and write you own methods to do the set operation.
    Thanks
    Edited by: Openscript User 100 on Nov 13, 2009 7:01 AM

  • How to retrieve the values from a table if they differ in Unit of Measure

    How to retrieve the values from a table if they differ in Unit of Measure?

    If no data is read
    - Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
    If no quanity in result internal table
    - There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
    - - Remove the CORRESPONDING, so quantity will fill the first field adqntp1.  ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
    - - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
    * Fill the internal table
    SELECT msehi adqntp
      INTO TABLE internal table
      FROM lipso2
      WHERE vbeln = wrk_doc1
        AND msehi IN ('KL','K15','MT').
    * If required move the read quantity in the appropriate column.
    LOOP AT internal_table ASSIGNING <fs>.
      CASE <fs>-msehi.
        WHEN 'K15'.
          <fs>-adqnt2 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
        WHEN 'MT'.
          <fs>-adqnt3 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
      ENDCASE.
    ENDLOOP.
    - You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
    Regards,
    Raymond

  • Copy the value of a cell in an other tab.

    Hi,
    First of all, I'm french. I hope you could understand my poor english.
    I've a got a form with a tab where u can ad or sup raws.
    I've gat a second tab.
    I'd like to copy the value of the cell (textfield) in a cell in the second tab.
    I've try "this.rawValue = evolution.forobj.tab1.r1.txt1.rawValue ;" in change event but it doesn't work.
    Thanks for your help.
    Nath

    Hi Nath,
    Your English is much better than my French
    The change event fires when the user is inputting data into the object that contains the script. As you have it in the change event of the object in tab 2, it does not fire at all when the user is inputting data into the object in tab 1.
    Also the change event needs xfa.event.newText and not .rawValue.
    I would recommend that you move the script to the calculate event of the object in tab 2. This way as soon as the user leaves the object in tab 1, the information will be undated in the object in tab 2.
    Good luck,
    Niall
    Assure Dynamics

  • How to capture the values given in SSC1 transcation?

    Hello All,
    Can anyone suggest me, how to capture the values given in SSC1 transaction?

    Hello Clemens Li,
    Requirement: Integration of SAP Appointment Calendar with Gmail Calendar
    If I create an appointment in SSC1 transaction, it will appear in SAP Appointment calendar. The same thing should get updated in Gmail calendar of SAP user and also in the guest Gmail calendar if exists in appointment.
    So, I have to capture the input values given in SSC1 transaction while creating an appointment in SAP and try to export those values to web services using some function module.  Sending those values to web services completes my task.
    Means, if I create an appointment in SAP, at the same time, the values which I gave must get exported to some object. So that I can send them to web services.
    But my actual problem is with capturing the input values given to SSC1 transaction.
    How can I get those values out to some internal table?
    Another one is, I did not found any BADI to enhance SSC1 transaction so that I can include my code there.
    If you know any enhancements in SSC1, please let me know.
    If you want any more clarification, please let me know.
    Thanks for the response
    DNR Varma

  • How to get the value of Keyboard Increment in illustrator?

    Hi! everyone,Good afternoon.
    Now I have a painful problem.
    How to get the value of Keyboard Increment in illustrator,JS? Like Object > Preferences > General >Keyboard Increment.

    this will do
    var keyboardIncrement = app.preferences.getRealPreference ('cursorKeyLength');
    alert(keyboardIncrement);

Maybe you are looking for

  • Menu items grayed out in Messages.

    Most menu items are grayed out in Messages: can't access preferences or account, among others. Just upgraded to Yosemite on Mid2010 Mac Pro.

  • Cross-Tab export to excel

    Hi I have a problem exporting crosstab to excel format from ASP page as sell as from crystal IDE. To be more specific the content if crosstab itself exports successfully, but i do have header titles above the crosstab I add in report design. These he

  • [windows 2008 R2 SP1] RPC Error 1726 (RPC_S_CALL_FAILED)

    Hi All Please do me a favor, thanks. Our program is facing RPC error 1726. When client program tried to call RPC call with specific paramters, it failed with error 1726 and no logs was outputed by server program. So it seems that this RPC call is not

  • Can you Help with my white map on Kingdoms of Camelot, Facebook game??

    Question I have a problem when playing Kingdoms of Camelot on Facebook, since updating to FF7. The map area is prdominantly white and it shouldn't be... Is there a video driver, or something, issue that a plugin can fix? I love FireFox and don't want

  • Photoshop Elements 11 on iMac 10.10.2. unresponsive.

    Application continues to go into unresponsive state. It hangs, eventually unhangs but as soon as I try to do anything with it, it goes into unresponsive state again. It has become completely unusable. I looked for answer on this forum but do not see