com.github.tankist88.object2source.extension.collections.EmptySetExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of object2source Show documentation
Show all versions of object2source Show documentation
A library for generating the source code that creates an instance of the object that is submitted to the input.
package com.github.tankist88.object2source.extension.collections;
import com.github.tankist88.object2source.dto.ProviderInfo;
import com.github.tankist88.object2source.util.GenerationUtil;
import java.util.Set;
public class EmptySetExtension extends AbstractCollectionExtension {
@Override
public void fillMethodBody(StringBuilder bb, Set providers, int objectDepth, Object obj) throws Exception {
bb.append(getTabSymb())
.append(getTabSymb())
.append("return ")
.append("java.util.Collections.emptySet()")
.append(";\n");
}
@Override
public String getActualType(Object obj) {
return "java.util.Set";
}
@Override
public boolean isTypeSupported(Class clazz) {
return GenerationUtil.getClassHierarchyStr(clazz).contains("java.util.Collections$EmptySet");
}
}