typecast (DataMapper::Property)

    # File lib/dm-core/property.rb, line 638
        def typecast(value)
          return type.typecast(value, self) if type.respond_to?(:typecast)
          return value if primitive?(value) || value.nil?

          if    primitive == Integer    then typecast_to_integer(value)
          elsif primitive == String     then typecast_to_string(value)
          elsif primitive == TrueClass  then typecast_to_boolean(value)
          elsif primitive == BigDecimal then typecast_to_bigdecimal(value)
          elsif primitive == Float      then typecast_to_float(value)
          elsif primitive == DateTime   then typecast_to_datetime(value)
          elsif primitive == Time       then typecast_to_time(value)
          elsif primitive == Date       then typecast_to_date(value)
          elsif primitive == Class      then typecast_to_class(value)
          else
            value
          end
        end