我在下图中看到了一个Android项目结构。 “ Bean”在此结构中是什么意思?或为什么该文件夹名称为“ Bean”?
答案 0 :(得分:3)
Bean
基本上是一个类,将许多对象封装为一个对象,并且可以使用getter
和setter
方法来操纵属性。我们也将其称为模型类。下面的代码段是Bean类的示例。
public class Book implements Serializable{
private String isbn;
private String title;
private String author;
private String publisher;
private int pages;
/**
* Default constructor
*/
public Book() {
this.isbn = "";
this.title = "";
this.author = "";
this.publisher = "";
this.pages = 0;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(final String isbn) {
this.isbn = isbn;
}
public String getTitle() {
return title;
}
public void setTitle(final String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(final String author) {
this.author = author;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(final String publisher) {
this.publisher = publisher;
}
public int getPages() {
return pages;
}
public void setPages(final int pages) {
this.pages = pages;
}
}
在您的情况下,我认为您指向的包包含所有Bean类