/* Wotonomy: OpenStep design patterns for pure Java applications. Copyright (C) 2002 Israfil consulting Services Corporation This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see http://www.gnu.org $Id: NSCoding.java 892 2006-02-16 12:47:16Z cgruber $ */ package net.wotonomy.foundation; import java.math.BigInteger; /** * A helper interface supporting the NSCoder APIs. At present it very confusing * to me how this even works from a structural perspective, but to be consistent * with WebObjects APIs, this will have to be properly implemented. * * @author cgruber@israfil.net * @author $Author: cgruber $ * @version $Revision: 892 $ */ public interface NSCoding { /** Not yet implemented */ public static class _BigDecimalSupport extends _BigIntegerSupport { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public Object decodeObject(NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _BigDecimalSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _BigIntegerSupport extends Support { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public Object decodeObject(NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ protected static void _encodeBigInteger(NSCoder nscoder, BigInteger biginteger) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ protected static BigInteger _decodeBigInteger(NSCoder nscoder, int i) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _BigIntegerSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _DoubleSupport extends _NumberSupport { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _DoubleSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _FloatSupport extends _NumberSupport { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _FloatSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _LongSupport extends _NumberSupport { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _LongSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _IntegerSupport extends _NumberSupport { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _IntegerSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _ShortSupport extends _NumberSupport { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _ShortSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _ByteSupport extends _NumberSupport { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _ByteSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _NumberSupport extends Support { /** Not yet implemented */ public Class classForCoder(Object obj) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public Object decodeObject(NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _NumberSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _CharacterSupport extends Support { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public Object decodeObject(NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _CharacterSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _DateSupport extends Support { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public Object decodeObject(NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _DateSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _StringSupport extends Support { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public Object decodeObject(NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _StringSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Not yet implemented */ public static class _BooleanSupport extends Support { /** Not yet implemented */ public void encodeWithCoder(Object obj, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public Object decodeObject(NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } /** Not yet implemented */ public _BooleanSupport() { throw new UnsupportedOperationException("Not Yet Implemented"); } } /** Helper class for NSCoding. */ public static abstract class Support { private static NSMutableDictionary classSupportMap = new NSMutableDictionary(16); public static Support supportForClass(Class aClass) { Support support = null; Class realClass = aClass; while (support == null && realClass != null) { support = (Support) classSupportMap.objectForKey(realClass); if (support == null) realClass.getSuperclass(); // Cache if we had to look to a superclass. else if (aClass != realClass) classSupportMap.setObjectForKey(support, aClass); } return support; } public static void setSupportForClass(Support support, Class class1) { classSupportMap.setObjectForKey(support, class1); } /** * Return the class of a given object. It boggles the mind as to why this is not * a static, but in the original, it's not. <sigh> */ public Class classForCoder(Object obj) { return obj.getClass(); } public abstract void encodeWithCoder(Object obj, NSCoder nscoder); public abstract Object decodeObject(NSCoder nscoder); protected static void _encodeUTF8(String s, NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } protected static String _decodeUTF8(NSCoder nscoder) { throw new UnsupportedOperationException("Not Yet Implemented"); } static { setSupportForClass(new _StringSupport(), java.lang.String.class); setSupportForClass(new _BooleanSupport(), java.lang.Boolean.class); setSupportForClass(new _NumberSupport(), null); setSupportForClass(new _ByteSupport(), java.lang.Byte.class); setSupportForClass(new _ShortSupport(), java.lang.Short.class); setSupportForClass(new _IntegerSupport(), java.lang.Integer.class); setSupportForClass(new _LongSupport(), java.lang.Long.class); setSupportForClass(new _FloatSupport(), java.lang.Float.class); setSupportForClass(new _DoubleSupport(), java.lang.Double.class); setSupportForClass(new _BigIntegerSupport(), java.math.BigInteger.class); setSupportForClass(new _BigDecimalSupport(), java.math.BigDecimal.class); setSupportForClass(new _DateSupport(), java.util.Date.class); setSupportForClass(new _CharacterSupport(), java.lang.Character.class); } public Support() { } } // CEG: I'm not sure why these are here, since NSCoding is an interface. // It doesn't seem to even be used anywhere. // CEG: I'm not even sure why this compiles!! // public abstract Class classForCoder(); // CEG: I'm not sure why these are here, since NSCoding is an interface. // It doesn't seem to even be used anywhere. // CEG: I'm not even sure why this compiles!! // public abstract void encodeWithCoder(NSCoder nscoder); } /* * $Log$ Revision 1.1 2006/02/16 12:47:16 cgruber Check in all sources in * eclipse-friendly maven-enabled packages. * * Revision 1.2 2003/08/06 23:07:52 chochos general code cleanup (mostly, * removing unused imports) * * Revision 1.1 2002/07/14 21:56:16 mpowers Contributions from cgruber. * * Revision 1.2 2002/06/25 19:03:02 cgruber Internal documentation fixes. * * Revision 1.1 2002/06/25 07:52:56 cgruber Add quite a few abstract classes, * interfaces, and classes. All API consistent with WebObjects, but with no * implementation, nor any private or package access members from the original. * */