Class: RGen::MetamodelBuilder::Intermediate::Attribute
- Defined in:
- lib/rgen/metamodel_builder/intermediate/feature.rb
Constant Summary collapse
- Properties =
{ :name => :required, :ordered => :required, :unique => :required, :changeable => :required, :volatile => :required, :transient => :required, :unsettable => :required, :derived => :required, :lowerBound => :required, :upperBound => :required, :defaultValueLiteral => :optional }
- Defaults =
{ :ordered => true, :unique => true, :changeable => true, :volatile => false, :transient => false, :unsettable => false, :derived => false, :lowerBound => 0 }
- Types =
{ String => :EString, Integer => :EInt, RGen::MetamodelBuilder::DataTypes::Long => :ELong, Float => :EFloat, RGen::MetamodelBuilder::DataTypes::Boolean => :EBoolean, Object => :ERubyObject, Class => :ERubyClass }
Instance Attribute Summary
Attributes inherited from Feature
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, props) ⇒ Attribute
constructor
A new instance of Attribute.
Methods inherited from Feature
#annotations, #many?, #reference?, #value
Constructor Details
#initialize(type, props) ⇒ Attribute
Returns a new instance of Attribute.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/rgen/metamodel_builder/intermediate/feature.rb', line 85 def initialize(type, props) @props = Defaults.merge(props) type ||= String @etype = Types[type] if @etype @impl_type = type elsif type.is_a?(RGen::MetamodelBuilder::DataTypes::Enum) @etype = :EEnumerable @impl_type = type else raise ArgumentError.new("invalid type '#{type}'") end if @props[:derived] @props[:changeable] = false @props[:volatile] = true @props[:transient] = true end check(Properties) end |
Class Method Details
.default_value(prop) ⇒ Object
77 78 79 |
# File 'lib/rgen/metamodel_builder/intermediate/feature.rb', line 77 def self.default_value(prop) Defaults[prop] end |
.properties ⇒ Object
81 82 83 |
# File 'lib/rgen/metamodel_builder/intermediate/feature.rb', line 81 def self.properties Properties.keys.sort{|a,b| a.to_s <=> b.to_s} end |