@Override public boolean isEqual(TypeInfo that) { return Testables.isEqualHelper() .equal(accessInfo(), that.accessInfo()) .equal(kind(), that.kind()) .equal(packageInfo(), that.packageInfo()) .equal(name(), that.name()) .equal(typeParameterInfoMap(), that.typeParameterInfoMap()) .equal(annotationInfoMap(), that.annotationInfoMap()) .equal(enclosingTypeInfo(), that.enclosingTypeInfo()) .equal(superTypeInfo(), that.superTypeInfo()) .equal(interfaceInfoMap(), that.interfaceInfoMap()) .equal(constructorInfoMap(), that.constructorInfoMap()) .equal(methodInfoMap(), that.methodInfoMap()) .equal(declaredTypeInfoMap(), that.declaredTypeInfoMap()) .result(); }
public PeerResourceBuilder(TypeInfo typeInfo, String suffix) { String qualifiedName = typeInfo.qualifiedName(); String fileName = qualifiedName.replace(".", FILE_SEPARATOR); this.fileName = fileName + "." + suffix; }
@Override public Optional<InterfaceInfo> apply(TypeInfo input) { return input.toInterfaceInfo(); }
private static Naming of0(TypeInfo typeInfo) { return new Immutable( typeInfo.className(), typeInfo.classNameSuffix("Pojo"), typeInfo.classNameSuffix("Builder"), typeInfo.classNameSuffix("BuilderPojo"), typeInfo.typeVariableNameList(), typeInfo.typeVariableNameRawList(), typeInfo.typeVariableNameUnboundedList()); }
public String getRawName() { StringBuilder name = new StringBuilder(); String simpleName = getSimpleName(); name.append(simpleName); name.append(typeParameterInfoMap().toStringRaw()); return name.toString(); }
public ToMustacheHelper toMustacheHelper() { return Mustaches.toMustacheHelper() .add("access", accessInfo()) .add("package", packageInfo()) .add("name", name()) .add("simpleName", getSimpleName()) .add("rawName", getRawName()) .add("unboundName", getUnboundedName()) .add("varName", getVarName()) .add("typeParameters", typeParameterInfoMap()) .add("methods", methodInfoMap().list()); }
private static SuperTypeInfo superTypeInfo(TypeInfo typeInfo) { return TestingSuperTypeInfo.builder() .annotationInfoList(typeInfo.annotationInfoList()) .superTypeInfo(typeInfo.superTypeInfo()) .interfaceInfoMap(typeInfo.interfaceInfoMap()) .methodInfoList(typeInfo.methodInfoList()) .build(); }
private static SuperTypeInfo superTypeInfo(TypeInfo typeInfo) { return SuperTypeInfo.builder() .superTypeInfo(typeInfo.superTypeInfo()) .interfaceInfoMap(typeInfo.interfaceInfoMap()) .methodInfoMap(typeInfo.methodInfoMap()) .build(); }
InterfaceInfoMap getInterfaceInfoMap() { SuperTypeInfo superTypeInfo = superTypeInfo().or(SuperTypeInfoVoid.get()); InterfaceInfoMap thisMap = interfaceInfoMap(); return thisMap.add(superTypeInfo.getInterfaceInfoMap()); }
public TypeParameterInfoMap typeParameterInfoMap() { return typeInfo().typeParameterInfoMap(); }
public WayIterable<MethodInfo> getMethodInfoIterable() { List<MethodInfo> methodList = methodInfoMap().list(); InterfaceInfoMap interfaceInfoMap = interfaceInfoMap(); return WayIterables.from(interfaceInfoMap.list()) .transformAndConcat(InterfaceInfoGetMethodInfoList.get()) .addAll(superTypeInfoMethodList()) .filter(MethodInfoHasSameSignature.not(methodList)) .addAll(methodList); }
public SimpleTypeInfo toSimpleTypeInfo() { return SimpleTypeInfo.newType() .packageInfo(Optional.fromNullable(packageInfo())) .nameInfo(nameInfo()) .typeParameterInfoList(typeParameterInfoMap().list()) .build(); }
private Artifact iface(TypeInfo typeInfo, String message) { ClassName className = typeInfo.classNameSuffix("Message"); TypeSpec typeSpec = TypeSpec.interfaceBuilder(className) .addAnnotation(AnnotationSpec.builder(Message.class) .addMember("value", "$S", message) .build()) .build(); JavaFile javaFile = typeInfo.toJavaFile(typeSpec); return Artifact.of(javaFile); }
Artifact toArtifact(TypeSpec type) { JavaFile javaFile = typeInfo.toJavaFile(type); return Artifact.of(javaFile); }
private WayIterable<MethodInfo> superTypeInfoMethodList() { WayIterable<MethodInfo> res = WayIterables.of(); if (superTypeInfo().isPresent()) { SuperTypeInfo superType = superTypeInfo().get(); res = superType.getMethodInfoIterable(); } return res; }
public AccessInfo getAccessInfo() { return typeInfo().accessInfo(); }
public Optional<InterfaceInfo> getInterface(Class<?> type) { return typeInfo.getInterface(type); }
@Override public List<AnnotationInfo> annotationInfoList() { return typeInfo.annotationInfoList(); }
WayIterable<TypeParameterInfo> getTypeParameterInfoIterable() { return WayIterables.from(typeParameterInfoMap()); }
public String getUnboundedName() { StringBuilder name = new StringBuilder(); String simpleName = getSimpleName(); name.append(simpleName); name.append(typeParameterInfoMap().toStringUnbound()); return name.toString(); }