Just a small wrapper about the `ActiveRecord::Base#read_attribute` method, which also checks the type
  of the column and converts the value to an `Integer` if `String` is given.
510251
def read_set_attribute(attribute_name)
      value = read_attribute(attribute_name)
      column_type = ((column_definition = self.class.columns_hash[attribute_name.to_s]) and column_definition.type)
      value = value.to_i(10) if column_type == :string
      value
    end
901985
def check_type(value, type_def):
        
        if type_def == 'integer':
            try:
                # We accept string with integer ex: '123'
                int(value)
                return True
            except ValueError:
                return isinstance(value, six.integer_types) and not isinstance(value, bool)
        elif type_def == 'number':
            return isinstance(value, (six.integer_types, float)) and not isinstance(value, bool)
        elif type_def == 'string':
            return isinstance(value, (six.text_type, six.string_types, datetime.datetime))
        elif type_def == 'boolean':
            return (isinstance(value, bool) or
                    (isinstance(value, (six.text_type, six.string_types,)) and
                     value.lower() in ['true', 'false'])
                    )
        else:
            return False
87361
def get_column(column, base = @base)
      base.columns_hash[column.to_s] if base._metasearch_attribute_authorized?(column, self)
    end
416830
def typecast_attribute(typecaster, value)
      raise ArgumentError, "a typecaster must be given" unless typecaster.respond_to?(:call)
      return value if value.nil?
      typecaster.call(value)
    end
1278842
def data_type=(new_val)
      return nil if @data_type == new_val
      raise JSS::InvalidDataError, "data_type must be a string, one of: #{DATA_TYPES.join(', ')}" unless DATA_TYPES.include? new_val
      @data_type = new_val
      @need_to_update = true
    end
350191
def valid_meta_data_type?(value)
      value.nil? || value.is_a?(String) || value.is_a?(Numeric) || value.is_a?(FalseClass) || value.is_a?(TrueClass)
    end
428805
def attribute_will_change!(attr)
      unless changed_attributes.key?(attr)
        changed_attributes[attr] = read_raw_attribute(attr).__deep_copy__
      end
    end
581712
def []=(attr, value)
      raise "argument to [] must be a Symbol or a String." unless attr.is_a?(Symbol) or attr.is_a?(String)
      @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?
      @attributes[attr] = value.to_s
    end
1345589
def format_cell_value_as_type(value, attribute)
      if value.is_a?(Time) or value.is_a?(Date)
        return ::I18n.l(value, :format => @options[:format] || TableBuilder.i18n_default_format_date)
      elsif TableBuilder.currency_columns.include?(attribute)
        return number_to_currency(value)
      elsif value.is_a?(TrueClass)
        return TableBuilder.default_boolean.first
      elsif value.is_a?(FalseClass)
        return TableBuilder.default_boolean.second
      end
      value
    end
935184
public Class<?> attrType(String attr) {
		Table table = this.table();
		if (null != table) {
			return table.getColumnType(attr);
		}
		
		Method[] methods = this._getUsefulClass().getMethods();
		String methodName;
		for (Method method : methods) {
			methodName = method.getName();
			if (methodName.startsWith("set") && methodName.substring(3).toLowerCase().equals(attr)) {
				return method.getParameterTypes()[0];
			}
		}
		return null;
	}
1088403
def get_attribute_value(self, name, index):
        
        if index == MISSING:
            return
        elif self.attribute_types[name] in NUMERIC_TYPES:
            at = self.attribute_types[name]
            if at == TYPE_INTEGER:
                return int(index)
            return Decimal(str(index))
        else:
            assert self.attribute_types[name] == TYPE_NOMINAL
            cls_index, cls_value = index.split(':')
            #return self.attribute_data[name][index-1]
            if cls_value != MISSING:
                assert cls_value in self.attribute_data[name], \
                    'Predicted value "%s" but only values %s are allowed.' \
                        % (cls_value, ', '.join(self.attribute_data[name]))
            return cls_value
415887
def read_only(self, value):
        

        if value is not None:
            assert type(value) is bool, "'{0}' attribute: '{1}' type is not 'bool'!".format("read_only", value)
        self.__read_only = value
538183
def where_values(attribute, type = :integer)
      return @where_values[attribute] if @where_values.key?(attribute)
      @where_values[attribute] ||= array_of_values(@wheres[attribute], type)
    end
1238500
def getAttribute(self, attr: str) -> _AttrValueType:
        
        if attr == 'class':
            if self.classList:
                return self.classList.toString()
            return None
        attr_node = self.getAttributeNode(attr)
        if attr_node is None:
            return None
        return attr_node.value
763973
def _extract_attr_typed_value(txn_data):
    
    existing_keys = [key for key in ALL_ATR_KEYS if key in txn_data]
    if len(existing_keys) == 0:
        raise ValueError("ATTR should have one of the following fields: {}"
                         .format(ALL_ATR_KEYS))
    if len(existing_keys) > 1:
        raise ValueError("ATTR should have only one of the following fields: {}"
                         .format(ALL_ATR_KEYS))
    existing_key = existing_keys[0]
    return existing_key, txn_data[existing_key]
237926
def [](attr)
      return nil unless instance_variable_defined?(:@attributes) and @attributes.is_a?(Hash)
      @attributes[attr] or (attr.is_a?(String) ? @attributes[attr.to_sym] : @attributes[attr.to_s])
    end
387992
def Decode(self, attribute, value):
    """"""
    required_type = self._attribute_types.get(attribute, "bytes")
    if required_type == "integer":
      return rdf_structs.SignedVarintReader(value, 0)[0]
    elif required_type == "unsigned_integer":
      return rdf_structs.VarintReader(value, 0)[0]
    elif required_type == "string":
      if isinstance(value, bytes):
        return value.decode("utf-8")
      else:
        return utils.SmartUnicode(value)
    else:
      return value