public ObjectInstantiator newInstantiatorOf()

in lightning-core/src/main/java/org/apache/directmemory/lightning/internal/instantiator/strategy/StdInstantiatorStrategy.java [52:92]


    public ObjectInstantiator newInstantiatorOf( Class<?> type )
    {

        if ( JVM_NAME.startsWith( SUN ) )
        {
            if ( VM_VERSION.startsWith( "1.3" ) )
            {
                return new Sun13Instantiator( type );
            }
            else if ( InternalUtil.isUnsafeAvailable() )
            {
                return InternalUtil.buildSunUnsafeInstantiator( type );
            }
        }
        else if ( JVM_NAME.startsWith( ORACLE_JROCKIT ) )
        {
            if ( !VENDOR_VERSION.startsWith( "R" ) )
            {
                // Beginning with R25.1 sun.misc.Unsafe should work.
                if ( InternalUtil.isUnsafeAvailable() )
                {
                    return InternalUtil.buildSunUnsafeInstantiator( type );
                }
            }
        }
        else if ( JVM_NAME.startsWith( GNU ) )
        {
            return new GCJInstantiator( type );
        }
        else if ( JVM_NAME.startsWith( PERC ) )
        {
            return new PercInstantiator( type );
        }

        // Fallback instantiator, should work with:
        // - Java Hotspot version 1.4 and higher
        // - JRockit 1.4-R26 and higher
        // - IBM and Hitachi JVMs
        // ... might works for others so we just give it a try
        return new SunReflectionFactoryInstantiator( type );
    }