本文整理汇总了Java中org.eclipse.emf.examples.extlibrary.Book.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Book.setTitle方法的具体用法?Java Book.setTitle怎么用?Java Book.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.examples.extlibrary.Book
的用法示例。
在下文中一共展示了Book.setTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: capitalize
import org.eclipse.emf.examples.extlibrary.Book; //导入方法依赖的package包/类
private void capitalize(Book book) {
if (book != null) {
if (book.getTitle().equals(book.getTitle().toUpperCase())) {
book.setTitle(book.getTitle().toLowerCase());
} else {
book.setTitle(book.getTitle().toUpperCase());
}
}
}
示例2: init
import org.eclipse.emf.examples.extlibrary.Book; //导入方法依赖的package包/类
private void init() {
factory = EXTLibraryFactory.eINSTANCE;
library = factory.createLibrary();
library.setName("Alexandria");
library.setAddress("Alexandria, Egypt");
Writer tolkien = factory.createWriter();
tolkien.setFirstName("J.R.R.");
tolkien.setLastName("Tolkien");
library.getWriters().add(tolkien);
Book book = factory.createBook();
book.setTitle("The Lord of the Ring — The Fellowship of the Ring");
book.setCategory(BookCategory.SCIENCE_FICTION_LITERAL);
book.setPages(564);
book.setAuthor(tolkien);
Calendar pubdate = Calendar.getInstance();
pubdate.set(1954, 6, 29);
book.setPublicationDate(pubdate.getTime());
library.getBooks().add(book);
book = factory.createBook();
book.setTitle("The Lord of the Ring — The Two Towers");
book.setCategory(BookCategory.SCIENCE_FICTION_LITERAL);
book.setPages(523);
book.setAuthor(tolkien);
pubdate = Calendar.getInstance();
pubdate.set(1954, 10, 11);
book.setPublicationDate(pubdate.getTime());
library.getBooks().add(book);
book = factory.createBook();
book.setTitle("The Lord of the Ring — The Return of the King");
book.setCategory(BookCategory.SCIENCE_FICTION_LITERAL);
book.setPages(639);
book.setAuthor(tolkien);
pubdate = Calendar.getInstance();
pubdate.set(1955, 9, 20);
book.setPublicationDate(pubdate.getTime());
library.getBooks().add(book);
VideoCassette videoK7 = factory.createVideoCassette();
videoK7.setTitle("Tapes are vintage, then they are hype");
videoK7.setDamaged(true);
videoK7.setCopies(3);
pubdate = Calendar.getInstance();
pubdate.set(1983, 3, 7);
videoK7.setPublicationDate(pubdate.getTime());
library.getStock().add(videoK7);
resourceSet = new ResourceSetImpl();
resource = new ResourceImpl(URI.createURI("demo.xmi"));
resource.getContents().add(library);
resourceSet.getResources().add(resource);
ResourceImpl extlibraryEcore = new ResourceImpl(URI.createURI("extlibrary.ecore"));
extlibraryEcore.getContents().add(EXTLibraryPackage.eINSTANCE);
resourceSet.getResources().add(extlibraryEcore);
}
示例3: createBook
import org.eclipse.emf.examples.extlibrary.Book; //导入方法依赖的package包/类
public Book createBook(String title) {
Book book = factory.createBook();
book.setTitle(title);
library.getBooks().add(book);
return book;
}