public abstract class Property
extends Object
| java.lang.Object | |
| android.util.Property<T, V> | |
|
FloatProperty<T>,
IntProperty<T>
|
属性是一个可以用来表示一个抽象的抽象
set(Object, Object)或get(Object)方法可以根据主机对象的专用字段,或通过“setter”和“getter”方法或通过适当的某种其他机制来实现。
Public constructors |
|
|---|---|
Property(Class<V> type, String name) 一个构造函数,为物业提供一个识别名称和 |
|
公共方法(Public methods) |
|
|---|---|
abstract V |
get(T object) 返回此属性在给定 |
String |
getName() 返回此属性的名称。 |
Class<V> |
getType() 返回此属性的类型。 |
boolean |
isReadOnly() 如果 |
static <T, V> Property<T, V> |
of(Class<T> hostType, Class<V> valueType, String name) 此工厂方法创建并返回给定
如果在课堂上找到任一方法的替代方法,但未找到适当的 |
void |
set(T object, V value) 设置此属性表示的 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
Property (Class<V> type, String name)
一个构造函数,它为该属性提供一个标识名称和 type 。
| 参数(Parameters) | |
|---|---|
type |
Class
|
name |
String
|
V get (T object)
返回此属性在给定的 object上表示的当前值。
| 参数(Parameters) | |
|---|---|
object |
T
|
| 返回(Returns) | |
|---|---|
V |
|
boolean isReadOnly ()
如果set(Object, Object)方法未设置目标对象上的值(在这种情况下, set()方法应抛出NoSuchPropertyException异常),则返回true。 如果属性包装允许查询基础值但不设置它的功能,则可能会发生这种情况。 例如, of(Class, Class, String)工厂方法可能会为仅包含getFoo()或isFoo()方法但没有匹配setFoo()方法的对象返回名称为“foo”的属性。
| 返回(Returns) | |
|---|---|
boolean |
|
Property<T, V> of (Class<T> hostType, Class<V> valueType, String name)
给出 class和 name参数,此工厂方法创建并返回一个Property,其中 "name"参数代表:
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() 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() name field on the class 如果任何的get /的是方法的选择是在该类发现,但适当setName()没有找到方法,该Property将是readOnly 。 在这种属性上调用set(Object, Object)方法是允许的,但不起作用。
如果在该类中找不到方法和字段,则会抛出 NoSuchPropertyException异常。
| 参数(Parameters) | |
|---|---|
hostType |
Class
|
valueType |
Class
|
name |
String
|
| 返回(Returns) | |
|---|---|
Property<T, V> |
|
void set (T object,
V value)
设置此属性表示的object上的值。 如果该方法无法设置目标对象的值,则会抛出UnsupportedOperationException异常。
| 参数(Parameters) | |
|---|---|
object |
T
|
value |
V
|