This question is about application design practice.i am new to application design. I am binding String XML to POJO Objects using DOM parser. Below is my XML syntax.
<Message>
<Header>
</Header>
<Body>
<Name></Name> // String Data type
<Age></Age> // Int data type
<DOB></DOB> // Date data type
<Salary></Salary> // double data type
</BODY>
</Message>
From my requirement specification i know the datatypes of each tag in XML. I have created table with respective column with respective datatypes.
Now I am creating POJO classes. My question is, Whether we should create String data type variable for all fields [Later casting in DAO layer to respective data types] or I should create respective data types for fields in POJO class when binding XML to POJO.
I am thinking how to solve situation with POJO and fields that in application exist in more data types.
its Not necessary to use only String you can use other datatypes.
you can use casing but if don't worked then it will generate ClassCastException for better practice i prefer same datatype. if its not possible the use casting.