public static <T extends Planet> Planet create(int id, Class<T> type) {

        PropertyManager pm = new PropertyManager("config.properties");
        Random rnd = new Random();
        double planetMass = pm.getDoubleProperty("min.Planet.Mass") + (pm.getDoubleProperty("max.Planet.Mass") - pm.getDoubleProperty("min.Planet.Mass")) * rnd.nextDouble();

        if (type.getName().contains("InhabitedPlanet")) {
            return new Planet.Builder()
                    .id(id)
                    .name(NameGenerator.generate())
                    .mass(planetMass)
                    .population(rnd.nextInt(pm.getIntProperty("max.Planet.Population")))
                    .hasAtmosphere(rnd.nextBoolean())
                    .buildInhabitedPlanet();
        }
        if (type.getName().contains("UninhabitedPlanet")) {
            return new Planet.Builder()
                    .id(id)
                    .name(NameGenerator.generate())
                    .mass(planetMass)
                    .hasAtmosphere(rnd.nextBoolean())
                    .mineralResources(Arrays.asList(MineralResource.values()[rnd.nextInt(MineralResource.values().length)]))
                    .buildUnInhabitedPlanet();
        }

        return new UninhabitedPlanet();
    }