当前位置: 首页>>代码示例>>Java>>正文


Java Book类代码示例

本文整理汇总了Java中org.eclipse.emf.examples.extlibrary.Book的典型用法代码示例。如果您正苦于以下问题:Java Book类的具体用法?Java Book怎么用?Java Book使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Book类属于org.eclipse.emf.examples.extlibrary包,在下文中一共展示了Book类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: eSet

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case EXTLibraryPackage.WRITER__NAME:
      setName((String)newValue);
      return;
    case EXTLibraryPackage.WRITER__BOOKS:
      getBooks().clear();
      getBooks().addAll((Collection<? extends Book>)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}
 
开发者ID:cbrun,项目名称:acceleo-launcher-examples,代码行数:22,代码来源:WriterImpl.java

示例2: getTreeNode

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
public Resource getTreeNode() {
	Resource ret = new ResourceImpl(URI.createURI("tree node resource"));
	
	TreeNode libraryNode = TreeFactory.eINSTANCE.createTreeNode();
	libraryNode.setData(library);
	
	ret.getContents().add(libraryNode);
	
	for (Item item : library.getStock()) {
		TreeNode itemNode = TreeFactory.eINSTANCE.createTreeNode();
		itemNode.setData(item);
		libraryNode.getChildren().add(itemNode);
		if (item instanceof Book) {
			TreeNode writerNode = TreeFactory.eINSTANCE.createTreeNode();
			writerNode.setData(((Book) item).getAuthor());
			itemNode.getChildren().add(writerNode);
		}
		
	}
	return ret;
	
}
 
开发者ID:mbarbero,项目名称:econ-na-2014-emf-edit,代码行数:23,代码来源:MyLibrary.java

示例3: getText

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
@Override
public String getText(Object element) {
	if (element instanceof Resource) {
		return ((Resource) element).getURI().toString();
	} else if (element instanceof EObject) {
		EObject eObject = (EObject) element;
		EClass eClass = eObject.eClass();
		String ret = eClass.getName() + " ";
		if (element instanceof Library) {
			ret += ((Library) element).getName();
		} else if (element instanceof Book) {
			ret += ((Book) element).getTitle();
		} else if (element instanceof Writer) {
			ret += ((Writer) element).getName();
		} else {
			ret += " [" + element.toString() + "]";
		}
		return ret;
	}
	return super.getText(element);
}
 
开发者ID:mbarbero,项目名称:econ-na-2014-emf-edit,代码行数:22,代码来源:YourFathersSWT.java

示例4: testInvalidBookResource

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
@Test(expected = IOException.class)
public void testInvalidBookResource() throws IOException {

	ResourceSet resourceSet = new ResourceSetImpl();
	URI uri = URI.createFileURI("book.avro");
	resourceSet.createResource(uri);
	AvroResource resource = new AvroResource(uri);
	ConvertEMFtoAvro converter = new ConvertEMFtoAvro();
	resource.setConverter(converter);
	Book book = EXTLibraryFactory.eINSTANCE.createBook();

	org.eclipse.emf.examples.extlibrary.Writer writer = EXTLibraryFactory.eINSTANCE
			.createWriter();
	writer.setFirstName("John");
	writer.setLastName("Smith");
	writer.setName("John Smith");
	writer.setAddress("123 Sesame Street");

	book.setAuthor(writer);
	resource.getContents().add(book);
	resource.save(null);
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:23,代码来源:AvroResourceTest.java

示例5: testBorrowerResource

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
@Test
public void testBorrowerResource() throws IOException
{
	ResourceSet resourceSet = new ResourceSetImpl();

	URI borrowedURI = URI.createFileURI("borrowed_book.library_avro");
	AvroResource resource = (AvroResource) resourceSet.createResource(borrowedURI);
	Book book = EXTLibraryFactory.eINSTANCE.createBook();
	resource.getContents().add(book);
	resource.save(null);
	
	Borrower borrower = EXTLibraryFactory.eINSTANCE.createBorrower();
	borrower.getBorrowed().add(book);
	URI borrowerURI = URI.createFileURI("borrower.library_avro");
	AvroResource borrowerResource = (AvroResource) resourceSet.createResource(borrowerURI);
	borrowerResource.getContents().add(borrower);
	borrowerResource.save(null);
	
	resourceSet.getResources().clear();
	AvroResource temp = (AvroResource) resourceSet.getResource(borrowerURI, true);
	temp.load(null);
	assertTrue(temp.getContents().size() == 1);
	
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:25,代码来源:AvroResourceTest.java

示例6: testInvalidBookResource

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
@Test(expected = IOException.class)
public void testInvalidBookResource() throws IOException {

	ResourceSet resourceSet = new ResourceSetImpl();
	URI uri = URI.createFileURI("book.avro");
	resourceSet.createResource(uri);
	AvroResource resource = new AvroResource(uri);
	ConvertEMFtoAvro converter = new ConvertEMFtoAvro();
	resource.setConverter(converter);
	Book book = EXTLibraryFactory.eINSTANCE.createBook();

	org.eclipse.emf.examples.extlibrary.Writer writer = EXTLibraryFactory.eINSTANCE
			.createWriter();
	writer.setFirstName("John");
	writer.setLastName("Smith");
	writer.setName("John Smith");
	writer.setAddress("123 Sesame Street");

	book.setAuthor(writer);
	resource.getContents().add(book);
	resource.save(options);
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:23,代码来源:BinaryAvroResourceTest.java

示例7: testBorrowerResource

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
@Test
public void testBorrowerResource() throws IOException
{
	ResourceSet resourceSet = new ResourceSetImpl();

	URI borrowedURI = URI.createFileURI("borrowed_book.library_avro");
	AvroResource resource = (AvroResource) resourceSet.createResource(borrowedURI);
	Book book = EXTLibraryFactory.eINSTANCE.createBook();
	resource.getContents().add(book);
	resource.save(options);
	
	Borrower borrower = EXTLibraryFactory.eINSTANCE.createBorrower();
	borrower.getBorrowed().add(book);
	URI borrowerURI = URI.createFileURI("borrower.library_avro");
	AvroResource borrowerResource = (AvroResource) resourceSet.createResource(borrowerURI);
	borrowerResource.getContents().add(borrower);
	borrowerResource.save(options);
	
	resourceSet.getResources().clear();
	resourceSet.getLoadOptions().putAll(options);
	AvroResource temp = (AvroResource) resourceSet.getResource(borrowerURI, true);
	temp.load(options);
	assertTrue(temp.getContents().size() == 1);
	
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:26,代码来源:BinaryAvroResourceTest.java

示例8: eSet

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
 * @generated
 */
 @SuppressWarnings("unchecked")
 @Override
 public void eSet(int featureID, Object newValue)
 {
	switch (featureID) {
		case EXTLibraryPackage.WRITER__NAME:
			setName((String)newValue);
			return;
		case EXTLibraryPackage.WRITER__BOOKS:
			getBooks().clear();
			getBooks().addAll((Collection<? extends Book>)newValue);
			return;
	}
	super.eSet(featureID, newValue);
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:21,代码来源:WriterImpl.java

示例9: getBooks

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public EList<Book> getBooks()
{
  if (books == null)
  {
    books = new EObjectWithInverseResolvingEList<Book>(Book.class, this, EXTLibraryPackage.WRITER__BOOKS, EXTLibraryPackage.BOOK__AUTHOR);
  }
  return books;
}
 
开发者ID:cbrun,项目名称:acceleo-launcher-examples,代码行数:14,代码来源:WriterImpl.java

示例10: getText

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
 * @generated
 */
 @Override
 public String getText(Object object)
 {
	String label = ((Book)object).getTitle();
	return label == null || label.length() == 0 ?
		getString("_UI_Book_type") : //$NON-NLS-1$
		getString("_UI_Book_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
}
 
开发者ID:mbarbero,项目名称:econ-na-2014-emf-edit,代码行数:15,代码来源:BookItemProvider.java

示例11: notifyChanged

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
/**
 * This handles model notifications by calling {@link #updateChildren} to update any cached
 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
 * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
 * @generated
 */
 @Override
 public void notifyChanged(Notification notification)
 {
	updateChildren(notification);

	switch (notification.getFeatureID(Book.class)) {
		case EXTLibraryPackage.BOOK__TITLE:
		case EXTLibraryPackage.BOOK__PAGES:
		case EXTLibraryPackage.BOOK__CATEGORY:
			fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
			return;
	}
	super.notifyChanged(notification);
}
 
开发者ID:mbarbero,项目名称:econ-na-2014-emf-edit,代码行数:22,代码来源:BookItemProvider.java

示例12: handleSelectionChanged

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
private void handleSelectionChanged(SelectionChangedEvent event) {
	IStructuredSelection selection = (IStructuredSelection) event.getSelection();
	Iterator<?> iterator = selection.iterator();
	while (iterator.hasNext()) {
		Object next = iterator.next();
		if (!(next instanceof Book)) {
			removeBookButton.setEnabled(false);
			return;
		}
	}
	removeBookButton.setEnabled(true);
}
 
开发者ID:mbarbero,项目名称:econ-na-2014-emf-edit,代码行数:13,代码来源:DemoSWT.java

示例13: handleRemoveButtonSelected

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
private void handleRemoveButtonSelected(IStructuredSelection selection) {
	Iterator<?> iterator = selection.iterator();
	while (iterator.hasNext()) {
		Object next = iterator.next();
		if (next instanceof Book) {
			myLibrary.getLibrary().getBooks().remove(next);
		}
	}
}
 
开发者ID:mbarbero,项目名称:econ-na-2014-emf-edit,代码行数:10,代码来源:DemoSWT.java

示例14: 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());
		}
	}
}
 
开发者ID:mbarbero,项目名称:econ-na-2014-emf-edit,代码行数:10,代码来源:DemoSWT.java

示例15: getBooks

import org.eclipse.emf.examples.extlibrary.Book; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
 * @generated
 */
 public EList<Book> getBooks()
 {
	if (books == null) {
		books = new EObjectWithInverseResolvingEList<Book>(Book.class, this, EXTLibraryPackage.WRITER__BOOKS, EXTLibraryPackage.BOOK__AUTHOR);
	}
	return books;
}
 
开发者ID:LangleyStudios,项目名称:eclipse-avro,代码行数:13,代码来源:WriterImpl.java


注:本文中的org.eclipse.emf.examples.extlibrary.Book类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。