public class CVUtils
extends java.lang.Object
ContentValues
and back
Created by akaish on 07.02.18.Modifier and Type | Field and Description |
---|---|
static int |
IGNORE_INCLUSIONS_AND_EXCLUSIONS |
static int |
INCLUDE_ALL_EXCEPT_SELECTED_COLUMN_NAMES |
static int |
INCLUDE_ALL_EXCEPT_SELECTED_FIELDS |
static int |
INCLUDE_ONLY_SELECTED_COLUMN_NAMES |
static int |
INCLUDE_ONLY_SELECTED_FIELDS |
static int |
ROWID_INDEX
Got some bug with queries like SELECT rowid, * from blablablatable.
|
Constructor and Description |
---|
CVUtils() |
Modifier and Type | Method and Description |
---|---|
static <M extends KittyModel> |
cursorToModel(boolean rowIDSupport,
android.database.Cursor cursor,
M model,
KittyTableConfiguration table)
Deprecated.
|
(package private) static boolean |
isDefaultTypeRepresentedType(java.lang.Class<?> fieldType)
Returns true if provided field type is Boolean, Integer, Byte, byte[], Double, Short or Float
|
(package private) static boolean |
isLongRepresentedType(java.lang.Class<?> fieldType)
Returns true if provided type is Long, Calendar, Timestamp or Date
|
(package private) static boolean |
isStringRepresentedType(java.lang.Class<?> fieldType)
Returns true if provided field type is String, BigDecimal, BigInteger or Enum
|
static <M extends KittyModel> |
modelToCV(M model,
KittyTableConfiguration table)
Generates
ContentValues instance from provided instance of KittyModel with usage
of KittyTableConfiguration configuration. |
static <M extends KittyModel> |
modelToCV(M model,
KittyTableConfiguration table,
java.lang.String[] names,
int skipOrInclude)
Generates
ContentValues instance from provided instance of KittyModel with usage
of KittyTableConfiguration configuration. |
public static final int INCLUDE_ONLY_SELECTED_FIELDS
public static final int INCLUDE_ALL_EXCEPT_SELECTED_FIELDS
public static final int INCLUDE_ONLY_SELECTED_COLUMN_NAMES
public static final int INCLUDE_ALL_EXCEPT_SELECTED_COLUMN_NAMES
public static final int IGNORE_INCLUSIONS_AND_EXCLUSIONS
public static final int ROWID_INDEX
public static <M extends KittyModel> android.content.ContentValues modelToCV(M model, KittyTableConfiguration table, java.lang.String[] names, int skipOrInclude) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.NoSuchFieldException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException
ContentValues
instance from provided instance of KittyModel
with usage
of KittyTableConfiguration
configuration. Also may throw some exceptions related with reflection access to
field of provided model and KittyRuntimeException
if there are some errors with KITTY_COLUMN
implementation.model
- instance of KittyModel
table
- table configurationnames
- array of fields names or column names to include\exclude with usage of skipInclusionsExclusions(String[], int, KittyColumnConfiguration)
skipOrInclude
- flag that determines what to do with provided KittyColumnConfiguration
instance, may be IGNORE_INCLUSIONS_AND_EXCLUSIONS
,
INCLUDE_ALL_EXCEPT_SELECTED_COLUMN_NAMES
, INCLUDE_ONLY_SELECTED_COLUMN_NAMES
, INCLUDE_ALL_EXCEPT_SELECTED_FIELDS
or INCLUDE_ONLY_SELECTED_FIELDS
. If flag's value differs from any of inclusion predefined flags than would be used default flag
(IGNORE_INCLUSIONS_AND_EXCLUSIONS
)ContentValues
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.NoSuchFieldException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
public static <M extends KittyModel> android.content.ContentValues modelToCV(M model, KittyTableConfiguration table) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.NoSuchFieldException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException
ContentValues
instance from provided instance of KittyModel
with usage
of KittyTableConfiguration
configuration. Also may throw some exceptions related with reflection access to
field of provided model and KittyRuntimeException
if there are some errors with KITTY_COLUMN
implementation.ContentValues
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.NoSuchFieldException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
@Deprecated public static <M extends KittyModel> M cursorToModel(boolean rowIDSupport, android.database.Cursor cursor, M model, KittyTableConfiguration table) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
KittyModelCVFactory.cursorToModel(Cursor, KittyModel, boolean)
instead
Sets fields of provided instance of KittyModel
(model) with values from provided Cursor
according to
provided with this instance's KITTY_COLUMN
annotations data wrapped into KittyColumnConfiguration
instance.
Also may throw some exceptions related with reflection access to
field of provided model and KittyRuntimeException
if there are some errors with KITTY_COLUMN
implementation.M
- rowIDSupport
- RowID support flagcursor
- cursor to readmodel
- blank model to filltable
- table configuration to use with this model and cursorjava.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
static boolean isDefaultTypeRepresentedType(java.lang.Class<?> fieldType)
fieldType
- static boolean isStringRepresentedType(java.lang.Class<?> fieldType)
fieldType
- static boolean isLongRepresentedType(java.lang.Class<?> fieldType)
fieldType
-