Test

<back to all web services

HelloWithEnumMap

import java.math.*;
import java.util.*;
import net.servicestack.client.*;
import com.google.gson.annotations.*;
import com.google.gson.reflect.*;

public class dtos
{

    public static class HelloWithEnumMap
    {
        public HashMap<EnumType,EnumType> enumProp = null;
        public HashMap<EnumWithValues,EnumWithValues> enumWithValues = null;
        public HashMap<EnumType,EnumType> nullableEnumProp = null;
        public HashMap<EnumFlags,EnumFlags> enumFlags = null;
        public HashMap<EnumStyle,EnumStyle> enumStyle = null;
        
        public HashMap<EnumType,EnumType> getEnumProp() { return enumProp; }
        public HelloWithEnumMap setEnumProp(HashMap<EnumType,EnumType> value) { this.enumProp = value; return this; }
        public HashMap<EnumWithValues,EnumWithValues> getEnumWithValues() { return enumWithValues; }
        public HelloWithEnumMap setEnumWithValues(HashMap<EnumWithValues,EnumWithValues> value) { this.enumWithValues = value; return this; }
        public HashMap<EnumType,EnumType> getNullableEnumProp() { return nullableEnumProp; }
        public HelloWithEnumMap setNullableEnumProp(HashMap<EnumType,EnumType> value) { this.nullableEnumProp = value; return this; }
        public HashMap<EnumFlags,EnumFlags> getEnumFlags() { return enumFlags; }
        public HelloWithEnumMap setEnumFlags(HashMap<EnumFlags,EnumFlags> value) { this.enumFlags = value; return this; }
        public HashMap<EnumStyle,EnumStyle> getEnumStyle() { return enumStyle; }
        public HelloWithEnumMap setEnumStyle(HashMap<EnumStyle,EnumStyle> value) { this.enumStyle = value; return this; }
    }

    public static enum EnumType
    {
        Value1,
        Value2,
        Value3;
    }

    public static enum EnumWithValues
    {
        None,
        Value1,
        Value2;
    }

    @Flags()
    public static enum EnumFlags
    {
        @SerializedName("0") Value0(0),
        @SerializedName("1") Value1(1),
        @SerializedName("2") Value2(2),
        @SerializedName("4") Value3(4),
        @SerializedName("7") Value123(7);

        private final int value;
        EnumFlags(final int intValue) { value = intValue; }
        public int getValue() { return value; }
    }

    public static enum EnumStyle
    {
        Lower,
        Upper,
        PascalCase,
        CamelCase,
        CamelUPPER,
        PascalUPPER;
    }

}

Java HelloWithEnumMap DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsv/oneway/HelloWithEnumMap HTTP/1.1 
Host: test.servicestack.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	enumProp: 
	{
		Value1: Value1
	},
	enumWithValues: 
	{
		None: None
	},
	nullableEnumProp: 
	{
		Value1: Value1
	},
	enumFlags: 
	{
		0: 0
	},
	enumStyle: 
	{
		lower: lower
	}
}