本文整理了Java中com.squareup.javapoet.ClassName.annotated()
方法的一些代码示例,展示了ClassName.annotated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassName.annotated()
方法的具体详情如下:
包路径:com.squareup.javapoet.ClassName
类名称:ClassName
方法名:annotated
暂无
代码示例来源:origin: square/javapoet
private ParameterizedTypeName(ParameterizedTypeName enclosingType, ClassName rawType,
List<TypeName> typeArguments, List<AnnotationSpec> annotations) {
super(annotations);
this.rawType = checkNotNull(rawType, "rawType == null").annotated(annotations);
this.enclosingType = enclosingType;
this.typeArguments = Util.immutableList(typeArguments);
checkArgument(!this.typeArguments.isEmpty() || enclosingType != null,
"no type arguments: %s", rawType);
for (TypeName typeArgument : this.typeArguments) {
checkArgument(!typeArgument.isPrimitive() && typeArgument != VOID,
"invalid type parameter: %s", typeArgument);
}
}
代码示例来源:origin: facebook/litho
@Test
public void testDiffModelHasNoTypeParameter() {
when(mDiffModel.getTypeName()).thenReturn(
ClassNames.DIFF.annotated(AnnotationSpec.builder(State.class).build()));
List<SpecModelValidationError> validationErrors = DiffValidation.validate(mSpecModel);
assertSingleError(validationErrors, DiffValidation.MISSING_TYPE_PARAMETER_ERROR);
}
内容来源于网络,如有侵权,请联系作者删除!