本文整理匯總了Java中com.squareup.moshi.JsonAdapter.Factory方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonAdapter.Factory方法的具體用法?Java JsonAdapter.Factory怎麽用?Java JsonAdapter.Factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.squareup.moshi.JsonAdapter
的用法示例。
在下文中一共展示了JsonAdapter.Factory方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: newFactory
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
/** Builds an adapter that fallbacks to a default value in case there's a mismatch. */
public static <T> JsonAdapter.Factory newFactory(final Type type, final T defaultValue) {
return new Factory() {
@Override public JsonAdapter<?> create(Type requestedType,
Set<? extends Annotation> annotations, Moshi moshi) {
if (Types.equals(type, requestedType)) {
JsonAdapter<T> delegate = moshi.nextAdapter(this, type, annotations);
return new DefaultOnDataMismatchAdapter<>(delegate, defaultValue);
}
return null;
}
};
}
示例2: create
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
public static JsonAdapter.Factory create() {
//return null;
return new AutoValueMoshi_MoshiFactory();
}
示例3: create
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
public static JsonAdapter.Factory create() {
return new AutoValueMoshi_OkReplayAdapterFactory();
}
示例4: create
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
public static JsonAdapter.Factory create() {
return new AutoValueMoshi_MoshiJsonAdapterFactory();
}
示例5: create
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
public static JsonAdapter.Factory create() {
return new AutoValueMoshi_ArticleJsonFactory();
}
示例6: create
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
public static JsonAdapter.Factory create() {
return new AutoValueMoshi_MyAdapterFactory();
}
示例7: newFruitFactory
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
private JsonAdapter.Factory newFruitFactory() {
return DefaultOnDataMismatchAdapter.newFactory(Fruit.class, null);
}
示例8: buildMoshi
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
private Moshi buildMoshi(JsonAdapter.Factory factory) {
return new Moshi.Builder()
.add(factory)
.build();
}
示例9: create
import com.squareup.moshi.JsonAdapter; //導入方法依賴的package包/類
public static JsonAdapter.Factory create() {
return new AutoValueMoshi_DataFactories();
}