Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/util/Property#pubctors) \| [Methods](https://developer.android.com/reference/android/util/Property#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/util/Property#inhmethods)

# Property

*** ** * ** ***

` public abstract class Property `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.util.Property\<T, V\> |

Known direct subclasses [FloatProperty](https://developer.android.com/reference/android/util/FloatProperty)\<T\>, [IntProperty](https://developer.android.com/reference/android/util/IntProperty)\<T\> [FloatProperty](https://developer.android.com/reference/android/util/FloatProperty)\<T\> An implementation of `https://developer.android.com/reference/android/util/Property` to be used specifically with fields of type `float`. [IntProperty](https://developer.android.com/reference/android/util/IntProperty)\<T\> An implementation of `https://developer.android.com/reference/android/util/Property` to be used specifically with fields of type `int`.   

*** ** * ** ***

A property is an abstraction that can be used to represent a mutable value that is held in a *host* object. The Property's `https://developer.android.com/reference/android/util/Property#set(T,%20V)` or `https://developer.android.com/reference/android/util/Property#get(T)` methods can be implemented in terms of the private fields of the host object, or via "setter" and "getter" methods or by some other mechanism, as appropriate.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/util/Property#Property(java.lang.Class<V>,%20java.lang.String)(https://developer.android.com/reference/java/lang/Class<V> type, https://developer.android.com/reference/java/lang/String name) ` A constructor that takes an identifying name and `https://developer.android.com/reference/android/util/Property#getType()` for the property. |

| ### Public methods ||
|---|---|
| ` abstract V` | ` https://developer.android.com/reference/android/util/Property#get(T)(T object) ` Returns the current value that this property represents on the given `object`. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/util/Property#getName()() ` Returns the name for this property. |
| ` https://developer.android.com/reference/java/lang/Class<V>` | ` https://developer.android.com/reference/android/util/Property#getType()() ` Returns the type for this property. |
| ` boolean` | ` https://developer.android.com/reference/android/util/Property#isReadOnly()() ` Returns true if the `https://developer.android.com/reference/android/util/Property#set(T,%20V)` method does not set the value on the target object (in which case the `https://developer.android.com/reference/android/util/Property#set(T,%20V)` method should throw a `https://developer.android.com/reference/android/util/NoSuchPropertyException` exception). |
| ` static <T, V> https://developer.android.com/reference/android/util/Property<T, V>` | ` https://developer.android.com/reference/android/util/Property#of(java.lang.Class<T>,%20java.lang.Class<V>,%20java.lang.String)(https://developer.android.com/reference/java/lang/Class<T> hostType, https://developer.android.com/reference/java/lang/Class<V> valueType, https://developer.android.com/reference/java/lang/String name) ` This factory method creates and returns a Property given the `class` and `name` parameters, where the `"name"` parameter represents either: - a public `getName()` method on the class which takes no arguments, plus an optional public `setName()` method which takes a value of the same type returned by `getName()` - a public `isName()` method on the class which takes no arguments, plus an optional public `setName()` method which takes a value of the same type returned by `isName()` - a public `name` field on the class If either of the get/is method alternatives is found on the class, but an appropriate `setName()` method is not found, the `Property` will be `https://developer.android.com/reference/android/util/Property#isReadOnly()`. |
| ` void` | ` https://developer.android.com/reference/android/util/Property#set(T,%20V)(T object, V value) ` Sets the value on `object` which this property represents. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### Property

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Property (Class<V> type, 
                String name)
```

A constructor that takes an identifying name and `https://developer.android.com/reference/android/util/Property#getType()` for the property.

<br />

| Parameters ||
|---|---|
| `type` | `Class` <br /> |
| `name` | `String` <br /> |

## Public methods

### get

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract V get (T object)
```

Returns the current value that this property represents on the given `object`.

<br />

| Parameters ||
|---|---|
| `object` | `T` <br /> |

| Returns ||
|---|---|
| `V` | <br /> |

### getName

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getName ()
```

Returns the name for this property.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### getType

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Class<V> getType ()
```

Returns the type for this property.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Class<V>` | <br /> |

### isReadOnly

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isReadOnly ()
```

Returns true if the `https://developer.android.com/reference/android/util/Property#set(T,%20V)` method does not set the value on the target object (in which case the `https://developer.android.com/reference/android/util/Property#set(T,%20V)` method should throw a `https://developer.android.com/reference/android/util/NoSuchPropertyException` exception). This may happen if the Property wraps functionality that allows querying the underlying value but not setting it. For example, the `https://developer.android.com/reference/android/util/Property#of(java.lang.Class<T>,%20java.lang.Class<V>,%20java.lang.String)` factory method may return a Property with name "foo" for an object that has only a `getFoo()` or `isFoo()` method, but no matching `setFoo()` method.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### of

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Property<T, V> of (Class<T> hostType, 
                Class<V> valueType, 
                String name)
```

This factory method creates and returns a Property given the `class` and `name` parameters, where the `"name"` parameter represents either:

- a public `getName()` method on the class which takes no arguments, plus an optional public `setName()` method which takes a value of the same type returned by `getName()`
- a public `isName()` method on the class which takes no arguments, plus an optional public `setName()` method which takes a value of the same type returned by `isName()`
- a public `name` field on the class

If either of the get/is method alternatives is found on the class, but an appropriate `setName()` method is not found, the `Property` will be `https://developer.android.com/reference/android/util/Property#isReadOnly()`. Calling the `https://developer.android.com/reference/android/util/Property#set(T,%20V)` method on such a property is allowed, but will have no effect.

If neither the methods nor the field are found on the class a `https://developer.android.com/reference/android/util/NoSuchPropertyException` exception will be thrown.

<br />

<br />

| Parameters ||
|---|---|
| `hostType` | `Class` <br /> |
| `valueType` | `Class` <br /> |
| `name` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/util/Property<T, V>` | <br /> |

### set

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void set (T object, 
                V value)
```

Sets the value on `object` which this property represents. If the method is unable to set the value on the target object it will throw an `https://developer.android.com/reference/java/lang/UnsupportedOperationException` exception.

<br />

| Parameters ||
|---|---|
| `object` | `T` <br /> |
| `value` | `V` <br /> |