public abstract class Selector extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
alias |
protected String |
name |
protected boolean |
path |
Constructor and Description |
---|
Selector()
Default constructor.
|
Selector(String nameOrPath) |
Selector(String nameOrPath,
String alias) |
Modifier and Type | Method and Description |
---|---|
static void |
collectFrom(List<Selector> selectors,
Collection<?> results)
Performs collections from the results.
|
static void |
collectFrom(List<Selector> selectors,
Collection<?> results,
Map<String,FieldAccess> fields)
Performs collections from the results.
|
String |
getAlias() |
String |
getName() |
protected Object |
getPropertyValue(Object item,
Map<String,FieldAccess> fields) |
protected void |
getPropertyValueAndPutIntoRow(Map<String,Object> row,
Object item,
Map<String,FieldAccess> fields) |
abstract void |
handleComplete(List<Map<String,Object>> rows) |
abstract void |
handleRow(int index,
Map<String,Object> row,
Object item,
Map<String,FieldAccess> fields) |
abstract void |
handleStart(Collection<?> results) |
static Selector |
rowId()
Just grabs the index of the result set.
|
static Selector |
select(String... ppath)
Deprecated.
|
static Selector |
select(String propName)
Allows you to select a property or property path.
|
static Selector |
selectAs(String propName,
String alias)
Selects but allows having a different alias for the output.
|
static Selector |
selectAs(String propName,
String alias,
Function transform)
Selects but allows having a different alias for the output.
|
static Selector |
selectAsTemplate(String alias,
String template,
BoonTemplate transform)
Selects but allows having a different alias for the output
|
static <ITEM> List<Map<String,Object>> |
selectFrom(List<Selector> selectors,
Collection<ITEM> results)
Performs the actual selection from the results.
|
static <ITEM> List<Map<String,Object>> |
selectFrom(List<Selector> selectors,
Collection<ITEM> results,
Map<String,FieldAccess> fields)
Performs the actual selection from the results.
|
static Selector |
selectPropPath(String... ppath)
Deprecated.
|
static List<Selector> |
selects(Selector... selects)
Create a list of selectors.
|
static Selector |
toStr() |
static Selector |
toStr(String... ppath)
Deprecated.
|
static Selector |
toStr(String name) |
protected String name
protected String alias
protected final boolean path
public Selector()
public Selector(String nameOrPath, String alias)
nameOrPath
- name of property pathalias
- alias of property pathpublic Selector(String nameOrPath)
nameOrPath
- name of property pathpublic static void collectFrom(List<Selector> selectors, Collection<?> results)
selectors
- list of selectorsresults
- results we are selecting frompublic static void collectFrom(List<Selector> selectors, Collection<?> results, Map<String,FieldAccess> fields)
selectors
- list of selectorsresults
- results we are selecting fromfields
- fieldspublic static <ITEM> List<Map<String,Object>> selectFrom(List<Selector> selectors, Collection<ITEM> results)
ITEM
- List of itemsselectors
- list of selectorsresults
- results we are selecting frompublic static <ITEM> List<Map<String,Object>> selectFrom(List<Selector> selectors, Collection<ITEM> results, Map<String,FieldAccess> fields)
ITEM
- List of itemsselectors
- list of selectorsresults
- results we are selecting fromfields
- fieldspublic static List<Selector> selects(Selector... selects)
selects
- array of selectorspublic String getName()
protected void getPropertyValueAndPutIntoRow(Map<String,Object> row, Object item, Map<String,FieldAccess> fields)
protected Object getPropertyValue(Object item, Map<String,FieldAccess> fields)
public static Selector select(String propName)
propName
- name of property or property pathpublic static Selector selectAs(String propName, String alias)
propName
- name of property or property path to selectalias
- name that the value will be selected as.public static Selector selectAs(String propName, String alias, Function transform)
propName
- name of property or property path to selectalias
- name that the value will be selected as.transform
- Function that allows you to convert from an object into another objectpublic static Selector selectAsTemplate(String alias, String template, BoonTemplate transform)
transform
- Function that allows you to convert from an object into another objectpublic static Selector toStr()
@Deprecated public static Selector select(String... ppath)
@Deprecated public static Selector toStr(String... ppath)
@Deprecated public static Selector selectPropPath(String... ppath)
public static Selector rowId()
public abstract void handleRow(int index, Map<String,Object> row, Object item, Map<String,FieldAccess> fields)
public abstract void handleStart(Collection<?> results)
public String getAlias()
Copyright © 2014. All rights reserved.