Property Was: A way to opt out of access restrictions on non-exported members.
Remi Forax
forax at univ-mlv.fr
Mon Nov 16 22:37:49 UTC 2015
----- Mail original -----
> De: "Stephen Colebourne" <scolebourne at joda.org>
> À: "jigsaw-dev" <jigsaw-dev at openjdk.java.net>
> Envoyé: Lundi 16 Novembre 2015 13:28:22
> Objet: Re: A way to opt out of access restrictions on non-exported members.
>
[...]
> Stephen
> PS. I'm reminded of Java's missing "properties" feature again, cf.
> http://jodastephen.github.io/property-alliance/
I still think we should introduce properties into the language and i agree with you that it should have a meta-model.
Here is how i see properties nowadays:
- a property represents a public value that can be implemented either as a field or using a getter and optionally a setter.
- declaring a property is done by using the keyword 'property' in front of a field.
- accessing a property is done by using '.' followed by the name of the property.
- a final property is a property that can only be read.
- an abstract property is a property with no backing field, a getter and a setter must be defined (only a getter if the property is final).
- The reflection API (this is the meta-model of Java) is enhanced by adding a class java.lang.reflect.Property that
can be obtained by using getProperty(String)/getProperties() on a Class.
The property is non mutable object (no setAccesssible), that is not parameterized and there is only one kind of property.
everything else can be implemented on top of this property spec.
and we (the community) should agree on the property spec we want and wait a Java release with no big language change in order to propose it.
regards,
Rémi
More information about the jigsaw-dev
mailing list