You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to allow method references to properties to be interpreted as both getters and setters. This would enable a single reference to a property to serve as a bi-directional accessor, which could simplify and unify design around property manipulation.
Example:
// Example class with a propertypublicclassFoo{
@varStringbar;
}
// Method accepting a property accessorpublicvoiddoSomething(Foofoo, PropertyAccessor<Foo, String> propertyAccessor){
Stringbar = propertyAccessor.get(foo);
...
propertyAccessor.set(foo, bar);
}
// Calling the methoddoSomthing(newFoo(), Foo::bar);
Do support this behaviour, Manifold would have to replace the method reference for the property with a new PropertyAccessor object, which encapsulates both getter and setter logic for the property.
Here’s a real example from SubTools, where valueGetter and valueSetter are specified separately:
Support for PropertyAccessor should be limited to fields annotated with @var (excluding those with private @get or @set), or cases where both a public getter and setter method are defined (or a combination).
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
It would be useful to allow method references to properties to be interpreted as both getters and setters. This would enable a single reference to a property to serve as a bi-directional accessor, which could simplify and unify design around property manipulation.
Example:
Do support this behaviour, Manifold would have to replace the method reference for the property with a new
PropertyAccessor
object, which encapsulates both getter and setter logic for the property.Here’s a real example from SubTools, where valueGetter and valueSetter are specified separately:
With support for
PropertyAccessor
, this could be simplified to:Support for
PropertyAccessor
should be limited to fields annotated with@var
(excluding those with private@get
or@set
), or cases where both a public getter and setter method are defined (or a combination).The text was updated successfully, but these errors were encountered: