public class SqlObjectList<ObjType extends SqlObject> extends SqlObject implements Iterable<ObjType>
DEFAULT_DELIMITER
).
Note that this class is generally intended to be used internally by the other SqlObjects.
The default list item separator used by this framework is a simple ",".
This is generally sufficient for interacting with most databases. That
said, sometimes it is desirable to have the more readable separator of
", ". This can be enabled by setting the system property
"com.healthmarketscience.sqlbuilder.useSpaceAfterDelimiter" to true
.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DELIMITER
the default delimiter used by a SqlObjectList
|
static String |
USE_SPACE_AFTER_DELIMITER_PROPERTY |
ALL_SYMBOL, NULL_VALUE, QUESTION_MARK
Constructor and Description |
---|
SqlObjectList() |
SqlObjectList(String delimiter) |
SqlObjectList(String delimiter,
List<ObjType> objects) |
Modifier and Type | Method and Description |
---|---|
SqlObjectList<ObjType> |
addObject(ObjType obj)
Adds the given object to the list
|
<SrcType,DstType extends ObjType> |
addObjects(Converter<SrcType,DstType> converter,
Iterable<? extends SrcType> objs)
Adds the given objects to the list after converting each of them using
the given converter.
|
<SrcType,DstType extends ObjType> |
addObjects(Converter<SrcType,DstType> converter,
SrcType... objs)
Adds the given objects to the list after converting each of them using
the given converter.
|
SqlObjectList<ObjType> |
addObjects(Iterable<? extends ObjType> objs)
Adds the given objects to the list
|
SqlObjectList<ObjType> |
addObjects(ObjType... objs)
Adds the given objects to the list
|
void |
appendTo(AppendableExt app)
Appends this object to the given AppendableExt.
|
void |
clear()
Removes all objects from the list.
|
protected void |
collectSchemaObjects(ValidationContext vContext)
Used during Query.validate() calls to collect the dbschema objects
referenced in a query.
|
static <ObjType extends SqlObject> |
create()
Constructs and returns a new SqlObjectList, conveniently allows
construction without respecifying generic param type.
|
static <ObjType extends SqlObject> |
create(String delimiter)
Constructs and returns a new SqlObjectList, conveniently allows
construction without respecifying generic param type.
|
ObjType |
get(int index)
Returns the object at the specified index.
|
String |
getDelimiter() |
boolean |
isEmpty() |
Iterator<ObjType> |
iterator() |
ListIterator<ObjType> |
listIterator() |
int |
size() |
collectSchemaObjects, doValidate, toString
toString, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final String USE_SPACE_AFTER_DELIMITER_PROPERTY
public static final String DEFAULT_DELIMITER
public SqlObjectList()
public SqlObjectList(String delimiter)
public static <ObjType extends SqlObject> SqlObjectList<ObjType> create()
public static <ObjType extends SqlObject> SqlObjectList<ObjType> create(String delimiter)
delimiter
- to use when appending the listpublic String getDelimiter()
public int size()
public boolean isEmpty()
true
if there are no objects in the list, false
otherwise.public void clear()
public ObjType get(int index)
public ListIterator<ObjType> listIterator()
public SqlObjectList<ObjType> addObject(ObjType obj)
obj
- the object to be addedpublic SqlObjectList<ObjType> addObjects(ObjType... objs)
objs
- the objects to be added, no-op if null
public SqlObjectList<ObjType> addObjects(Iterable<? extends ObjType> objs)
objs
- the objects to be added, no-op if null
public <SrcType,DstType extends ObjType> SqlObjectList<ObjType> addObjects(Converter<SrcType,DstType> converter, SrcType... objs)
converter
- Converter which generates the actual objects to be added
from the given objectsobjs
- the objects to be added, no-op if null
public <SrcType,DstType extends ObjType> SqlObjectList<ObjType> addObjects(Converter<SrcType,DstType> converter, Iterable<? extends SrcType> objs)
converter
- Converter which generates the actual objects to be added
from the given objectsobjs
- the objects to be added, no-op if null
protected void collectSchemaObjects(ValidationContext vContext)
SqlObject
collectSchemaObjects
in class SqlObject
vContext
- handle to the current validation contextpublic void appendTo(AppendableExt app) throws IOException
Appendee
appendTo
in interface Appendee
appendTo
in class AppendeeObject
app
- the AppendableExt to which this class should append itselfIOException
- if the append failsCopyright © 2006–2021 OpenHMS. All rights reserved.