本文整理汇总了Java中com.squareup.moshi.Json类的典型用法代码示例。如果您正苦于以下问题:Java Json类的具体用法?Java Json怎么用?Java Json使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Json类属于com.squareup.moshi包,在下文中一共展示了Json类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFields
import com.squareup.moshi.Json; //导入依赖的package包/类
@Nonnull
@Override
protected List<FieldSpec> buildFields() {
return getProperties().entrySet().stream().map(property -> {
final String name = property.getKey();
final TypeName type = property.getValue();
final String fieldName = fieldNamePolicy.convert(name, type);
return FieldSpec.builder(type, fieldName)
.addModifiers(Modifier.PRIVATE, Modifier.FINAL)
.addAnnotation(AnnotationSpec.builder(Json.class)
.addMember("name", "$S", name)
.build())
.build();
}).collect(Collectors.toList());
}
示例2: propertyField
import com.squareup.moshi.Json; //导入依赖的package包/类
@Override
public void propertyField(JFieldVar field, JDefinedClass clazz, String propertyName, JsonNode propertyNode) {
field.annotate(Json.class).param("name", propertyName);
}
示例3: enumConstant
import com.squareup.moshi.Json; //导入依赖的package包/类
@Override
public void enumConstant(JEnumConstant constant, String value) {
constant.annotate(Json.class).param("name", value);
}
示例4: buildFields
import com.squareup.moshi.Json; //导入依赖的package包/类
@Test
public void buildFields() throws Exception {
// setup
underTest.addProperty("foo", TypeName.INT)
.addProperty("bar", TypeName.OBJECT)
.addProperty("baz", TypeName.BOOLEAN);
// exercise
final List<FieldSpec> actual = underTest.buildFields();
// verify
assertThat(actual)
.hasSize(3)
.doesNotContainNull();
assertThat(actual.get(0))
.hasType(TypeName.INT)
.hasName("foo")
.isPrivate()
.isFinal()
.hasNoInitializer()
.hasAnnotation(AnnotationSpec.builder(Json.class)
.addMember("name", "$S", "foo")
.build());
assertThat(actual.get(1))
.hasType(TypeName.OBJECT)
.hasName("bar")
.isPrivate()
.isFinal()
.hasNoInitializer()
.hasAnnotation(AnnotationSpec.builder(Json.class)
.addMember("name", "$S", "bar")
.build());
assertThat(actual.get(2))
.hasType(TypeName.BOOLEAN)
.hasName("baz")
.isPrivate()
.isFinal()
.hasNoInitializer()
.hasAnnotation(AnnotationSpec.builder(Json.class)
.addMember("name", "$S", "baz")
.build());
}
示例5: assetsUrl
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "assets_url")
@Nullable
public abstract String assetsUrl();
示例6: behindBy
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "behind_by")
@Nullable
public abstract Integer behindBy();
示例7: mergeBaseCommit
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "merge_base_commit")
@Nullable
public abstract Commit mergeBaseCommit();
示例8: targetCommitish
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "target_commitish")
@Nullable
public abstract String targetCommitish();
示例9: htmlUrl
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "html_url")
@Nullable
public abstract String htmlUrl();
示例10: createdAt
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "created_at")
@Nullable
@FormattedTime
public abstract Date createdAt();
示例11: commitId
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "commit_id")
@Nullable
public abstract String commitId();
示例12: publicGists
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "public_gists")
@Nullable
public abstract Integer publicGists();
示例13: originalPosition
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "original_position")
@Nullable
public abstract Integer originalPosition();
示例14: bodyHtml
import com.squareup.moshi.Json; //导入依赖的package包/类
@Nullable
@Json(name = "body_html")
@FormattedHtml
public abstract String bodyHtml();
示例15: watchersCount
import com.squareup.moshi.Json; //导入依赖的package包/类
@Json(name = "watchers_count")
@Nullable
public abstract Integer watchersCount();