开发者

Terminology: one-word Java term for instance variables?

开发者 https://www.devze.com 2023-03-03 16:56 出处:网络
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:

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")
开发者_Python百科    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.


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

Fields.


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


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


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


  • Member
  • Attribute
  • Field
  • Property
0

精彩评论

暂无评论...
验证码 换一张
取 消