Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2002-2014 "Neo Technology," Network Engine for Objects in Lund AB [http://neotechnology.com] This file is part of Neo4j. Neo4j is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 package org.neo4j.server.rest.repr;
 
 import java.net.URI;
 
 
 public class ValueRepresentation extends Representation
 {
     private final Object value;
 
     private ValueRepresentationRepresentationType typeObject value )
     {
         supertype );
         this. = value;
     }
 
     @Override
     String serializeRepresentationFormat formatURI baseUriExtensionInjector extensions )
     {
         final String result = format.serializeValue();
         format.complete();
         return result;
     }
 
     @Override
     void addToListSerializer serializer )
     {
         serializer.writer.writeValue );
     }
 
     @Override
     void putToMappingSerializer serializerString key )
     {
         serializer.writer.writeValuekey );
     }
 
     public static ValueRepresentation stringString value )
     {
         return new ValueRepresentation.value );
     }
 
     @SuppressWarnings"boxing" )
     public static ValueRepresentation numberint value )
     {
         return new ValueRepresentation.value );
     }
 
     @SuppressWarnings"boxing" )
     public static ValueRepresentation numberlong value )
     {
         return new ValueRepresentation.value );
     }
 
     @SuppressWarnings"boxing" )
     public static ValueRepresentation numberdouble value )
     {
         return new ValueRepresentation.value );
     }
 
     public static ValueRepresentation boolboolean value )
     {
         return new ValueRepresentation.value );
     }
 
     public static ValueRepresentation relationshipTypeRelationshipType type )
     {
         return new ValueRepresentation.type.name() );
     }
 
     public static ValueRepresentation urifinal String path )
     {
         return new ValueRepresentation.null )
         {
             @Override
             String serializeRepresentationFormat formatURI baseUriExtensionInjector extensions )
             {
                 return Serializer.joinBaseWithRelativePathbaseUripath );
             }
            @Override
            void addToListSerializer serializer )
            {
                serializer.addUripath );
            }
            @Override
            void putToMappingSerializer serializerString key )
            {
                serializer.putUrikeypath );
            }
        };
    }
    public static ValueRepresentation templatefinal String path )
    {
        return new ValueRepresentation.null )
        {
            @Override
            String serializeRepresentationFormat formatURI baseUriExtensionInjector extensions )
            {
                return Serializer.joinBaseWithRelativePathbaseUripath );
            }
            @Override
            void addToListSerializer serializer )
            {
                serializer.addUriTemplatepath );
            }
            @Override
            void putToMappingSerializer serializerString key )
            {
                serializer.putUriTemplatekeypath );
            }
        };
    }
    static Representation propertyObject property )
    {
        return .dispatchpropertynull );
    }
    {
        @Override
        protected Representation dispatchBooleanPropertyboolean propertyVoid param )
        {
            return boolproperty );
        }
        @Override
        protected Representation dispatchBytePropertybyte propertyVoid param )
        {
            return new ValueRepresentation.property );
        }
        @Override
        protected Representation dispatchCharacterPropertychar propertyVoid param )
        {
            return new ValueRepresentation.property );
        }
        @Override
        protected Representation dispatchDoublePropertydouble propertyVoid param )
        {
            return new ValueRepresentation.property );
        }
        @Override
        protected Representation dispatchFloatPropertyfloat propertyVoid param )
        {
            return new ValueRepresentation.property );
        }
        @Override
        protected Representation dispatchIntegerPropertyint propertyVoid param )
        {
            return new ValueRepresentation.property );
        }
        @Override
        protected Representation dispatchLongPropertylong propertyVoid param )
        {
            return new ValueRepresentation.property );
        }
        @Override
        protected Representation dispatchShortPropertyshort propertyVoid param )
        {
            return new ValueRepresentation.property );
        }
        @Override
        protected Representation dispatchStringPropertyString propertyVoid param )
        {
            return stringproperty );
        }
        @Override
        protected Representation dispatchStringArrayPropertyString[] propertyVoid param )
        {
            return ListRepresentation.stringsproperty );
        }
        @SuppressWarnings"unchecked" )
        private Iterable<RepresentationdispatchPropertyArray<?, ?> array )
        {
            return new IterableWrapper<RepresentationObject>( (Iterable<Object>) array )
            {
                @Override
                protected Representation underlyingObjectToObjectObject object )
                {
                    return propertyobject );
                }
            };
        }
        @Override
        @SuppressWarnings"boxing" )
        protected Representation dispatchByteArrayPropertyPropertyArray<byte[], Bytearray,
                Void param )
        {
            return toListRepresentation(.array);
        }
        @Override
        @SuppressWarnings"boxing" )
        protected Representation dispatchShortArrayPropertyPropertyArray<short[], Shortarray,
                Void param )
        {
            return toListRepresentation(.array);
        }
        private ListRepresentation toListRepresentation(RepresentationType typePropertyArray<?, ?> array) {
            return new ListRepresentation(typedispatch(array) );
        }
        @Override
        @SuppressWarnings"boxing" )
                PropertyArray<char[], CharacterarrayVoid param )
        {
            return toListRepresentation(.array);
        }
        @Override
        @SuppressWarnings"boxing" )
        protected Representation dispatchIntegerArrayPropertyPropertyArray<int[], Integerarray,
                Void param )
        {
            return toListRepresentation(.array);
        }
        @Override
        @SuppressWarnings"boxing" )
        protected Representation dispatchLongArrayPropertyPropertyArray<long[], Longarray,
                Void param )
        {
            return toListRepresentation(.array);
        }
        @Override
        @SuppressWarnings"boxing" )
        protected Representation dispatchFloatArrayPropertyPropertyArray<float[], Floatarray,
                Void param )
        {
            return toListRepresentation(.array);
        }
        @Override
        @SuppressWarnings"boxing" )
        protected Representation dispatchDoubleArrayProperty(
                PropertyArray<double[], DoublearrayVoid param )
        {
            return toListRepresentation(.array);
        }
        @Override
        @SuppressWarnings"boxing" )
        protected Representation dispatchBooleanArrayProperty(
                PropertyArray<boolean[], BooleanarrayVoid param )
        {
            return toListRepresentation(.array);
        }
    };
New to GrepCode? Check out our FAQ X