Partager via


Property.Of(Class, Class, String) Method

Definition

This factory method creates and returns a Property given the class and name parameters, where the "name" parameter represents either: <ul> <li>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()<li>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()<li>a public name field on the class </ul>

[Android.Runtime.Register("of", "(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/String;)Landroid/util/Property;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "V" })]
public static Android.Util.Property? Of (Java.Lang.Class? hostType, Java.Lang.Class? valueType, string? name);
[<Android.Runtime.Register("of", "(Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/String;)Landroid/util/Property;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "V" })>]
static member Of : Java.Lang.Class * Java.Lang.Class * string -> Android.Util.Property

Parameters

hostType
Class
valueType
Class
name
String

Returns

Attributes

Remarks

This factory method creates and returns a Property given the class and name parameters, where the "name" parameter represents either: <ul> <li>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()<li>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()<li>a public name field on the class </ul>

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 #isReadOnly() readOnly. Calling the #set(Object, Object) 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 NoSuchPropertyException exception will be thrown.

Java documentation for android.util.Property.of(java.lang.Class<T>, java.lang.Class<V>, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to