private static <T> T overrideOf(Class<T> clazz, Class<?> targetType, Annotation annotation) {
        try {
            if (annotation != null) {
                try {
                    return clazz.getConstructor(Class.class, annotation.annotationType()).newInstance(targetType, annotation);
                } catch (final NoSuchMethodException no) {}
            }
            try {
                return clazz.getConstructor(Class.class).newInstance(targetType);
            } catch (final NoSuchMethodException no) {}
            return clazz.newInstance();
        } catch (final Exception e) {
            throw new DynamoDBMappingException("could not instantiate " + clazz, e);
        }
    }
private static < T > T overrideOf ( Class < T > clazz , Class < ? > targetType , Annotation annotation ) { try { if ( annotation != null ) { try { return clazz . getConstructor ( Class . class , annotation . annotationType ( ) ) . newInstance ( targetType , annotation ) ; } catch ( final NoSuchMethodException no ) { } } try { return clazz . getConstructor ( Class . class ) . newInstance ( targetType ) ; } catch ( final NoSuchMethodException no ) { } return clazz . newInstance ( ) ; } catch ( final Exception e ) { throw new DynamoDBMappingException ( "could not instantiate " + clazz , e ) ; } }
Creates a new instance of the clazz with the target type and annotation
as parameters if available.