@SuppressWarnings( "unchecked" ) public static <T> T newInstanceFromReflectionFactory( final Class<T> type ) { Constructor<?> constructor = _constructors.get( type ); if ( constructor == null ) { constructor = newConstructorForSerialization( type ); _constructors.put( type, constructor ); } return (T) newInstanceFrom( constructor ); }
@SuppressWarnings( "unchecked" ) public static <T> T newInstanceFromReflectionFactory( final Class<T> type ) { Constructor<?> constructor = _constructors.get( type ); if ( constructor == null ) { constructor = newConstructorForSerialization( type ); _constructors.put( type, constructor ); } return (T) newInstanceFrom( constructor ); }
/** * {@inheritDoc} */ @Override @SuppressWarnings( "unchecked" ) public <T> T newInstance( final Class<T> type ) { if (type == null) { throw new IllegalArgumentException("type cannot be null."); } Constructor<?> constructor = _constructors.get( type ); if ( constructor == null ) { constructor = getNoArgsConstructor( type ); if ( constructor == null ) { constructor = newConstructorForSerialization( type ); } _constructors.put( type, constructor ); } return (T) newInstanceFrom( constructor ); }
/** * {@inheritDoc} */ @Override @SuppressWarnings( "unchecked" ) public <T> T newInstance( final Class<T> type ) { if (type == null) { throw new IllegalArgumentException("type cannot be null."); } Constructor<?> constructor = _constructors.get( type ); if ( constructor == null ) { constructor = getNoArgsConstructor( type ); if ( constructor == null ) { constructor = newConstructorForSerialization( type ); } _constructors.put( type, constructor ); } return (T) newInstanceFrom( constructor ); }