Extending PyDictionary in java

View: New views
1 Messages — Rating Filter:   Alert me  

Extending PyDictionary in java

by pzack :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hey All,

In Jython 2.2.1, I could exent PyDictionary.java and supply my own Hashtable for the data representation,

doing something like this:

public class MyDictionary extends PyDictionary {
   final static private PyType dictType = new PyDictionary().getType();



   public MyDictionary () {
      super( dictType );// MyDictionary is actually a 'dict'
      super.table = makeCustomHashTable();
   }

   private Hashtable makeCustomHashTable( ) {
      // make a special Hashtable
   }
  
   // add model specific methods to manipulate the
   // hashtable that are only exposed in the Java API
   // (In Jython this class will look exactly like dict.
}

I noticed in Jython2.5 that the table field was made final, so it is no longer possible to do this.

How do I make a Java Object behave exactly like a python dict but have some other implementation of the
underlying data?

Thanks for any help here,

Zack



Windows Liveā„¢: Keep your life in sync. Check it out.
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users