com.squareup.javapoet.ClassName.annotated()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中com.squareup.javapoet.ClassName.annotated()方法的一些代码示例,展示了ClassName.annotated()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassName.annotated()方法的具体详情如下:
包路径:com.squareup.javapoet.ClassName
类名称:ClassName
方法名:annotated

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);
}

相关文章