Created
October 4, 2017 18:05
-
-
Save yusufcakal/73230efae2fcd0c7d55ab2ca3d55f4dc to your computer and use it in GitHub Desktop.
Medium Post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
User user = new User(1,"Yusuf","yusufcakal","123456"); | |
Job job = new Job("Computer Science", "Engineer"); | |
user.setJob(job); | |
User user1 = new User(2,"Fatih","fatihsimsek","123456"); | |
Job job1 = new Job("Computer Science", "Enginerr"); | |
user1.setJob(job1); | |
List<User> userList = new ArrayList<>(); | |
userList.add(user); | |
userList.add(user1); | |
UserListWrapper userListWrapper = new UserListWrapper(); | |
userListWrapper.setUserList(userList); | |
try { | |
JAXBContext jaxbContext = JAXBContext.newInstance(UserListWrapper.class); | |
Marshaller marshaller = jaxbContext.createMarshaller(); | |
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //Çıktının formatlı olmasını istiyoruz. | |
marshaller.marshal(userListWrapper, System.out); | |
} catch (JAXBException e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment