How to convert the class in the one package to same class in the other pack

How to convert the class in the one package to same class in the other package
example:
BeanDTO.java
package cho3.hello.bean;
public class BeanDTO {
private String name;
private int age;
* @return
public int getAge() {
     return age;
* @return
public String getName() {
     return name;
* @param i
public void setAge(int i) {
     age = i;
* @param string
public void setName(String string) {
     name = string;
BeanDTO.java in other package
package ch03.hello;
public class BeanDTO {
private String name;
private int age;
* @return
public int getAge() {
     return age;
* @return
public String getName() {
     return name;
* @param i
public void setAge(int i) {
     age = i;
* @param string
public void setName(String string) {
     name = string;
My converter lass lokks like
public class BeanUtilTest {
     public static void main(String[] args) {
          try
               ch03.hello.BeanDTO bean=new ch03.hello.BeanDTO();
          bean.setAge(10);
          bean.setName("mahesh");
          cho3.hello.bean.BeanDTO beanDto=new cho3.hello.bean.BeanDTO();
          ClassConverter classconv=new ClassConverter();
          //classconv.
          System.out.println("hi "+beanDto.getClass().toString());
          System.out.println("hi helli "+bean.toString()+" "+bean.getAge()+" "+bean.getName()+" "+bean.getClass());
          Object b=classconv.convert(beanDto.getClass(),(Object)bean);
          System.out.println(b.toString());
          beanDto= (cho3.hello.bean.BeanDTO)b;
          System.out.println(" "+beanDto.getAge()+" "+beanDto.getName() );
          }catch(Exception e)
               e.printStackTrace();
But its giving class cast exception. Please help on this..

Do you mean "two different layers" as in separate JVMs or "two different layers" as in functional areas running within the same JVM.
In either case, if the first class is actually semantically and functionally the same as the second (and they are always intended to be the same) then import and and use the first class in place of the second. That's beyond any question of how to get the data of the first into the second if and when you need to.
Once you make the breakthrough and use one class instead of two I'd guess that almost solves your problem. But if you want to describe your architecture a little that would help others pin down want you're trying to do.

Similar Messages

  • How to convert the javasource file(*.class) to execute file(*.exe)?

    How to convert the javasource file(*.class) to execute file(*.exe)?
    thank you!

    Although i have seen a few programs (that are platform specific) that will embed a small jvm into an exe with your class file, it is generally excepted that you cannot create an executable file using java. The JAR executable file is probably the closest your going to get
    Pete

  • How to Convert the Warning Message to Error Message in Standard Transaction

    Hi,
        I face one problem in Standard Transaction Code CS02. In that  by entering the material Number, Plant, bomstatus press enter. it gives a warning message. How to convert the Warning message to Error. In abap how to do that. Please help me.

    Mohan,
    It appears that there is some configuration you can do for BOM Message types to change the message type.  The IMG link for this function is:
    Production->Basic Data->Bill of Material->General Data->Change Message Type
    However you need to read the IMG documentation to see if this will work for you.  There are only certain messages that can be changed with this configuration step.
    Also, please do not double post questions in the forums.
    Best Regards,
    Chris H.

  • Does any one know , how to delete the others in itunes. it takes lot of space

    does any one know , how to delete the others in itunes. it takes lot of space, i wanna delete that... Actually what it contains

    Those are the data of the installed apps. Don't listen if someone says that it's an iOS, because it is not. On your iPhone, go to general > usage. It will show you all the programs installed on your iPhone. If you click any of them you will see how much of "others" it has (documents and data)
    There's no way to delete it if you want to still have those apps. You can reinstal those which has the most "others" but after some time of usage, it will raise again.

  • I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?

    I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?
    Thank you

    So it seems from reading the COMMAND manual that my first issue is that I used a 16GB SD card, and the manual says it will only recogize up to a 2GB SD card. I did use my MB Air's SD card slot and crated a folder and dragged the music files to it, then to the card. So I am going to get a 2GB card and try that next. Otherwise just stick with the iPOD connected. At least that is 8GB

  • Please does anyone knows how to delete the "others" on the iphone becuase it take me a lot of spaace and i cant have anything i have 5 GB of othres coan some one help me please?

    please does anyone knows how to delete the "others" on the iphone becuase it take me a lot of spaace and i cant have anything i have 5 GB of othres coan some one help me please?

    If restoring using your backup didn't work, you'll have to save as much of your data as you can (import your photos to your computer, sync your contacts and other data with iCloud, email things like Notes and Voice Memos to yourself, sync with iTunes to transfer all your purchases, etc.) and then restore it as new without using your backup.

  • How to convert the character value to currency/numeric

    Hi,
    See the sample code here
    data: v_qtr_field(7).
    data: w_low_limit like glt0-kslvt,
          w_amount like glt0-hslvt.
    w_low_limit = 02.
    w_max_period = 3.
    concatenate 'HSL' w_low_limit into v_qtr_field.
    *comment
    *I am looking for a field formation thru above code like in GLT0 table like HSL02,HSL03 *etc based on the value user entered in the selection *screen
    DO w_max_period TIMES
      VARYING w_amount FROM v_qtr_field NEXT v_qtr_field + 1.
       t_trans_values-dmbe2 = t_trans_values-dmbe2 + w_amount.
      ENDDO.
    I am facing problem in the Do loop as it wont allows multiple data types. can you suggest me how to convert the v_qtr_field whose data type is character to currency?

    Hi,
    Please check this code .
    PERFORM write_currency
                  USING buf_anla-urwrt t_dates-waers t_txw_anla-urwrt.
    *       FORM WRITE_CURRENCY                                           *
    *       convert currency amount to string                             *
    *       - use decimal point                                           *
    *       - remove separator characters                                 *
    *  -->  P_AMOUNT                                                      *
    *  -->  P_CURRENCY_UNIT                                               *
    *  -->  P_STRING                                                      *
    FORM WRITE_CURRENCY
         USING P_AMOUNT        TYPE P
               P_CURRENCY_UNIT LIKE TCURC-WAERS
               P_STRING        TYPE C.
      DATA: DEC2POINT(2) TYPE C VALUE ',.'.
    * convert separator to decimal point
      WRITE P_AMOUNT TO P_STRING CURRENCY P_CURRENCY_UNIT
            NO-GROUPING
            NO-SIGN
            LEFT-JUSTIFIED.
      TRANSLATE P_STRING USING DEC2POINT.
    * put minus sign before number
      IF p_amount < 0.
        SHIFT P_STRING RIGHT.
        P_STRING(1) = '-'.
      ENDIF.
    ENDFORM.
    <i>Hope This Info Helps YOU.</i>
    Regards,
    Lakshmi

  • How to convert the Report Builder output to .xls

    Dear All,
    Let me please know how to convert the Report Builder output to Excel Format.
    As there are having the facility to convert the output in .PDF or .HTML format but i want to convert that into Excel Sheet......
    Please Guide me in this regards
    Thanks in advance
    Regards,
    Vishal......

    Hello,
    If your question is about the format spreadsheet, it is not possible from Reports Builder :
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwwhthow/whatare/output/output_a_simpleexcel.htm
    Restrictions
    It is not possible to generate spreadsheet output directly from Reports Builder. Instead, on the command line, you can run the report using rwrun or Reports Server clients (rwservlet, rwclient, rwcgi), with DESFORMAT=SPREADSHEET. You cannot store DESFORMAT=SPREADSHEET as a system parameter value in the report definition (.rdf file).
    Regards

  • I modified the first business card in a template. Does anyone know how to get the other cards on the template to look like the first one without doing each individually? please and thanks!

    I modified the first business card in a template. Does anyone know how to get the other cards on the template to look like the first one without doing each individually? please and thanks!

    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=182&mforum=iworktips ntrick
    Peter

  • How to convert the report english to germany in abap

    Hi guys,
    How to convert the report english to germany in abap and any manual code or function module.
    please give the solution.

    you need to maintain all the text in text element and maintain text translation..
    goto> translations

  • How to convert the counter input as a RPM

    Hello NI,
                          Could you tell me. how to convert the Counter input to the RPM. I am using Rotary encoder has a 5V amplitude with 500 PPR. i am going to measure the Engine speed as a rpm.
    I am using third party hardware, from the hardware i can get the Count as well as Frequency also.
    Could you suggest to me...?  i looked out some disscussion in these forum but i cant able to understand.
    can you please explain with simple way....
    if you have any simulation send me....
    Regards,
    Balaji DP

    Hi balaji,
    [email protected] wrote:
    ...I am using third party hardware, from the hardware i can get the Count as well as Frequency also.
    If you're able to read frequency as X pulses/sec(?) that seems to convert RPM as follows:
    X (pulse/sec) * 1/500 (rev/pulse) * 60 (sec/min) = X * 60/500 RPM (???)
    Cheers!
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • Does anyone know how to convert the output from the standard report to xml?

    Does anyone know how to convert the output from the standard SAP report to xml?

    since it a standard report which you cannot modify you can only do the following.
    submit report exporting list to memory
    then
    list from memory and then
    use the returned itab along with CALL TRNSFORMATION key word to convert to xml.
    but this only going to place the whole list content (including data and formating lines,etc) into a xml element and not the actual data alone in the list .

  • How to convert the CS6 MAC version to the Windows version?

    I followed the advice to go to go/getserial, but the productcode i entered was "invalid", but the figures i entered are correct. What now ?

    Thank you for the tip, but I only get to : ask the community..   No
    contact with any agent.
    Pat Willener schreef op 19/09/2014 11:25:
    >
          How to convert the CS6 MAC version to the Windows version?
    created by Pat Willener <https://forums.adobe.com/people/pwillener> in
    /Downloading, Installing, Setting Up/ - View the full discussion
    <https://forums.adobe.com/message/6744036#6744036>

  • I have 2 game centers on 1 Apple ID and it willl only access 1 of them may someone tell me how to access the other one

    I have 2 game centers on 1 Apple ID and it will only access 1 of them may someone tell me how to access the other one

    You don't have to use the same ID for iCloud as you do for purchasing.  You can just set up iCloud using your other ID. 
    If your have already have another account, you have to go to Settings>iCloud, tap Delete Account, choose Keep on My iDevice when prompted, set up your new account with the other ID, turn on your iCloud data syncing and when prompted, choose Merge to upload your data to the new account.

  • How to convert java class file version without decompiling

    Hi,
    Oracle R12.1.3 i am having illegal access error while try to access the class file version Java 1.3 uses major version 47,So how to convert the class file version without using decompiling.
    Current java version is 1.6.0_07
    Is there any tool or API for converting class file version?
    Thanks,
    Selvapandian T

    Beside this I wonder where you get your error from since AFAIK 12c comes with java 1.6.
    Well wonder no more!
    OP isn't using Oracle 12c database.
    They are using Oracle R12.1.3 - which is the E- Business Suite.

Maybe you are looking for

  • Form personalization to check whether anything to save

    In the Oracle Financials Receivables application Receipts form (ARXRWMAI) there is a Distributions button that launches the receipt distribution screen. If a user makes changes to the distribution lines and then selects the Cancel button or X to clos

  • Is there any way we can stop dehydration store

    Hi All, Is there anyway we can stop dehydration store in the BPEL,i have two BPEL process deployed in the SOA Suite.i want to make sure that one BPEL should not get impacted by dehydrations Store. Please share your views. Thanks, Murali.

  • L7590 All in One "download print driver file" WARNING!!

    If you are considering downloading print drivers for your L7590 series, be forewarned: This is my experience.  After experiencing fax problems (the fax would feed all the pages, but cancel itself after attempting to send page 1.  I finally thought it

  • Custom Login Module with Adf 11g and and weblogic server

    I have configured adf security on my application. I have checked the authentication and authorization are working fine with the default authenticator. I am trying to create a custom login module. I have downloaded the custom login module implementati

  • Technote upate: "Adobe Digital Editions does not install on Windows Vista" now v1.6

    http://www.adobe.com/go/kb403051 has now been updated to contain the 1.6 version of Digital Editions. Note that the instructions remain the same. Only the download is new. Regards, Bentley Wolfe Senior Support Engineer, Flash/Flash Player/Digital Edi