Class: OpenHAB::CoreExt::Java::Class

Inherits:
Object
  • Object
show all
Defined in:
lib/openhab/core_ext/java/class.rb

Overview

Extensions to Class

Instance Method Summary collapse

Instance Method Details

#ancestorsArray<Class>

‘self`, all superclasses and interfaces, recursively.

Returns:



15
16
17
18
19
# File 'lib/openhab/core_ext/java/class.rb', line 15

def ancestors
  ([self] +
    Array(superclass&.ancestors) +
    interfaces.flat_map(&:ancestors)).uniq
end

#generic_ancestorsArray<java.lang.reflect.Type>

‘self`, all superclasses and interfaces, recursively.

Returns:

  • (Array<java.lang.reflect.Type>)


26
27
28
29
30
# File 'lib/openhab/core_ext/java/class.rb', line 26

def generic_ancestors
  ancestors.flat_map do |klass|
    Array(klass.generic_superclass) + klass.generic_interfaces
  end.uniq
end