public static Type createInstance(String name, DateOnly from, DateOnly to)
    {
        // Ensure that min is less than or equal to max.
        if ((from != null) && (to != null) && (from.compareTo(to) > 0))
        {
            throw new IllegalArgumentException("'min' must be less than or equal to 'max'.");
        }

        synchronized (DATE_RANGE_TYPES)
        {
            // Add the newly created type to the map of all types.
            DateRangeType newType = new DateRangeType(name, from, to);

            // Ensure that the named type does not already exist, unless it has an identical definition already, in which
            // case the old definition can be re-used and the new one discarded.
            DateRangeType oldType = DATE_RANGE_TYPES.get(name);

            if ((oldType != null) && !oldType.equals(newType))
            {
                throw new IllegalArgumentException("The type '" + name + "' already exists and cannot be redefined.");
            }
            else if ((oldType != null) && oldType.equals(newType))
            {
                return oldType;
            }
            else
            {
                DATE_RANGE_TYPES.put(name, newType);

                return newType;
            }
        }
    }
public static Type createInstance(String name, DateOnly from, DateOnly to)
    {
        
        if ((from != null) && (to != null) && (from.compareTo(to) > 0))
        {
            throw new IllegalArgumentException("'min' must be less than or equal to 'max'.");
        }

        synchronized (DATE_RANGE_TYPES)
        {
            
            DateRangeType newType = new DateRangeType(name, from, to);

            
            
            DateRangeType oldType = DATE_RANGE_TYPES.get(name);

            if ((oldType != null) && !oldType.equals(newType))
            {
                throw new IllegalArgumentException("The type '" + name + "' already exists and cannot be redefined.");
            }
            else if ((oldType != null) && oldType.equals(newType))
            {
                return oldType;
            }
            else
            {
                DATE_RANGE_TYPES.put(name, newType);

                return newType;
            }
        }
    }
public static Type createInstance ( String name , DateOnly from , DateOnly to ) { // Ensure that min is less than or equal to max. if ( ( from != null ) && ( to != null ) && ( from . compareTo ( to ) > 0 ) ) { throw new IllegalArgumentException ( "'min' must be less than or equal to 'max'." ) ; } synchronized ( DATE_RANGE_TYPES ) { // Add the newly created type to the map of all types. DateRangeType newType = new DateRangeType ( name , from , to ) ; // Ensure that the named type does not already exist, unless it has an identical definition already, in which // case the old definition can be re-used and the new one discarded. DateRangeType oldType = DATE_RANGE_TYPES . get ( name ) ; if ( ( oldType != null ) && ! oldType . equals ( newType ) ) { throw new IllegalArgumentException ( "The type '" + name + "' already exists and cannot be redefined." ) ; } else if ( ( oldType != null ) && oldType . equals ( newType ) ) { return oldType ; } else { DATE_RANGE_TYPES . put ( name , newType ) ; return newType ; } } }
Creates a new date range type with the specified name, if it does not already exist.

@param  name The name of the date range type to create.
@param  from The minimum value that an instance of the type can take.
@param  to   The maximum value that an instance of teh type can take.

@return A new date range type.

@throws IllegalArgumentException If min is not less than or equal to max, or the named type already exists.
Creates a new date range type with the specified name if it does not already exist .