public final class PropertyName extends Object
The following is an example of proper usage of this class:
// Retrieves the value of the property "name" String name =property
("name").ofType
(String.class).in
(person).get
(); // Sets the value of the property "name" to "Yoda"property
("name").ofType
(String.class).in
(person).set
("Yoda"); // Retrieves the value of the property "powers" List<String> powers =property
("powers").ofType
(newTypeRef
<List<String>>() {}).in
(jedi).get
(); // Sets the value of the property "powers" List<String> powers = new ArrayList<String>(); powers.add("heal");property
("powers").ofType
(newTypeRef
<List<String>>() {}).in
(jedi).set
(powers);
Modifier and Type | Method and Description |
---|---|
<T> PropertyType<T> |
ofType(Class<T> type)
Sets the type of the property to access.
|
<T> PropertyTypeRef<T> |
ofType(TypeRef<T> type)
Sets the type reference of the property to access.
|
static PropertyName |
startPropertyAccess(String name)
Creates a new
: the starting point of the fluent interface for accessing
properties using Bean Introspection. |
public static PropertyName startPropertyAccess(String name)
PropertyName
: the starting point of the fluent interface for accessing
properties using Bean Introspection.name
- the name of the property to access using Bean Introspection.PropertyName
.NullPointerException
- if the given name is null
.IllegalArgumentException
- if the given name is empty.public <T> PropertyType<T> ofType(Class<T> type)
T
- the generic type of the property type.type
- the type of the property to access.NullPointerException
- if the given type is null
.public <T> PropertyTypeRef<T> ofType(TypeRef<T> type)
For example:
List<String> powers =property
("powers").ofType
(newTypeRef
<List<String>>() {}).in
(jedi).get
();
T
- the generic type of the property type.type
- the type of the property to access.NullPointerException
- if the given type reference is null
.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.