KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jruby > runtime > ObjectAllocator


1 /*
2  * ObjectAllocator.java
3  *
4  * Created on January 6, 2007, 1:35 AM
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package org.jruby.runtime;
11
12 import org.jruby.Ruby;
13 import org.jruby.RubyClass;
14 import org.jruby.runtime.builtin.IRubyObject;
15
16 /**
17  *
18  * @author headius
19  */

20 public interface ObjectAllocator {
21     public IRubyObject allocate(Ruby runtime, RubyClass klazz);
22     
23     public static final ObjectAllocator NOT_ALLOCATABLE_ALLOCATOR = new ObjectAllocator() {
24         public IRubyObject allocate(Ruby runtime, RubyClass klass) {
25             throw runtime.newTypeError("Ruby \"" + klass.getName() + "\" object can not be allocated");
26         }
27     };
28 }
29
Popular Tags