# Yahoo! UI Library

### element 2.8.2r1

Yahoo! UI Library > element > YAHOO.util.Attribute
Search:
Filters
Show Private Show Protected Show Deprecated

## Class YAHOO.util.Attribute

Provides Attribute configurations.

### Constructor

YAHOO.util.Attribute `( hash , The )`

Parameters:
  `hash <Object>` The intial Attribute.
  `The <YAHOO.util.AttributeProvider>` owner of the Attribute instance.

### Properties

#### _initialConfig - `private Object`

The attribute's initial configuration.

#### _written - `private Boolean`

Whether or not the attribute's value has been set.

#### getter - `Function`

The function to use when getting the attribute's value. The getter receives the new value as the first arg and the attribute name as the 2nd The return value of the getter will be used as the return from get().

#### method - `Function`

A function to call when setting the attribute's value. The method receives the new value as the first arg and the attribute name as the 2nd

#### name - `String`

The name of the attribute.

#### owner - `YAHOO.util.AttributeProvider`

The owner of the attribute.

#### readOnly - `Boolean`

Whether or not the attribute is read only.

#### setter - `Function`

The function to use when setting the attribute's value. The setter receives the new value as the first arg and the attribute name as the 2nd The return value of the setter replaces the value passed to set().

#### validator - `Function`

The validator to use when setting the attribute's value.

#### value - `String`

The value of the attribute.

#### writeOnce - `Boolean`

Whether or not the attribute can only be written once.

### Methods

#### configure

`void configure ( map , init )`
Allows for configuring the Attribute's properties.

Parameters:
  `map <Object>` A key-value map of Attribute properties.
  `init <Boolean>` Whether or not this should become the initial config.

#### getValue

`any getValue ( )`
Retrieves the current value of the attribute.

Returns: `any`
  The current value of the attribute.

#### refresh

`Boolean refresh ( )`
Resets the value to the current value. Useful when values may have gotten out of sync with actual properties.

Returns: `Boolean`
  Whether or not the value was set.

#### resetConfig

`void resetConfig ( )`
Resets the attribute config to the initial config state.

#### resetValue

`Boolean resetValue ( )`
Resets the value to the initial config value.

Returns: `Boolean`
  Whether or not the value was set.

#### setValue

`Boolean setValue ( value , silent )`
Sets the value of the attribute and fires beforeChange and change events.

Parameters:
  `value <Any>` The value to apply to the attribute.
  `silent <Boolean>` If true the change events will not be fired.

Returns: `Boolean`
  Whether or not the value was set.

Copyright © 2010 Yahoo! Inc. All rights reserved.