


![image](https://user-images.githubusercontent.com/4089452/60226937-ee8e7600-98bf-11e9-8d62-76d59976cd3f.png)


![image](https://user-images.githubusercontent.com/4089452/60226950-fd752880-98bf-11e9-90f1-627436f950ca.png)


The application will not find protobuf class, and throw exception.


}
    public static TypeDefinition build(Type type, Class<?> clazz, Map<Class<?>, TypeDefinition> typeCache) {
        TypeBuilder builder = getGenericTypeBuilder(type, clazz);
        TypeDefinition td;
        if (builder != null) {
            td = builder.build(type, clazz, typeCache);
            td.setTypeBuilderName(builder.getClass().getName());
        } else {
            td = DefaultTypeBuilder.build(clazz, typeCache);
            td.setTypeBuilderName(DefaultTypeBuilder.class.getName());
        }
        return td;
    }
    private static TypeBuilder getGenericTypeBuilder(Type type, Class<?> clazz) {
        for (TypeBuilder builder : BUILDERS) {
            if (builder.accept(type, clazz)) {
                return builder;
            }
        }
        return null;
    }
    private Map<Class<?>, TypeDefinition> typeCache = new HashMap<>();
    public TypeDefinition build(Type type, Class<?> clazz) {
        return build(type, clazz, typeCache);
    }
    public List<TypeDefinition> getTypeDefinitions() {
        return new ArrayList<>(typeCache.values());
    }
}