Question: For example:

```
public void builCarManager(Car car) {
   Manager<car.getClass()> carManager = new Manager<>();
}

```

Some suggestion to solve this?

**EDIT**

My main problem is in this :

```
public class CustomSerializer<T> extends StdSerializer<T> {

    @Override
    public void serialize(T car, JsonGenerator gen, SerializerProvider sp) {
        // I get car.getClass() fine but I need add it
        Manager<T> carManager = new Manager<>();
        // Manager<car.getClass()> carManager = new Manager<>();
    }
}

```

Here I can't pass `CustomSerializer<Lamborgini>.class`. 

```
@JsonSerialize(using = CustomSerializer.class)
private Lamborgini car; 

```

Answer: 
The proper way to handle this is to have two classes (e.g. `Car` and `Desk`) implement a common interface (e.g. `Item`) and associate that interface with the `Manager` class.

```
public class Instance {
    private static interface Item {
        String getName();
    }

    private static class Car implements Item {
        @Override
        public String getName() {
            return "Car";
        }
    }

    private static class Desk implements Item {
        @Override
        public String getName() {
            return "Desk";
        }
    }

    private static class Manager<T extends Item> {
        private T item;

        public Manager(T item) {
            this.item = item;
        }

        @Override
        public String toString() {
            return String.format("Manager[item=%s]", item.getName());
        }
    }

    public static <E extends Item> Manager<E> buildItemManager(E item) {
        return new Manager<E>(item);
     }

    public static void main(String[] args) {
        Item car  = new Car(), desk = new Desk();

        Manager<Item> manager1 = buildItemManager(car);
        System.out.println(manager1);

        Manager<Item> manager2 = buildItemManager(desk);
        System.out.println(manager2);
    }
}

```

Output
------

```
Manager[item=Car]
Manager[item=Desk]

```

---

Another take... instantiating a `Manager` by passing in a class that represents an `Item`.

```
public class Instance {
    public static interface Item {
        String getName();
    }

    public static class Car implements Item {
        @Override
        public String getName() {
            return "Car";
        }
    }

    public static class Desk implements Item {
        @Override
        public String getName() {
            return "Desk";
        }
    }

    public static class Manager<T extends Item> {
        private T item;

        public Manager(T item) {
            this.item = item;
        }

        @Override
        public String toString() {
            return String.format("Manager[item=%s]", item.getName());
        }
    }

    public static <E extends Item> Manager<E> buildItemManager(Class<E> item) throws InstantiationException, IllegalAccessException {
        return new Manager<E>(item.newInstance());
     }

    public static void main(String[] args) {
        try {
            /* Cannot initialize array with generic types... */
            @SuppressWarnings("unchecked")
            Manager<? extends Item>[] managers = new Manager[2];

            managers[0] = buildItemManager(Car.class);
            managers[1] = buildItemManager(Desk.class);

            for (Manager<?> manager : managers) {
                System.out.println(manager);
            }
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}

```
Yes, you can use generics.

```
  public <T> void builCarManager(T car) {
    Manager<T> carManager = new Manager<>();
 }

```

Now you can pass any type of object. The created manager will be of the same type.