public class ComponentTable<T extends EntityComponent>
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
ComponentTable(java.lang.reflect.Constructor<T> ctor,
java.lang.Class<T> type,
FieldType[] fields) |
Modifier and Type | Method and Description |
---|---|
protected int |
appendFilter(AndFilter f,
java.lang.StringBuilder where,
java.util.List<java.lang.Object> parms) |
protected int |
appendFilter(ComponentFilter f,
java.lang.StringBuilder where,
java.util.List<java.lang.Object> parms) |
protected int |
appendFilter(FieldFilter f,
java.lang.StringBuilder where,
java.util.List<java.lang.Object> parms) |
protected int |
appendFilter(OrFilter f,
java.lang.StringBuilder where,
java.util.List<java.lang.Object> parms) |
protected void |
checkStructure(java.util.Map<java.lang.String,FieldType> defs,
java.util.Map<java.lang.String,java.lang.Integer> dbFields) |
java.util.Iterator<java.util.Map.Entry<EntityId,T>> |
components(SqlSession session) |
static <T extends EntityComponent> |
create(SqlSession session,
java.lang.Class<T> type) |
protected java.lang.String |
createInsertSql() |
protected java.lang.String |
createUpdateSql() |
T |
getComponent(SqlSession session,
EntityId entityId) |
EntityId |
getEntityId(SqlSession session,
ComponentFilter filter)
Retrieves the first matching entity.
|
java.util.Set<EntityId> |
getEntityIds(SqlSession session) |
java.util.Set<EntityId> |
getEntityIds(SqlSession session,
ComponentFilter filter) |
protected FieldType |
getFieldType(java.lang.String field) |
protected void |
initialize(SqlSession session) |
boolean |
removeComponent(SqlSession session,
EntityId entityId) |
void |
setComponent(SqlSession session,
EntityId entityId,
T component) |
public static <T extends EntityComponent> ComponentTable<T> create(SqlSession session, java.lang.Class<T> type) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String createUpdateSql()
protected java.lang.String createInsertSql()
protected void initialize(SqlSession session) throws java.sql.SQLException
java.sql.SQLException
protected void checkStructure(java.util.Map<java.lang.String,FieldType> defs, java.util.Map<java.lang.String,java.lang.Integer> dbFields) throws java.sql.SQLException
java.sql.SQLException
protected FieldType getFieldType(java.lang.String field)
public void setComponent(SqlSession session, EntityId entityId, T component) throws java.sql.SQLException
java.sql.SQLException
public boolean removeComponent(SqlSession session, EntityId entityId) throws java.sql.SQLException
java.sql.SQLException
public T getComponent(SqlSession session, EntityId entityId) throws java.sql.SQLException
java.sql.SQLException
public java.util.Set<EntityId> getEntityIds(SqlSession session) throws java.sql.SQLException
java.sql.SQLException
protected int appendFilter(FieldFilter f, java.lang.StringBuilder where, java.util.List<java.lang.Object> parms)
protected int appendFilter(OrFilter f, java.lang.StringBuilder where, java.util.List<java.lang.Object> parms)
protected int appendFilter(AndFilter f, java.lang.StringBuilder where, java.util.List<java.lang.Object> parms)
protected int appendFilter(ComponentFilter f, java.lang.StringBuilder where, java.util.List<java.lang.Object> parms)
public java.util.Set<EntityId> getEntityIds(SqlSession session, ComponentFilter filter) throws java.sql.SQLException
java.sql.SQLException
public EntityId getEntityId(SqlSession session, ComponentFilter filter) throws java.sql.SQLException
java.sql.SQLException
public java.util.Iterator<java.util.Map.Entry<EntityId,T>> components(SqlSession session) throws java.sql.SQLException
java.sql.SQLException