# How to get instance of property?

**URL:** https://discuss.kotlinlang.org/t/how-to-get-instance-of-property/6245
**Category:** Support
**Created:** [January 16, 2018, 8:51am UTC](https://discuss.kotlinlang.org/t/how-to-get-instance-of-property/6245 "2018-01-16T08:51:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sschuberth](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sschuberth/32/8317_2.png) [@sschuberth](https://discuss.kotlinlang.org/u/sschuberth)
#### Post date: [January 16, 2018, 8:51am UTC](https://discuss.kotlinlang.org/t/how-to-get-instance-of-property/6245/1 "2018-01-16T08:51:42Z")

</div>

Given a property reference `ref` like

```
val ref = instance::prop

```

where `instance` is the instance of some class containing a properly named `prop`, how can I get back `instance` from a given `ref` again?

---

<div class="post-metadata">

### Author: ![madmax1028](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/madmax1028/32/3335_2.png) [@madmax1028](https://discuss.kotlinlang.org/u/madmax1028)
#### Post date: [January 16, 2018, 5:27pm UTC](https://discuss.kotlinlang.org/t/how-to-get-instance-of-property/6245/2 "2018-01-16T17:27:16Z")

</div>

In simple cases you can use this: 😉

```auto
MyType::prop

```

If it’s not that straigthforward and you want to use reflection on any instance of `KClass<T>` then you have to resort to something this:

```auto
classInstance.{propertyType}Properties.[first|find] { it.name == "prop" }

```

---

<div class="post-metadata">

### Author: ![vbezhenar](https://avatars.discourse-cdn.com/v4/letter/v/35a633/32.png) [@vbezhenar](https://discuss.kotlinlang.org/u/vbezhenar)
#### Post date: [January 16, 2018, 6:35pm UTC](https://discuss.kotlinlang.org/t/how-to-get-instance-of-property/6245/3 "2018-01-16T18:35:01Z")

</div>

If you’re targeting JVM, this seems to work: `(ref as CallableReference).boundReceiver`

---

<div class="post-metadata">

### Author: ![jstuyts](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstuyts/32/2141_2.png) [@jstuyts](https://discuss.kotlinlang.org/u/jstuyts)
#### Post date: [January 16, 2018, 10:17pm UTC](https://discuss.kotlinlang.org/t/how-to-get-instance-of-property/6245/4 "2018-01-16T22:17:50Z")

</div>

There is already an issue for that: [https://youtrack.jetbrains.com/issue/KT-16818](https://youtrack.jetbrains.com/issue/KT-16818)
