public static PolymorphicSchema.Factory getFactoryFromField(
            final java.lang.reflect.Field f, final IdStrategy strategy)
    {
        final Class<?> clazz = f.getType();
        
        if (clazz.isArray())
            return ARRAY;

        if (Number.class == clazz)
            return NUMBER;

        if (Class.class == clazz)
            return CLASS;

        if (Enum.class == clazz)
            return ENUM;
        
        if (Throwable.class.isAssignableFrom(clazz))
            return THROWABLE;
        
        if (Map.class.isAssignableFrom(clazz))
        {
            return 0 != (IdStrategy.POJO_SCHEMA_ON_MAP_FIELDS & strategy.flags) ? 
                    POJO_MAP : MAP;
        }

        if (Collection.class.isAssignableFrom(clazz))
        {
            return 0 != (IdStrategy.POJO_SCHEMA_ON_COLLECTION_FIELDS & strategy.flags) ? 
                    POJO_COLLECTION : COLLECTION;
        }

        return OBJECT;
    }
Polymorphic types.

@author David Yu
@created Apr 30, 2012
protostuff-runtime/src/main/java/io/protostuff/runtime/PolymorphicSchemaFactories.java