All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.tankist88.object2source.extension.collections.EmptySetExtension Maven / Gradle / Ivy

Go to download

A library for generating the source code that creates an instance of the object that is submitted to the input.

There is a newer version: 0.0.10
Show newest version
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");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy