Using Java enum constants in JRuby

| | Comments (3) | TrackBacks (0)
public class Song {
public enum Category {
POP, ROCK, CLASSIC, JAZZ
}

위와 같이 Java enum constants들이 정의되어있다면, JRuby에서 이들을 사용하는 방법은 다음과 같다.

require 'java'
include_class 'Song'

puts Song::Category::POP

0 TrackBacks

Listed below are links to blogs that reference this entry: Using Java enum constants in JRuby.

TrackBack URL for this entry: http://lastmind.net/mt/mt-tb.cgi/359

enum 은 보통 전부 대문자로 쓰는데 루비는 어떤지 모르겠네요

루비는 대문자로 쓰는게 문법에 해당하죠.

이희승/대문자로 수정했습니다.

Leave a comment

About this Entry

This page contains a single entry by Joseph Jang published on February 12, 2007 7:56 PM.

Support for epoll in JDK 5.0 Update 10 was the previous entry in this blog.

Calling a Java method with variable number of arguments in JRuby is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.21-en