package org.simantics.g3d.property; import java.util.Collections; import java.util.List; import org.simantics.g3d.property.annotations.PropertyContributor; public class PropertyTabUtil { @SuppressWarnings("unchecked") public static List getContributors(Object input) { PropertyTabContributorFactory factory = resolveFactory(input.getClass()); if (factory == null) return Collections.EMPTY_LIST; return factory.getContributors(input); } private static PropertyTabContributorFactory resolveFactory(Class clazz) { PropertyContributor contributor = clazz.getAnnotation(PropertyContributor.class); if (contributor != null) try { return contributor.value().newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } Class superClass = clazz.getSuperclass(); if (superClass != null) return resolveFactory(superClass); return null; } }