Class: Guff::JavaSource::Field
- Inherits:
-
Object
- Object
- Guff::JavaSource::Field
- Includes:
- AnnotationSupport, ClassMember, JavadocSupport, ModifierSupport, Named, ScopeSupport
- Defined in:
- lib/guff/java_source.rb
Instance Method Summary collapse
- #declared_type ⇒ Object
- #initial(i) ⇒ Object
-
#initialize(owning_class, name, type) ⇒ Field
constructor
A new instance of Field.
- #write_to(writer) ⇒ Object
Methods included from ScopeSupport
#package_local, #private, #protected, #public
Methods included from ModifierSupport
#abstract, #final, #modifiers, #static
Methods included from AnnotationSupport
#add_annotation, #annotations, #write_annotations_to
Methods included from JavadocSupport
#add_javadoc, #javadoc_lines, #write_javadoc_to
Methods included from ClassMember
Methods included from Named
Constructor Details
#initialize(owning_class, name, type) ⇒ Field
Returns a new instance of Field.
419 420 421 422 423 424 425 |
# File 'lib/guff/java_source.rb', line 419 def initialize(owning_class,name, type) @owning_class=owning_class @name = name @type = type @scope = 'private' @initializer = '' end |
Instance Method Details
#declared_type ⇒ Object
438 439 440 |
# File 'lib/guff/java_source.rb', line 438 def declared_type @type end |
#initial(i) ⇒ Object
433 434 435 436 |
# File 'lib/guff/java_source.rb', line 433 def initial(i) @initializer = "= #{i}" self end |
#write_to(writer) ⇒ Object
427 428 429 430 431 |
# File 'lib/guff/java_source.rb', line 427 def write_to(writer) write_javadoc_to(writer) write_annotations_to(writer) writer.word(@scope).words(modifiers).word(@type).word(@name).word(@initializer).semi_colon.new_line end |