Class: ElasticGraph::JSONIngestion::SchemaDefinition::Indexing::FieldReference Private

Inherits:
SchemaDefinition::Indexing::FieldReference show all
Defined in:
elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wraps an indexing field reference with JSON schema state needed when resolving fields.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field_reference, json_schema_layers:, json_schema_customizations:, doc_comment:) ⇒ FieldReference

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FieldReference.

Parameters:

  • field_reference (ElasticGraph::SchemaDefinition::Indexing::FieldReference)

    the field reference to wrap

  • json_schema_layers (Array<Symbol>)

    JSON schema wrapper layers from the field type reference

  • json_schema_customizations (Hash<Symbol, Object>)

    user-defined JSON schema customizations

  • doc_comment (String, nil)

    documentation for the referenced field



35
36
37
38
39
40
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb', line 35

def initialize(field_reference, json_schema_layers:, json_schema_customizations:, doc_comment:)
  super(field_reference)
  @json_schema_layers = json_schema_layers
  @json_schema_customizations = json_schema_customizations
  @doc_comment = doc_comment
end

Instance Attribute Details

#doc_commentString? (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns documentation for the referenced field.

Returns:

  • (String, nil)

    documentation for the referenced field



29
30
31
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb', line 29

def doc_comment
  @doc_comment
end

#json_schema_customizationsHash<Symbol, Object> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns user-defined JSON schema customizations.

Returns:

  • (Hash<Symbol, Object>)

    user-defined JSON schema customizations



26
27
28
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb', line 26

def json_schema_customizations
  @json_schema_customizations
end

#json_schema_layersArray<Symbol> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns JSON schema wrapper layers from the field type reference.

Returns:

  • (Array<Symbol>)

    JSON schema wrapper layers from the field type reference



23
24
25
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb', line 23

def json_schema_layers
  @json_schema_layers
end

Instance Method Details

#==(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Compares field references, including JSON schema metadata tracked by this wrapper.

Parameters:

  • other (Object)

    the object to compare against

Returns:

  • (Boolean)

    true when the field reference and JSON schema metadata match



60
61
62
63
64
65
66
67
68
69
70
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb', line 60

def ==(other)
  case other
  when FieldReference
    __getobj__ == other.__getobj__ &&
      json_schema_layers == other.json_schema_layers &&
      json_schema_customizations == other.json_schema_customizations &&
      doc_comment == other.doc_comment
  else
    super
  end
end

#eql?(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


72
73
74
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb', line 72

def eql?(other)
  self == other
end

#hashInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a hash code based on the wrapped field reference and JSON schema metadata.

Returns:

  • (Integer)

    the hash code



79
80
81
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb', line 79

def hash
  [__getobj__, json_schema_layers, json_schema_customizations, doc_comment].hash
end

#resolveField?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Resolves this reference to a JSON-schema-aware indexing field.

Returns:

  • (Field, nil)

    the resolved field, or nil when the type is unresolved



45
46
47
48
49
50
51
52
53
54
# File 'elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion/schema_definition/indexing/field_reference.rb', line 45

def resolve
  return nil unless (resolved_field = super)

  Field.new(
    resolved_field,
    json_schema_layers: json_schema_layers,
    json_schema_customizations: json_schema_customizations,
    doc_comment: doc_comment
  )
end