|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fest.reflect.beanproperty.PropertyName
public final class PropertyName
Understands the name of a property to access using Bean Introspection.
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);
| Method Summary | ||
|---|---|---|
|
ofType(Class<T> type)
Sets the type of the property to access. |
|
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||