本文整理了Java中com.squareup.javapoet.ClassName.toString()
方法的一些代码示例,展示了ClassName.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassName.toString()
方法的具体详情如下:
包路径:com.squareup.javapoet.ClassName
类名称:ClassName
方法名:toString
暂无
代码示例来源:origin: JakeWharton/butterknife
@Override public String toString() {
return bindingClassName.toString();
}
代码示例来源:origin: facebook/litho
@Override
public Set<String> getSupportedAnnotationTypes() {
return new LinkedHashSet<>(
Arrays.asList(
ClassNames.LAYOUT_SPEC.toString(),
ClassNames.MOUNT_SPEC.toString(),
ClassNames.TEST_SPEC.toString()));
}
代码示例来源:origin: facebook/litho
@Override
public Set<String> getSupportedAnnotationTypes() {
return new LinkedHashSet<>(
Arrays.asList(
SectionClassNames.GROUP_SECTION_SPEC.toString(),
SectionClassNames.DIFF_SECTION_SPEC.toString()));
}
}
代码示例来源:origin: facebook/litho
@Override
public Set<String> getSupportedAnnotationTypes() {
return new LinkedHashSet<>(
Arrays.asList(ClassNames.LAYOUT_SPEC.toString(), ClassNames.MOUNT_SPEC.toString()));
}
}
代码示例来源:origin: facebook/litho
@Override
public Set<String> getSupportedAnnotationTypes() {
return new LinkedHashSet<>(Collections.singletonList(ClassNames.TEST_SPEC.toString()));
}
}
代码示例来源:origin: facebook/litho
private static String getTypeNameString(ClassName className) {
ClassName enclosingClass = className.enclosingClassName();
if (enclosingClass == null) {
return className.toString();
}
return enclosingClass.toString() + "$" + className.simpleName();
}
}
代码示例来源:origin: bluelinelabs/LoganSquare
public JsonFieldType(ClassName className) {
mClassName = className;
mMapperClassName = mClassName.toString() + Constants.MAPPER_CLASS_SUFFIX;
mMapperVariableName = ObjectMapperInjector.getMapperVariableName(mMapperClassName);
}
代码示例来源:origin: web3j/web3j
.rawType.toString();
typeMapInput = ((ParameterizedTypeName) typeName).rawType + ".class, "
+ innerTypeName + ".class";
代码示例来源:origin: facebook/litho
if (ClassNames.LAYOUT_SPEC.toString().equals(annotationName)) {
factory = new LayoutSpecModelFactory();
} else if (ClassNames.MOUNT_SPEC.toString().equals(annotationName)) {
factory = new MountSpecModelFactory();
} else {
代码示例来源:origin: facebook/litho
static String getStateContainerClassName(SpecModel specModel) {
if (specModel.getStateValues().isEmpty()) {
return specModel.getStateContainerClass().toString();
} else {
return specModel.getComponentName() + GeneratorConstants.STATE_CONTAINER_NAME_SUFFIX;
}
}
代码示例来源:origin: airbnb/epoxy
/**
* Returns the ClassType of the given model by finding a match in the list of generated models. If
* no match is found the original model type is returned as a fallback.
*/
private TypeName getFullyQualifiedModelTypeName(ControllerModelField model,
List<GeneratedModelInfo> generatedModels) {
String modelName = model.getTypeName().toString();
for (GeneratedModelInfo generatedModel : generatedModels) {
String generatedName = generatedModel.getGeneratedName().toString();
if (generatedName.endsWith("." + modelName)) {
return generatedModel.getGeneratedName();
}
}
// Fallback to using the same name
return model.getTypeName();
}
代码示例来源:origin: facebook/litho
static String getStateContainerClassNameWithTypeVars(SpecModel specModel) {
if (specModel.getStateValues().isEmpty()) {
return specModel.getStateContainerClass().toString();
} else {
return getStateContainerClassName(specModel) + getTypeVariablesString(specModel);
}
}
代码示例来源:origin: facebook/litho
@Test
public void testCreateWithSpecifiedName() {
when(mLayoutSpec.value()).thenReturn("TestComponentName");
LayoutSpecModel layoutSpecModel =
mFactory.create(
mElements,
mTypes,
mTypeElement,
mMessager,
RunMode.normal(),
mDependencyInjectionHelper,
null);
assertThat(layoutSpecModel.getSpecName()).isEqualTo("TestSpec");
assertThat(layoutSpecModel.getComponentName()).isEqualTo("TestComponentName");
assertThat(layoutSpecModel.getSpecTypeName().toString()).isEqualTo(TEST_QUALIFIED_SPEC_NAME);
assertThat(layoutSpecModel.getComponentTypeName().toString())
.isEqualTo("com.facebook.litho.TestComponentName");
}
}
代码示例来源:origin: facebook/litho
@Test
public void testCreate() {
final TestSpecModelFactory factory = new TestSpecModelFactory();
final TestSpecModel layoutSpecModel =
factory.create(mElements, mTypes, mTypeElement, mMessager, RunMode.normal(), null, null);
assertThat(layoutSpecModel.getSpecName()).isEqualTo("TestMyLayoutSpec");
assertThat(layoutSpecModel.getComponentName()).isEqualTo("TestMyLayout");
assertThat(layoutSpecModel.getSpecTypeName().toString())
.isEqualTo(
"com.facebook.litho.specmodels.processor.testing.TestLayoutSpecModelFactoryTest.TestMyLayoutSpec");
assertThat(layoutSpecModel.getComponentTypeName().toString())
.isEqualTo(
"com.facebook.litho.specmodels.processor.testing.TestLayoutSpecModelFactoryTest.TestMyLayout");
assertThat(layoutSpecModel.getProps().stream().map(PropModel::getName).toArray())
.hasSize(4)
.contains("child", atIndex(0))
.contains("i", atIndex(1))
.contains("s", atIndex(2))
.contains("size", atIndex(3));
}
代码示例来源:origin: facebook/litho
@Test
public void testCreate() {
LayoutSpecModel layoutSpecModel =
mFactory.create(
mElements,
mTypes,
mTypeElement,
mMessager,
RunMode.normal(),
mDependencyInjectionHelper,
null);
assertThat(layoutSpecModel.getSpecName()).isEqualTo("TestSpec");
assertThat(layoutSpecModel.getComponentName()).isEqualTo("Test");
assertThat(layoutSpecModel.getSpecTypeName().toString()).isEqualTo(TEST_QUALIFIED_SPEC_NAME);
assertThat(layoutSpecModel.getComponentTypeName().toString())
.isEqualTo(TEST_QUALIFIED_COMPONENT_NAME);
assertThat(layoutSpecModel.getDelegateMethods()).isEmpty();
assertThat(layoutSpecModel.getProps()).isEmpty();
assertThat(layoutSpecModel.hasInjectedDependencies()).isTrue();
assertThat(layoutSpecModel.getDependencyInjectionHelper()).isSameAs(mDependencyInjectionHelper);
}
代码示例来源:origin: facebook/litho
assertThat(layoutSpecModel.getSpecTypeName().toString())
.isEqualTo(
"com.facebook.litho.specmodels.processor.testing.TestLayoutSpecModelFactoryTest.TestMyLayoutSpec");
代码示例来源:origin: facebook/litho
public static TypeSpecDataHolder generate(SpecModel specModel) {
final TypeSpecDataHolder.Builder typeSpecDataHolder = TypeSpecDataHolder.newBuilder();
final String classJavadoc = specModel.getClassJavadoc();
if (classJavadoc != null) {
typeSpecDataHolder
.addJavadoc(new JavadocSpec(classJavadoc))
.addJavadoc(new JavadocSpec("<p>\n"));
}
for (PropModel prop : specModel.getProps()) {
final String propTag = prop.isOptional() ? "@prop-optional" : "@prop-required";
// Adds javadoc with following format:
// @prop-required name type javadoc.
// This can be changed later to use clear demarcation for fields.
// This is a block tag and cannot support inline tags like "{@link something}".
typeSpecDataHolder.addJavadoc(
new JavadocSpec(
"$L $L $L $L\n",
propTag,
prop.getName(),
prop.getTypeName(),
getPropJavadocForProp(specModel, prop)));
}
if (specModel.getSpecTypeName() != null) {
// Add a link back to the spec this was build from for easier jumping.
typeSpecDataHolder.addJavadoc(
new JavadocSpec("\n@see $N\n", specModel.getSpecTypeName().toString()));
}
return typeSpecDataHolder.build();
}
代码示例来源:origin: facebook/litho
.hasToString(localErrorEventMethod.typeModel.name.toString());
代码示例来源:origin: facebook/litho
assertThat(mountSpecModel.getSpecTypeName().toString())
.isEqualTo(
"com.facebook.litho.specmodels.processor.MountSpecModelFactoryTest.TestMountSpec");
代码示例来源:origin: facebook/litho
assertThat(specModel.getSpecTypeName().toString()).isEqualTo(TEST_QUALIFIED_SPEC_NAME);
assertThat(specModel.getComponentTypeName().toString())
.isEqualTo(TEST_QUALIFIED_COMPONENT_NAME);
内容来源于网络,如有侵权,请联系作者删除!