Cast the provided value using the properties details.
519928
def cast(parent, value)
      return value unless casted
      if type.is_a?(Array)
        # Convert to array if it is not already
        value = [value].compact unless value.is_a?(Array)
        arr = value.collect { |data| cast_value(parent, data) }
        # allow casted_by calls to be passed up chain by wrapping in CastedArray
        value = type_class != String ? ::CouchRest::CastedArray.new(arr, self) : arr
        value.casted_by = parent if value.respond_to?(:casted_by)
      elsif !value.nil?
        value = cast_value(parent, value)
      end
      value
    end
75899
public static void callSetter(Object obj, String prop, Object value) throws PageException {
	try {
	    getSetter(obj, prop, value).invoke(obj);
	}
	catch (InvocationTargetException e) {
	    Throwable target = e.getTargetException();
	    if (target instanceof PageException) throw (PageException) target;
	    throw Caster.toPageException(e.getTargetException());
	}
	catch (Exception e) {
	    throw Caster.toPageException(e);
	}
    }
240691
def _cast_value(value, _type):
    
    if _type.upper() == 'FLOAT64':
        return float64(value)
    elif _type.upper() == 'FLOAT32':
        return float32(value)
    elif _type.upper() == 'INT32':
        return int32(value)
    elif _type.upper() == 'UINT16':
        return uint16(value)
    elif _type.upper() == 'INT16':
        return int16(value)
    elif _type.upper() == 'BOOLEAN':
        return uint8(value)
    else:
        return float64(value)
1318731
def _cast_to_type(self, value):
        
        if not isinstance(value, dict):
            self.fail('invalid', value=value)
        return value
835089
@Override
	public final void setObjectProperty(String name, Object value) throws JMSException
    {
        if (value == null)
            throw new MessageFormatException("A property value cannot be null");
            
        // Check type
        if (!(value instanceof Boolean ||
              value instanceof Byte ||
              value instanceof Short ||
              value instanceof Integer ||
              value instanceof Long ||
              value instanceof Float ||
              value instanceof Double ||
              value instanceof String))
            throw new MessageFormatException("Unsupported property value type : "+value.getClass().getName());
        
        setProperty(name,value);
    }
1034302
def cast(self, dtype):
        
        for child in self._children.values():
            child.cast(dtype)
        for _, param in self.params.items():
            param.cast(dtype)
984485
@Override
    public void setPropertyValue(PropertyInfo propInfo, Object value) {
        setPropertyValue(propInfo.getId(), value);
    }
1106031
def cast(parent, value)
      return value unless casted
      if array
        if value.nil?
          value = []
        elsif value.is_a?(Hash)
          # Assume provided as a params hash where key is index
          value = parameter_hash_to_array(value)
        elsif !value.is_a?(Array)
          raise "Expecting an array or keyed hash for property #{parent.class.name}##{self.name}"
        end
        arr = value.collect { |data| cast_value(parent, data) }
        arr.reject!{ |data| data.nil? } unless allow_blank
        # allow casted_by calls to be passed up chain by wrapping in CastedArray
        CastedArray.new(arr, self, parent)
      elsif !value.nil?
        cast_value(parent, value)
      end
    end
805866
def _cast(self, value, format=None, **opts):
        """"""
        if format is not None:
            return datetime.strptime(value, format)
        return dateutil.parser.parse(value)
461723
function castPath(value, object) {
        if (isArray(value)) {
            return value;
        }
        return isKey(value, object) ? [value] : stringToPath(toString(value));
    }
1276594
def _write_property(self, val, *args):
        """"""
        val_wid = val
        # 'finally' would be better here, but not supported in 2.4 :(
        try:
            totype = type(self._get_property(*args))
            if (totype is not type(None) and
                   (self._prop_cast or not self._prop_write)):
                val = self._cast_value(val, totype)

            if self._prop_write:
                val = self._prop_write(val)

            self._itsme = True
            self._set_property(val, *args)

        except ValueError:
            self._itsme = False
            if self._value_error:
                self._value_error(self, self._prop_name, val_wid)
            else:
                raise

        except:
            self._itsme = False
            raise

        self._itsme = False
69181
def _cast_to_type(self, value):
        
        if isinstance(value, datetime.datetime):
            return value.date()
        if isinstance(value, datetime.date):
            return value
        try:
            value = date_parser(value)
            return value.date()
        except ValueError:
            self.fail('invalid', value=value)
1360598
function cast(values, name) {
  var value = values && typeof values === 'string' ? [values] : values

  if (!value || typeof value !== 'object' || !('length' in value)) {
    throw new Error(
      'Invalid ' + name + ' `' + value + '`, expected non-empty string'
    )
  }

  return value
}
1072096
@Override
    public void setPropertyValue(PropertyInfo propInfo, Object value) throws Exception {
        String propId = propInfo.getId();
        Object obj = registeredProperties == null ? null : registeredProperties.get(propId);

        if (obj == null) {
            obj = new PropertyProxy(propInfo, value);
            registerProperties(obj, propId);
        } else if (obj instanceof PropertyProxy) {
            ((PropertyProxy) obj).setValue(value);
        } else {
            propInfo.setPropertyValue(obj, value, obj == this);
        }
    }
810565
@SuppressWarnings("unchecked cast")
    public static <F, T> PropertyPattern<F, T> upcast(PropertyPattern<F, ? extends T> propertyPattern)
    {
        return (PropertyPattern<F, T>) propertyPattern;
    }
520490
def cast(value, _interaction)
      case value
      when NilClass
        raise MissingValueError, name unless default?

        nil
      else
        raise InvalidValueError, "#{name}: #{describe(value)}"
      end
    end
176437
def _cast(self, value):
        
        if value.isdigit():
            value = int(value)
        elif re.compile("^\d+\.\d+").match(value):
            value = float(value)
        return value