class OCI::DataIntegration::Models::NativeShapeField

The native shape field object.

Attributes

config_values[RW]

@return [OCI::DataIntegration::Models::ConfigValues]

default_value_string[RW]

The default value. @return [String]

is_mandatory[RW]

Specifies whether the field is mandatory. @return [BOOLEAN]

model_type[RW]

The model type reference. @return [String]

name[RW]

Free form text without any restriction on permitted characters. Name can have letters, numbers, and special characters. The value is editable and is restricted to 1000 characters. @return [String]

position[RW]

The position of the attribute. @return [Integer]

type[RW]

The type reference. @return [Object]

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/oci/data_integration/models/native_shape_field.rb, line 38
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'model_type': :'modelType',
    'type': :'type',
    'config_values': :'configValues',
    'position': :'position',
    'default_value_string': :'defaultValueString',
    'is_mandatory': :'isMandatory'
    # rubocop:enable Style/SymbolLiteral
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :name The value to assign to the {#name} property @option attributes [String] :model_type The value to assign to the {#model_type} property @option attributes [Object] :type The value to assign to the {#type} property @option attributes [OCI::DataIntegration::Models::ConfigValues] :config_values The value to assign to the {#config_values} property @option attributes [Integer] :position The value to assign to the {#position} property @option attributes [String] :default_value_string The value to assign to the {#default_value_string} property @option attributes [BOOLEAN] :is_mandatory The value to assign to the {#is_mandatory} property

# File lib/oci/data_integration/models/native_shape_field.rb, line 80
def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.name = attributes[:'name'] if attributes[:'name']

  self.model_type = attributes[:'modelType'] if attributes[:'modelType']

  raise 'You cannot provide both :modelType and :model_type' if attributes.key?(:'modelType') && attributes.key?(:'model_type')

  self.model_type = attributes[:'model_type'] if attributes[:'model_type']

  self.type = attributes[:'type'] if attributes[:'type']

  self.config_values = attributes[:'configValues'] if attributes[:'configValues']

  raise 'You cannot provide both :configValues and :config_values' if attributes.key?(:'configValues') && attributes.key?(:'config_values')

  self.config_values = attributes[:'config_values'] if attributes[:'config_values']

  self.position = attributes[:'position'] if attributes[:'position']

  self.default_value_string = attributes[:'defaultValueString'] if attributes[:'defaultValueString']

  raise 'You cannot provide both :defaultValueString and :default_value_string' if attributes.key?(:'defaultValueString') && attributes.key?(:'default_value_string')

  self.default_value_string = attributes[:'default_value_string'] if attributes[:'default_value_string']

  self.is_mandatory = attributes[:'isMandatory'] unless attributes[:'isMandatory'].nil?

  raise 'You cannot provide both :isMandatory and :is_mandatory' if attributes.key?(:'isMandatory') && attributes.key?(:'is_mandatory')

  self.is_mandatory = attributes[:'is_mandatory'] unless attributes[:'is_mandatory'].nil?
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/oci/data_integration/models/native_shape_field.rb, line 53
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'model_type': :'String',
    'type': :'Object',
    'config_values': :'OCI::DataIntegration::Models::ConfigValues',
    'position': :'Integer',
    'default_value_string': :'String',
    'is_mandatory': :'BOOLEAN'
    # rubocop:enable Style/SymbolLiteral
  }
end

Public Instance Methods

==(other) click to toggle source

Checks equality by comparing each attribute. @param [Object] other the other object to be compared

# File lib/oci/data_integration/models/native_shape_field.rb, line 124
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    name == other.name &&
    model_type == other.model_type &&
    type == other.type &&
    config_values == other.config_values &&
    position == other.position &&
    default_value_string == other.default_value_string &&
    is_mandatory == other.is_mandatory
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/oci/data_integration/models/native_shape_field.rb, line 160
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
eql?(other) click to toggle source

@see the `==` method @param [Object] other the other object to be compared

# File lib/oci/data_integration/models/native_shape_field.rb, line 140
def eql?(other)
  self == other
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/oci/data_integration/models/native_shape_field.rb, line 149
def hash
  [name, model_type, type, config_values, position, default_value_string, is_mandatory].hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/oci/data_integration/models/native_shape_field.rb, line 193
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/oci/data_integration/models/native_shape_field.rb, line 187
def to_s
  to_hash.to_s
end

Private Instance Methods

_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/oci/data_integration/models/native_shape_field.rb, line 210
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end