Class: Gedcomx::Identifier

Inherits:
Object
  • Object
show all
Defined in:
lib/gedcomx/identifier.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input = nil) ⇒ Identifier

Returns a new instance of Identifier.



15
16
17
# File 'lib/gedcomx/identifier.rb', line 15

def initialize(input = nil)
  @identifier = input || self.class.java_class.new
end

Class Method Details

.create(attributes = {}) ⇒ Object



8
9
10
11
12
13
# File 'lib/gedcomx/identifier.rb', line 8

def self.create(attributes = {})
  new_identifier = self.new
  new_identifier.type = attributes[:type] if attributes[:type]
  new_identifier.value = attributes[:value] if attributes[:value]
  new_identifier
end

.java_classObject



4
5
6
# File 'lib/gedcomx/identifier.rb', line 4

def self.java_class
  Java::OrgGedcomxConclusion::Identifier
end

Instance Method Details

#to_javaObject



35
36
37
# File 'lib/gedcomx/identifier.rb', line 35

def to_java
  @identifier
end

#typeObject



19
20
21
# File 'lib/gedcomx/identifier.rb', line 19

def type
  @identifier.get_type.to_s
end

#type=(input_type) ⇒ Object



23
24
25
# File 'lib/gedcomx/identifier.rb', line 23

def type=(input_type)
  @identifier.type = ( input_type.is_a? Gedcomx.java_uri_class ) ? input_type : Gedcomx.new_uri(input_type)
end

#valueObject



27
28
29
# File 'lib/gedcomx/identifier.rb', line 27

def value
  @identifier.get_value.to_s
end

#value=(input_value) ⇒ Object



31
32
33
# File 'lib/gedcomx/identifier.rb', line 31

def value=(input_value)
  @identifier.value = ( input_value.is_a? Gedcomx.java_uri_class ) ? input_value : Gedcomx.new_uri(input_value)
end