001package votorola.s.gwt.scene.feed.ss; // Copyright 2012-2013, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE.
002
003import com.google.gson.stream.JsonWriter;
004import java.io.IOException;
005import votorola.a.diff.*;
006
007
008/** A partial implementation of a mutable and serializeable difference look.
009  */
010public final class DiffLookJig implements DiffLook, SerialJig
011{
012
013
014   // - D i f f - L o o k ----------------------------------------------------------------
015
016
017    public String key() { return key; }
018
019
020        private String key;
021
022
023        private void key( final JsonWriter out ) throws IOException
024        {
025            if( key == null ) return;
026
027            out.name( "key" ).value( key );
028            key = null;
029        }
030
031
032        /** Sets the difference key.
033          */
034        public void setKey( String _key ) { key = _key; }
035
036
037
038    /** Throws UnsupportedOperationException.
039      */
040    public String selectand() { throw new UnsupportedOperationException(); } // unused by jig
041
042
043
044    /** Throws UnsupportedOperationException.
045      */
046    public boolean toPersist() { throw new UnsupportedOperationException(); } // unused by jig
047
048
049
050   // - S e r i a l - J i g --------------------------------------------------------------
051
052
053    public void serialize( final JsonWriter out ) throws IOException
054    {
055        out.beginObject();
056        key( out );
057        out.endObject();
058    }
059
060
061}