src/main/java/com/cedarsoftware/util/io/MetaUtils.java
static Object[] fillArgs(Class[] argTypes, boolean useNull)
    {
        final Object[] values = new Object[argTypes.length];
        for (int i = 0; i < argTypes.length; i++)
        {
            final Class argType = argTypes[i];
            if (isPrimitive(argType))
            {
                values[i] = convert(argType, null);
            }
            else if (useNull)
            {
                values[i] = null;
            }
            else
            {
                if (argType == String.class)
                {
                    values[i] = "";
                }
                else if (argType == Date.class)
                {
                    values[i] = new Date();
                }
                else if (List.class.isAssignableFrom(argType))
                {
                    values[i] = new ArrayList();
                }
                else if (SortedSet.class.isAssignableFrom(argType))
                {
                    values[i] = new TreeSet();
                }
                else if (Set.class.isAssignableFrom(argType))
                {
                    values[i] = new LinkedHashSet();
                }
                else if (SortedMap.class.isAssignableFrom(argType))
                {
                    values[i] = new TreeMap();
                }
                else if (Map.class.isAssignableFrom(argType))
                {
                    values[i] = new LinkedHashMap();
                }
                else if (Collection.class.isAssignableFrom(argType))
                {
                    values[i] = new ArrayList();
                }
                else if (Calendar.class.isAssignableFrom(argType))
                {
                    values[i] = Calendar.getInstance();
                }
                else if (TimeZone.class.isAssignableFrom(argType))
                {
                    values[i] = TimeZone.getDefault();
                }
                else if (argType == BigInteger.class)
                {
                    values[i] = BigInteger.TEN;
                }
                else if (argType == BigDecimal.class)
                {
                    values[i] = BigDecimal.TEN;
                }
                else if (argType == StringBuilder.class)
                {
                    values[i] = new StringBuilder();
                }
                else if (argType == StringBuffer.class)
                {
                    values[i] = new StringBuffer();
                }
                else if (argType == Locale.class)
                {
                    values[i] = Locale.FRANCE;  // overwritten
                }
                else if (argType == Class.class)
                {
                    values[i] = String.class;
                }
                else if (argType == Timestamp.class)
                {
                    values[i] = new Timestamp(System.currentTimeMillis());
                }
                else if (argType == java.sql.Date.class)
                {
                    values[i] = new java.sql.Date(System.currentTimeMillis());
                }
                else if (argType == URL.class)
                {
                    try
                    {
                        values[i] = new URL("http://localhost"); // overwritten
                    }
                    catch (MalformedURLException e)
                    {
                        values[i] = null;
                    }
                }
                else if (argType == Object.class)
                {
                    values[i] = new Object();
                }
                else
                {
                    values[i] = null;
                }
            }
        }

        return values;
    }
static Object[] fillArgs(Class[] argTypes, boolean useNull)
    {
        final Object[] values = new Object[argTypes.length];
        for (int i = 0; i < argTypes.length; i++)
        {
            final Class argType = argTypes[i];
            if (isPrimitive(argType))
            {
                values[i] = convert(argType, null);
            }
            else if (useNull)
            {
                values[i] = null;
            }
            else
            {
                if (argType == String.class)
                {
                    values[i] = "";
                }
                else if (argType == Date.class)
                {
                    values[i] = new Date();
                }
                else if (List.class.isAssignableFrom(argType))
                {
                    values[i] = new ArrayList();
                }
                else if (SortedSet.class.isAssignableFrom(argType))
                {
                    values[i] = new TreeSet();
                }
                else if (Set.class.isAssignableFrom(argType))
                {
                    values[i] = new LinkedHashSet();
                }
                else if (SortedMap.class.isAssignableFrom(argType))
                {
                    values[i] = new TreeMap();
                }
                else if (Map.class.isAssignableFrom(argType))
                {
                    values[i] = new LinkedHashMap();
                }
                else if (Collection.class.isAssignableFrom(argType))
                {
                    values[i] = new ArrayList();
                }
                else if (Calendar.class.isAssignableFrom(argType))
                {
                    values[i] = Calendar.getInstance();
                }
                else if (TimeZone.class.isAssignableFrom(argType))
                {
                    values[i] = TimeZone.getDefault();
                }
                else if (argType == BigInteger.class)
                {
                    values[i] = BigInteger.TEN;
                }
                else if (argType == BigDecimal.class)
                {
                    values[i] = BigDecimal.TEN;
                }
                else if (argType == StringBuilder.class)
                {
                    values[i] = new StringBuilder();
                }
                else if (argType == StringBuffer.class)
                {
                    values[i] = new StringBuffer();
                }
                else if (argType == Locale.class)
                {
                    values[i] = Locale.FRANCE;  // overwritten
                }
                else if (argType == Class.class)
                {
                    values[i] = String.class;
                }
                else if (argType == Timestamp.class)
                {
                    values[i] = new Timestamp(System.currentTimeMillis());
                }
                else if (argType == java.sql.Date.class)
                {
                    values[i] = new java.sql.Date(System.currentTimeMillis());
                }
                else if (argType == URL.class)
                {
                    try
                    {
                        values[i] = new URL("http://localhost"); // overwritten
                    }
                    catch (MalformedURLException e)
                    {
                        values[i] = null;
                    }
                }
                else if (argType == Object.class)
                {
                    values[i] = new Object();
                }
                else
                {
                    values[i] = null;
                }
            }
        }

        return values;
    }
