ObjectAllocator.java

  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. package org.jruby.runtime;

  10. import org.jruby.Ruby;
  11. import org.jruby.RubyClass;
  12. import org.jruby.runtime.builtin.IRubyObject;

  13. /**
  14.  *
  15.  * @author headius
  16.  */
  17. public interface ObjectAllocator {
  18.     public IRubyObject allocate(Ruby runtime, RubyClass klazz);
  19.    
  20.     public static final ObjectAllocator NOT_ALLOCATABLE_ALLOCATOR = new ObjectAllocator() {
  21.         public IRubyObject allocate(Ruby runtime, RubyClass klass) {
  22.             throw runtime.newTypeError("allocator undefined for " + klass.getName());
  23.         }
  24.     };
  25. }