|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.github.jknack.extend.Extend
public final class Extend
Extends JavaBean or convert them to Map and add new properties at runtime.
Usage:
import static com.github.jknack.extend.Extend.*;
...
MyObject extended =
extend(object,
$("propertyA", value),
$("propertyB", value),
...
);
Derived Properties:
import static com.github.jknack.extend.Extend.*;
...
MyObject extended =
extend(object,
$("propertyA", new Function() {
public Integer apply(MyObject object) {
return ...;
}
})
);
Convert a JavaBean to a Map:
import static com.github.jknack.extend.Extend.*; ... Mapextended = map(object, $("propertyA", value) );
| Nested Class Summary | |
|---|---|
static class |
Extend.Property
Helper class for simplify object property creation. |
| Method Summary | ||
|---|---|---|
static Extend.Property |
$(String name,
Object value)
Factory method for Extend.Property. |
|
static
|
extend(Iterable<T> sources,
Extend.Property... properties)
Extends each object with the given properties. |
|
static
|
extend(Iterable<T> sources,
Map<String,Object> properties)
Extends each object with the given properties. |
|
static
|
extend(T source,
Extend.Property... properties)
Extends an object with the given properties. |
|
static
|
extend(T source,
Map<String,Object> properties)
Extends an object with the given properties. |
|
static
|
map(Iterable<T> sources,
Extend.Property... properties)
Converts each object to a Map. |
|
static
|
map(Iterable<T> sources,
Map<String,Object> properties)
Converts each object to a Map. |
|
static
|
map(T source,
Extend.Property... properties)
Converts an object to a Map. |
|
static
|
map(T source,
Map<String,Object> properties)
Converts an object to a Map. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Extend.Property $(String name,
Object value)
Extend.Property.
name - The property's name. Required.value - The property's value. Required.
Extend.Property.
public static <T> List<T> extend(Iterable<T> sources,
Extend.Property... properties)
T - The source type.sources - The objects to extend. Required.properties - The extra property set. Required.
public static <T> T extend(T source,
Extend.Property... properties)
T - The source type.source - The object to extend. Required.properties - The extra property set. Required.
public static <T> List<T> extend(Iterable<T> sources,
Map<String,Object> properties)
T - The source type.sources - The objects to extend. Required.properties - The extra property set. Required.
public static <T> T extend(T source,
Map<String,Object> properties)
T - The source type.source - The object to extend. Required.properties - The extra property set. Required.
public static <T> Map<String,Object> map(T source,
Extend.Property... properties)
Map. The resulting map is the union of the bean properties and
all the extra properties.
T - The source type.source - The object to extend. Required.properties - The extra property set. Required.
public static <T> List<Map<String,Object>> map(Iterable<T> sources,
Extend.Property... properties)
Map. The resulting map is the union of the bean properties
and all the extra properties.
T - The source type.sources - The objects to extend. Required.properties - The extra property set. Required.
public static <T> List<Map<String,Object>> map(Iterable<T> sources,
Map<String,Object> properties)
Map. The resulting map is the union of the bean properties
and all the extra properties.
T - The source type.sources - The objects to extend. Required.properties - The extra property set. Required.
public static <T> Map<String,Object> map(T source,
Map<String,Object> properties)
Map. The resulting map is the union of the bean properties and
all the extra properties.
T - The source type.source - The object to extend. Required.properties - The extra property set. Required.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||