术语:实例变量的单字 Java 术语?

发布于 2024-11-04 22:22:47 字数 692 浏览 4 评论 0原文

我正在寻找在类(非静态)中声明的实例变量的替代 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

浮生未歇 2024-11-11 22:22:47

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).

时光清浅 2024-11-11 22:22:47

JPA 的 AccessType 注释使用 FIELD。因此我会使用术语“场”。

JPA's AccessType annotation uses FIELD. I would thus use the term "Field".

锦欢 2024-11-11 22:22:47

JPA连接Java和数据库。因此,您可以从数据库角度将它们称为字段,或者从Java 角度将它们称为成员

JPA connects Java and databases. So you could call them fields from the database perspective or members from the Java perspective.

入怼 2024-11-11 22:22:47

“成员”是“实例”的典型替代。请参阅 Java 教程维基百科

"Member" is a typical alternative to "instance". See the Java tutorial and Wikipedia.

成熟稳重的好男人 2024-11-11 22:22:47
  • 成员
  • 属性
  • 字段
  • 属性
  • Member
  • Attribute
  • Field
  • Property
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文