Examples of Books


Examples of com.hascode.tutorial.xbeam.projection.Books

import com.hascode.tutorial.xbeam.projection.Books;

public class SimpleXmlFileParsingExample {
  public static void main(final String[] args) throws IOException {
    Books bookProjection = new XBProjector().io().fromURLAnnotation(Books.class);
    bookProjection.getBooks().forEach(book -> {
      System.out.println("book -> title: " + book.getTitle() + " and authors: ");
      System.out.println(book.getAuthors().stream().map(a -> {
        return a.getFirstname() + " " + a.getLastname();
      }).collect(Collectors.joining(", ")));
    });
View Full Code Here

Examples of com.jcasey.jaxb.Books

      JAXBContext jaxb = JAXBContext.newInstance(ObjectFactory.class);
      Unmarshaller unmarshaller = jaxb.createUnmarshaller();
     
      if(bookFile != null)
      {
        Books xmlBooks =  (Books)unmarshaller.unmarshal(bookFile);
       
        // copy data from XML to Hibernate database object
       
        for(Books.Book xmlBook:  xmlBooks.getBook())                       
        {
          com.jcasey.model.Book book = new com.jcasey.model.Book();
         
          book.setAuthor(xmlBook.getAuthor());
          book.setTitle(xmlBook.getTitle());
View Full Code Here

Examples of com.jcasey.jaxb.Books

  private static final String BOOKS_XML = "./books.xml";

  public static void main(String[] args) throws JAXBException, IOException {

    Books books = new Books();
   
    // create books
    Book book1 = new Book();
    book1.setIsbn("978-1617290060");
    book1.setTitle("The Well-Grounded Java Developer: Vital techniques of Java 7 and polyglot programming");
    book1.setAuthor("Benjamin J Evans");
   
    // create genre objects
    Genre java = new Genre();
    java.setType("Java");
   
    Genre scala = new Genre();
    scala.setType("Scala");
   
    book1.setGenres(new Genres()); //Books do not need to *have* a list of Genres so create a list here
   
    // link genres with genre list   
  book1.getGenres().getGenre().add(java);
  book1.getGenres().getGenre().add(scala);
 
  // add book to list of books
    books.getBook().add(book1);
   
   
    // create book2 note there are no genres in this book
    Book book2 = new Book();
    book2.setIsbn("978-3832180577");
    book2.setTitle("Java Concurrency in Practice");
    book2.setAuthor("Brian Goetz");

    // add book to list of books
    books.getBook().add(book2);
   
    // create JAXB context and instantiate marshaller
    JAXBContext context = JAXBContext.newInstance(Books.class);
    Marshaller m = context.createMarshaller();
    m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

    // write to System.out
    m.marshal(books, System.out);

    // write to File
    m.marshal(books, new File(BOOKS_XML));

    // get variables from our xml file, created before
    System.out.println();
    System.out.println("Output from our XML File: ");
    Unmarshaller um = context.createUnmarshaller();
    Books books2 = (Books) um.unmarshal(new FileReader(BOOKS_XML));

    for (Book book : books2.getBook()) {
      System.out.println("Book: " + book.getTitle() + " from " + book.getAuthor());
    }
  }
View Full Code Here

Examples of es.twentymobile.jpa.db.test.Books

    return "mule-config.xml";
  }

  @Test
  public void testProcessorFlow() throws Exception {
    Books book = new Books();
    book.setId(1);
    runFlowWithPayloadAndExpect("testFlow", "Book one", book);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.