本文整理汇总了Java中com.activeandroid.serializer.TypeSerializer类的典型用法代码示例。如果您正苦于以下问题:Java TypeSerializer类的具体用法?Java TypeSerializer怎么用?Java TypeSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeSerializer类属于com.activeandroid.serializer包,在下文中一共展示了TypeSerializer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadSerializerList
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
private List<Class<? extends TypeSerializer>> loadSerializerList(String[] serializers) {
final List<Class<? extends TypeSerializer>> typeSerializers = new ArrayList<Class<? extends TypeSerializer>>();
final ClassLoader classLoader = mContext.getClass().getClassLoader();
for (String serializer : serializers) {
try {
Class serializerClass = Class.forName(serializer.trim(), false, classLoader);
if (ReflectionUtils.isTypeSerializer(serializerClass)) {
typeSerializers.add(serializerClass);
}
}
catch (ClassNotFoundException e) {
Log.e("Couldn't create class.", e);
}
}
return typeSerializers;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:Configuration.java
示例2: addTypeSerializer
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
public Builder addTypeSerializer(Class<? extends TypeSerializer> typeSerializer) {
if (mTypeSerializers == null) {
mTypeSerializers = new ArrayList<Class<? extends TypeSerializer>>();
}
mTypeSerializers.add(typeSerializer);
return this;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:Configuration.java
示例3: addTypeSerializers
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
public Builder addTypeSerializers(Class<? extends TypeSerializer>... typeSerializers) {
if (mTypeSerializers == null) {
mTypeSerializers = new ArrayList<Class<? extends TypeSerializer>>();
}
mTypeSerializers.addAll(Arrays.asList(typeSerializers));
return this;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:Configuration.java
示例4: createColumnDefinition
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static String createColumnDefinition(TableInfo tableInfo, Field field) {
StringBuilder definition = new StringBuilder();
Class<?> type = field.getType();
final String name = tableInfo.getColumnName(field);
final TypeSerializer typeSerializer = Cache.getParserForType(field.getType());
final Column column = field.getAnnotation(Column.class);
if (typeSerializer != null) {
type = typeSerializer.getSerializedType();
}
if (TYPE_MAP.containsKey(type)) {
definition.append(name);
definition.append(" ");
definition.append(TYPE_MAP.get(type).toString());
}
else if (ReflectionUtils.isModel(type)) {
definition.append(name);
definition.append(" ");
definition.append(SQLiteType.INTEGER.toString());
}
else if (ReflectionUtils.isSubclassOf(type, Enum.class)) {
definition.append(name);
definition.append(" ");
definition.append(SQLiteType.TEXT.toString());
}
if (!TextUtils.isEmpty(definition)) {
if (name.equals(tableInfo.getIdName())) {
definition.append(" PRIMARY KEY AUTOINCREMENT");
}else if(column!=null){
if (column.length() > -1) {
definition.append("(");
definition.append(column.length());
definition.append(")");
}
if (column.notNull()) {
definition.append(" NOT NULL ON CONFLICT ");
definition.append(column.onNullConflict().toString());
}
if (column.unique()) {
definition.append(" UNIQUE ON CONFLICT ");
definition.append(column.onUniqueConflict().toString());
}
}
if (FOREIGN_KEYS_SUPPORTED && ReflectionUtils.isModel(type)) {
definition.append(" REFERENCES ");
definition.append(Cache.getTableInfo((Class<? extends Model>) type).getTableName());
definition.append("("+tableInfo.getIdName()+")");
definition.append(" ON DELETE ");
definition.append(column.onDelete().toString().replace("_", " "));
definition.append(" ON UPDATE ");
definition.append(column.onUpdate().toString().replace("_", " "));
}
}
else {
Log.e("No type mapping for: " + type.toString());
}
return definition.toString();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:68,代码来源:SQLiteUtils.java
示例5: getParserForType
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
public static synchronized TypeSerializer getParserForType(Class<?> type) {
return sModelInfo.getTypeSerializer(type);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Cache.java
示例6: getTypeSerializers
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
public List<Class<? extends TypeSerializer>> getTypeSerializers() {
return mTypeSerializers;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Configuration.java
示例7: setTypeSerializers
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
public Builder setTypeSerializers(Class<? extends TypeSerializer>... typeSerializers) {
mTypeSerializers = Arrays.asList(typeSerializers);
return this;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Configuration.java
示例8: getTypeSerializer
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
public TypeSerializer getTypeSerializer(Class<?> type) {
return mTypeSerializers.get(type);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ModelInfo.java
示例9: isTypeSerializer
import com.activeandroid.serializer.TypeSerializer; //导入依赖的package包/类
public static boolean isTypeSerializer(Class<?> type) {
return isSubclassOf(type, TypeSerializer.class);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ReflectionUtils.java
注:本文中的com.activeandroid.serializer.TypeSerializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论