/*
 * Copyright 2016, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.spine3.protobuf;

import com.google.protobuf.Any;
import com.google.protobuf.BoolValue;
import com.google.protobuf.DoubleValue;
import com.google.protobuf.FloatValue;
import com.google.protobuf.Int32Value;
import com.google.protobuf.Int64Value;
import com.google.protobuf.Message;
import com.google.protobuf.StringValue;

/**
 * Utility class for working with {@link Message} value wrapper objects.
 *
 * @author Alexander Litus
 */
public class Values {

    private Values() {}

    /**
     * Creates a new StringValue wrapping the passed string.
     *
     * @param value the value to wrap
     * @return a new StringValue instance
     */
    public static StringValue newStringValue(String value) {
        final StringValue result = StringValue.newBuilder()
                                              .setValue(value)
                                              .build();
        return result;
    }

    /**
     * Packs the passed value in to {@link Any}.
     */
    public static Any pack(String value) {
        return Any.pack(newStringValue(value));
    }

    /**
     * Creates a new DoubleValue wrapping the passed number.
     *
     * @param value the value to wrap
     * @return a new DoubleValue instance
     */
    public static DoubleValue newDoubleValue(double value) {
        final DoubleValue result = DoubleValue.newBuilder()
                                              .setValue(value)
                                              .build();
        return result;
    }

    /**
     * Packs the passed value in to {@link Any}.
     */
    public static Any pack(double value) {
        return Any.pack(newDoubleValue(value));
    }

    /**
     * Creates a new FloatValue wrapping the passed number.
     *
     * @param value the value to wrap
     * @return a new FloatValue instance
     */
    public static FloatValue newFloatValue(float value) {
        final FloatValue result = FloatValue.newBuilder()
                                            .setValue(value)
                                            .build();
        return result;
    }

    /**
     * Packs the passed value in to {@link Any}.
     */
    public static Any pack(float value) {
        return Any.pack(newFloatValue(value));
    }

    /**
     * Creates a new Int32Value wrapping the passed number.
     *
     * @param value the value to wrap
     * @return a new Int32Value instance
     */
    public static Int32Value newIntegerValue(int value) {
        final Int32Value result = Int32Value.newBuilder()
                                            .setValue(value)
                                            .build();
        return result;
    }

    /**
     * Packs the passed value in to {@link Any}.
     */
    public static Any pack(int value) {
        return Any.pack(newIntegerValue(value));
    }

    /**
     * Creates a new Int64Value wrapping the passed number.
     *
     * @param value the value to wrap
     * @return a new Int64Value instance
     */
    public static Int64Value newLongValue(long value) {
        final Int64Value result = Int64Value.newBuilder()
                                            .setValue(value)
                                            .build();
        return result;
    }

    /**
     * Packs the passed value in to {@link Any}.
     */
    public static Any pack(long value) {
        return Any.pack(newLongValue(value));
    }

    /**
     * Creates a new BoolValue wrapping the passed value.
     *
     * @param value the value to wrap
     * @return a new BoolValue instance
     */
    public static BoolValue newBoolValue(boolean value) {
        final BoolValue result = BoolValue.newBuilder()
                                          .setValue(value)
                                          .build();
        return result;
    }

    /**
     * Packs the passed value in to {@link Any}.
     */
    public static Any pack(boolean value) {
        return Any.pack(newBoolValue(value));
    }
}

@@ -1527,24 +1527,31 @@
 eates a new 
+%7B@code 
 StringValue 
@@ -1545,24 +1545,25 @@
  StringValue
+%7D
  wrapping th
@@ -1976,33 +1976,32 @@
  passed value in
- 
 to %7B@link Any%7D.%0A
@@ -2131,24 +2131,31 @@
 eates a new 
+%7B@code 
 DoubleValue 
@@ -2149,24 +2149,25 @@
  DoubleValue
+%7D
  wrapping th
@@ -2580,33 +2580,32 @@
  passed value in
- 
 to %7B@link Any%7D.%0A
@@ -2735,24 +2735,31 @@
 eates a new 
+%7B@code 
 FloatValue w
@@ -2752,24 +2752,25 @@
 e FloatValue
+%7D
  wrapping th
@@ -3173,33 +3173,32 @@
  passed value in
- 
 to %7B@link Any%7D.%0A
@@ -3326,24 +3326,31 @@
 eates a new 
+%7B@code 
 Int32Value w
@@ -3343,24 +3343,25 @@
 e Int32Value
+%7D
  wrapping th
@@ -3764,33 +3764,32 @@
  passed value in
- 
 to %7B@link Any%7D.%0A
@@ -3917,24 +3917,31 @@
 eates a new 
+%7B@code 
 Int64Value w
@@ -3934,24 +3934,25 @@
 e Int64Value
+%7D
  wrapping th
@@ -4353,33 +4353,32 @@
  passed value in
- 
 to %7B@link Any%7D.%0A
@@ -4504,24 +4504,31 @@
 eates a new 
+%7B@code 
 BoolValue wr
@@ -4520,24 +4520,25 @@
 de BoolValue
+%7D
  wrapping th
@@ -4901,32 +4901,32 @@
 %0A    %7D%0A%0A    /**%0A
+
      * Packs the
@@ -4941,17 +4941,16 @@
 value in
- 
 to %7B@lin

Fix Javadocs in `Values`.