static Object [ ] fillArgs ( Class [ ] argTypes , boolean useNull ) { final Object [ ] values = new Object [ argTypes . length ] ; for ( int i = 0 ; i < argTypes . length ; i ++ ) { final Class argType = argTypes [ i ] ; if ( isPrimitive ( argType ) ) { values [ i ] = convert ( argType , null ) ; } else if ( useNull ) { values [ i ] = null ; } else { if ( argType == String . class ) { values [ i ] = "" ; } else if ( argType == Date . class ) { values [ i ] = new Date ( ) ; } else if ( List . class . isAssignableFrom ( argType ) ) { values [ i ] = new ArrayList ( ) ; } else if ( SortedSet . class . isAssignableFrom ( argType ) ) { values [ i ] = new TreeSet ( ) ; } else if ( Set . class . isAssignableFrom ( argType ) ) { values [ i ] = new LinkedHashSet ( ) ; } else if ( SortedMap . class . isAssignableFrom ( argType ) ) { values [ i ] = new TreeMap ( ) ; } else if ( Map . class . isAssignableFrom ( argType ) ) { values [ i ] = new LinkedHashMap ( ) ; } else if ( Collection . class . isAssignableFrom ( argType ) ) { values [ i ] = new ArrayList ( ) ; } else if ( Calendar . class . isAssignableFrom ( argType ) ) { values [ i ] = Calendar . getInstance ( ) ; } else if ( TimeZone . class . isAssignableFrom ( argType ) ) { values [ i ] = TimeZone . getDefault ( ) ; } else if ( argType == BigInteger . class ) { values [ i ] = BigInteger . TEN ; } else if ( argType == BigDecimal . class ) { values [ i ] = BigDecimal . TEN ; } else if ( argType == StringBuilder . class ) { values [ i ] = new StringBuilder ( ) ; } else if ( argType == StringBuffer . class ) { values [ i ] = new StringBuffer ( ) ; } else if ( argType == Locale . class ) { values [ i ] = Locale . FRANCE ; // overwritten } else if ( argType == Class . class ) { values [ i ] = String . class ; } else if ( argType == Timestamp . class ) { values [ i ] = new Timestamp ( System . currentTimeMillis ( ) ) ; } else if ( argType == java . sql . Date . class ) { values [ i ] = new java . sql . Date ( System . currentTimeMillis ( ) ) ; } else if ( argType == URL . class ) { try { values [ i ] = new URL ( "http://localhost" ) ; // overwritten } catch ( MalformedURLException e ) { values [ i ] = null ; } } else if ( argType == Object . class ) { values [ i ] = new Object ( ) ; } else { values [ i ] = null ; } } } return values ; }
Return an Object[] of instance values that can be passed into a given Constructor.  This method
will return an array of nulls if useNull is true, otherwise it will return sensible values for
primitive classes, and null for non-known primitive / primitive wrappers.  This class is used
when attempting to call constructors on Java objects to get them instantiated, since there is no
'malloc' in Java.
Return an Object [] of instance values that can be passed into a given Constructor . This method will return an array of nulls if useNull is true otherwise it will return sensible values for primitive classes and null for non - known primitive / primitive wrappers . This class is used when attempting to call constructors on Java objects to get them instantiated since there is no malloc in Java .