Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Ctors](https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#pubctors) \| [Methods](https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#inhmethods)

# ContentCaptureNodeProperties

*** ** * ** ***


`
public


class
ContentCaptureNodeProperties
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.contentcapture.ContentCaptureNodeProperties |

<br />

*** ** * ** ***

Properties of a Node for Content Capture.

Used to provide changes from a UI node (e.g. a View or a virtual view) to the Content Capture
System efficiently. An instance of this class should be reused during view tree traversal to
minimize memory allocations.

To use this class:

1. Obtain the `https://developer.android.com/reference/android/view/autofill/AutofillId` of the node. For virtual views, use `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureSession#newAutofillId(android.view.autofill.AutofillId,%20long)`.
2. Set the desired properties on an instance of this class (e.g., `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#setText(java.lang.CharSequence)`, `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#setBounds(int,%20int,%20int,%20int)`).
3. Pass the ID and this properties instance to `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureSession#notifyNodeAppearedOrChanged(android.view.autofill.AutofillId,%20android.view.contentcapture.ContentCaptureNodeProperties)`.
4. Call `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#clear()` to reset the properties before reusing the instance for the next node.

<br />

To track which properties have been modified explicitly this class offers methods like
`https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasBounds()`, `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasText()` that will return `true` only if the corresponding
property was explicitly set. Calling `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#clear()` removes all set fields and brings back this
class to its initial state to be reused.

Calling a getter method when the corresponding property has not been set (i.e. when
`has*()` returns `false`) will throw an `https://developer.android.com/reference/java/lang/IllegalStateException`. Callers should
check `has*()` prior to calling the getter.

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#ContentCaptureNodeProperties()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#clear()() ` Clears the entire properties object for reuse. |
| ` void` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#getBounds(android.graphics.Rect)(https://developer.android.com/reference/android/graphics/Rect outBounds) ` Copies the relative boundaries of this node into the provided `https://developer.android.com/reference/android/graphics/Rect`. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#getContentDescription()() ` Gets the content description of the node. |
| ` https://developer.android.com/reference/android/view/autofill/AutofillId` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#getParentId()() ` Gets the parent ID of the node. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#getText()() ` Gets the text of the node. |
| ` boolean` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasBounds()() ` Checks if the bounds have been explicitly set. |
| ` boolean` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasContentDescription()() ` Checks if the content description has been explicitly set. |
| ` boolean` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasParentId()() ` Checks if the parent ID has been explicitly set. |
| ` boolean` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasText()() ` Checks if the text has been explicitly set. |
| ` void` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#setBounds(int,%20int,%20int,%20int)(int left, int top, int right, int bottom) ` Sets the boundaries for this node relative to the parent node. |
| ` void` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#setContentDescription(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence contentDescription) ` Sets the content description for this node. |
| ` void` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#setParentId(android.view.autofill.AutofillId)(https://developer.android.com/reference/android/view/autofill/AutofillId parentId) ` Sets the parent ID for this node. |
| ` void` | ` https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#setText(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence text) ` Sets the text for this node. |

### 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

### ContentCaptureNodeProperties

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public ContentCaptureNodeProperties ()
```

<br />

<br />

## Public methods

### clear

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void clear ()
```

Clears the entire properties object for reuse.
This resets all properties to their default unspecified state, meaning all "has\*" methods
will subsequently return false.

<br />

### getBounds

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void getBounds (Rect outBounds)
```

Copies the relative boundaries of this node into the provided `https://developer.android.com/reference/android/graphics/Rect`.

<br />

| Parameters ||
|---|---|
| `outBounds` | `Rect`: The mutable `https://developer.android.com/reference/android/graphics/Rect` to receive the bounds. Must not be null. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasBounds()` is `false`. |

### getContentDescription

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public CharSequence getContentDescription ()
```

Gets the content description of the node.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | the content description of the node, or `null` if explicitly set to `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasContentDescription()` is `false`. |

### getParentId

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public AutofillId getParentId ()
```

Gets the parent ID of the node.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/autofill/AutofillId` | The parent ID of the node, or `null` if explicitly set to `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasParentId()` is `false`. |

### getText

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public CharSequence getText ()
```

Gets the text of the node.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | the text of the node, or `null` if explicitly set to `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureNodeProperties#hasText()` is `false`. |

### hasBounds

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean hasBounds ()
```

Checks if the bounds have been explicitly set.

<br />

| Returns ||
|---|---|
| `boolean` | true if the bounds were modified, false otherwise. <br /> |

### hasContentDescription

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean hasContentDescription ()
```

Checks if the content description has been explicitly set.

<br />

| Returns ||
|---|---|
| `boolean` | true if the content description was modified, false otherwise. <br /> |

### hasParentId

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean hasParentId ()
```

Checks if the parent ID has been explicitly set.

<br />

| Returns ||
|---|---|
| `boolean` | true if the parent ID was modified, false otherwise. <br /> |

### hasText

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean hasText ()
```

Checks if the text has been explicitly set.

<br />

| Returns ||
|---|---|
| `boolean` | true if the text was modified, false otherwise. <br /> |

### setBounds

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void setBounds (int left, 
                int top, 
                int right, 
                int bottom)
```

Sets the boundaries for this node relative to the parent node.

<br />

| Parameters ||
|---|---|
| `left` | `int`: left bound <br /> |
| `top` | `int`: top bound <br /> |
| `right` | `int`: right bound <br /> |
| `bottom` | `int`: bottom bound <br /> |

### setContentDescription

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void setContentDescription (CharSequence contentDescription)
```

Sets the content description for this node.

<br />

| Parameters ||
|---|---|
| `contentDescription` | `CharSequence`: The content description to set, or null. <br /> |

### setParentId

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void setParentId (AutofillId parentId)
```

Sets the parent ID for this node.

<br />

| Parameters ||
|---|---|
| `parentId` | `AutofillId`: The parent ID to set, or null if the node has no parent. <br /> |

### setText

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void setText (CharSequence text)
```

Sets the text for this node.

<br />

| Parameters ||
|---|---|
| `text` | `CharSequence`: The text to set, or null to remove current text. <br /> |