# Implemented properties of a Managed type are not accessible using model path

**URL:** <https://discuss.gradle.org/t/implemented-properties-of-a-managed-type-are-not-accessible-using-model-path/17558>\
**Category:** Bugs\
**Tags:** software-model, issue-acknowledged, gradle-3452\
**Created:** [May 11, 2016, 9:14pm UTC](https://discuss.gradle.org/t/implemented-properties-of-a-managed-type-are-not-accessible-using-model-path/17558 "2016-05-11T21:14:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthieu\_Leclercq](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@Matthieu\_Leclercq](https://discuss.gradle.org/u/Matthieu_Leclercq)\
**Post date:** [May 11, 2016, 9:14pm UTC](https://discuss.gradle.org/t/implemented-properties-of-a-managed-type-are-not-accessible-using-model-path/17558/1 "2016-05-11T21:14:10Z")

</div>

Given a managed model type as followed:

```java
@Managed
public abstract class MyManagedType {
    public abstract String getProp1();
    public abstract void setProp1(String prop1);

    public String getProp2() {
        return getProp1.toUpperCase();
    }
}

```

The `prop1` property is managed and it’s value can be references in a rule using `@Path(<xyz>.prop1)`, but `prop2` cannot be referenced using `@Path(<xyz>.prop2)`. Similarly in gradle script `prop1` can be accessed as `$.<xyz>.prop1` while `prop2` cannot be accessed as `$.<xyz>.prop2`.

The difference between `prop1` and `prop2` is an implementation detail and should not impact the way these properties are accessed in rules or in a gradle script.

The workaround, I used, is to convert `prop2` as a managed property and set it in a `@Finalize` rule, but this is not fully satisfying. It adds some boilerplate code and this property is really a read-only property so it shouldn’t have a setter. With this workaround one can, by mistake, mutate `prop2` in a `@Mutate` rule without error while the value will eventually be replaced by the value set by the `@Finalize` rule.

---

<div class="post-metadata">

**Author:** ![mark\_vieira](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_vieira/32/5396_2.png) [@mark\_vieira](https://discuss.gradle.org/u/mark_vieira)\
**Post date:** [May 11, 2016, 11:26pm UTC](https://discuss.gradle.org/t/implemented-properties-of-a-managed-type-are-not-accessible-using-model-path/17558/2 "2016-05-11T23:26:57Z")

</div>

This looks to be a limitation of the model DSL. You can get around this by doing the following:

```
def foo = $.foo
println foo.prop2

```

I’ve GRADLE-3452 to track this issue.
