术语:实例变量的单字 Java 术语?
我正在寻找在类(非静态)中声明的实例变量的替代 OO/Java 术语,或者更具体地说,在用 JPA 注释“装饰”的 Java 类中声明的实例变量:
@Entity
@Table(name = "Departments")
@IdClass(value = DepartmentId.class)
public class Department implements Serializable
{
@Id
@Column(name = "company_id", insertable = false, updatable = false)
private Integer companyId;
@Id
@Column(name = "internal_code")
private String internalCode;
@Column(name = "name")
private String name;
@ManyToOne
@JoinColumn(name = "company_id", referencedColumnName = "id")
private Company company;
...
}
它们称为属性吗?属性?会员?字段?只是参考吗?除了实例变量就没有别的了吗?
我想听听一个单字术语(如果存在的话)。 “实例变量”对于我目前正在做的事情来说太长了。
I'm looking for an alternativ OO/Java term of instance variables declared in a class (non-static), or more specifically in a Java class "decorated" with JPA annotations:
@Entity
@Table(name = "Departments")
@IdClass(value = DepartmentId.class)
public class Department implements Serializable
{
@Id
@Column(name = "company_id", insertable = false, updatable = false)
private Integer companyId;
@Id
@Column(name = "internal_code")
private String internalCode;
@Column(name = "name")
private String name;
@ManyToOne
@JoinColumn(name = "company_id", referencedColumnName = "id")
private Company company;
...
}
Are they called properties? Attributes? Members? Fields? Just references? Nothing else but instance variables?
I'd like to hear a one-word term if one exists. "Instance variables" is just too long for what I'm currently doing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
JLS 将它们称为“字段”。不过,这包括
静态
和非静态
。因此,JLS 正确的术语是“非静态场”。
成员是用于字段和方法以及类和类中定义的接口。请注意,构造函数和初始值设定项(实例初始值设定项和静态初始值设定项)不是成员。
属性通常用于指代 Java Bean 类型的属性(即 getter 和 setter)。
The JLS calls them fields. That includes both
static
and non-static
ones, however.So the JLS-correct term would be "non-static field".
Member is a general term used for fields and methods as well as classes and interfaces defined within the class. Note that constructors and initializers (both instance initializers and static initializers) are not members.
A property is usually used to refer to Java Bean-type properties (i.e. a getter and a setter).
http://java.sun.com/docs /books/jls/third_edition/html/names.html#6.4.3
字段。
http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.4.3
Fields.
JPA 的 AccessType 注释使用 FIELD。因此我会使用术语“场”。
JPA's AccessType annotation uses FIELD. I would thus use the term "Field".
JPA连接Java和数据库。因此,您可以从数据库角度将它们称为字段,或者从Java 角度将它们称为成员。
JPA connects Java and databases. So you could call them fields from the database perspective or members from the Java perspective.
“成员”是“实例”的典型替代。请参阅 Java 教程 和 维基百科。
"Member" is a typical alternative to "instance". See the Java tutorial and Wikipedia.