summaryrefslogtreecommitdiff
path: root/java/src/Ice/OptionalFormat.java
blob: fe25ef41cf3ef821422b245f9a4a4828a2ad5e89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// **********************************************************************
//
// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

package Ice;

/**
 * The optional type.
 *
 * An optional value is encoded with a specific optional format. This optional
 * format describes how the data is encoded and how it can be skipped by the
 * unmarshaling code if the optional is not known to the receiver.
 *
 **/
public enum OptionalFormat
{
    F1(0),
    F2(1),
    F4(2),
    F8(3),
    Size(4),
    VSize(5),
    FSize(6),
    Class(7);

    private
    OptionalFormat(int value)
    {
        _value = value;
    }

    public int
    value()
    {
        return _value;
    }

    public static OptionalFormat
    valueOf(int v)
    {
        switch(v)
        {
        case 0:
            return F1;
        case 1:
            return F2;
        case 2:
            return F4;
        case 3:
            return F8;
        case 4:
            return Size;
        case 5:
            return VSize;
        case 6:
            return FSize;
        case 7:
            return Class;
        default:
            throw new IllegalArgumentException();
        }
    }

    private int _value;
}