text:
package com.citrix.netscaler.nitro.resource.config.ssl;

import com.citrix.netscaler.nitro.resource.base.*;
import com.citrix.netscaler.nitro.service.nitro_service;
import com.citrix.netscaler.nitro.service.options;
import com.citrix.netscaler.nitro.util.*;
import com.citrix.netscaler.nitro.exception.nitro_exception;

class sslvserver_sslcertkey_binding_response extends base_response
{
	public sslvserver_sslcertkey_binding[] sslvserver_sslcertkey_binding;
}
/**
	* Binding class showing the sslcertkey that can be bound to sslvserver.
	*/

public class sslvserver_sslcertkey_binding extends base_resource
{
	private String certkeyname;
	private String crlcheck;
	private String ocspcheck;
	private Integer cleartextport;
	private Boolean ca;
	private Boolean snicert;
	private Boolean skipcaname;
	private String vservername;
	private Long __count;

	/**
	*

	* The name of the certificate key pair binding.
	*

	*/
	public void set_certkeyname(String certkeyname) throws Exception{
		this.certkeyname = certkeyname;
	}

	/**
	*

	* The name of the certificate key pair binding.
	*

	*/
	public String get_certkeyname() throws Exception {
		return this.certkeyname;
	}

	/**
	*

	* The flag is used to indicate whether this particular CA certificate's CA_Name needs to be sent to the SSL client while requesting for client certificate in a SSL handshake.
	*

	*/
	public void set_skipcaname(boolean skipcaname) throws Exception {
		this.skipcaname = new Boolean(skipcaname);
	}

	/**
	*

	* The flag is used to indicate whether this particular CA certificate's CA_Name needs to be sent to the SSL client while requesting for client certificate in a SSL handshake.
	*

	*/
	public void set_skipcaname(Boolean skipcaname) throws Exception{
		this.skipcaname = skipcaname;
	}

	/**
	*

	* The flag is used to indicate whether this particular CA certificate's CA_Name needs to be sent to the SSL client while requesting for client certificate in a SSL handshake.
	*

	*/
	public Boolean get_skipcaname() throws Exception {
		return this.skipcaname;
	}

	/**
	*

	* The name of the CertKey. Use this option to bind Certkey(s) which will be used in SNI processing.
	*

	*/
	public void set_snicert(boolean snicert) throws Exception {
		this.snicert = new Boolean(snicert);
	}

	/**
	*

	* The name of the CertKey. Use this option to bind Certkey(s) which will be used in SNI processing.
	*

	*/
	public void set_snicert(Boolean snicert) throws Exception{
		this.snicert = snicert;
	}

	/**
	*

	* The name of the CertKey. Use this option to bind Certkey(s) which will be used in SNI processing.
	*

	*/
	public Boolean get_snicert() throws Exception {
		return this.snicert;
	}

	/**
	*

	* The state of the OCSP check parameter. (Mandatory/Optional).
 Possible values = Mandatory, Optional
	*

	*/
	public void set_ocspcheck(String ocspcheck) throws Exception{
		this.ocspcheck = ocspcheck;
	}

	/**
	*

	* The state of the OCSP check parameter. (Mandatory/Optional).
 Possible values = Mandatory, Optional
	*

	*/
	public String get_ocspcheck() throws Exception {
		return this.ocspcheck;
	}

	/**
	*

	* CA certificate.
	*

	*/
	public void set_ca(boolean ca) throws Exception {
		this.ca = new Boolean(ca);
	}

	/**
	*

	* CA certificate.
	*

	*/
	public void set_ca(Boolean ca) throws Exception{
		this.ca = ca;
	}

	/**
	*

	* CA certificate.
	*

	*/
	public Boolean get_ca() throws Exception {
		return this.ca;
	}

	/**
	*

	* The state of the CRL check parameter. (Mandatory/Optional).
 Possible values = Mandatory, Optional
	*

	*/
	public void set_crlcheck(String crlcheck) throws Exception{
		this.crlcheck = crlcheck;
	}

	/**
	*

	* The state of the CRL check parameter. (Mandatory/Optional).
 Possible values = Mandatory, Optional
	*

	*/
	public String get_crlcheck() throws Exception {
		return this.crlcheck;
	}

	/**
	*

	* Name of the SSL virtual server.
 Minimum length =  1
	*

	*/
	public void set_vservername(String vservername) throws Exception{
		this.vservername = vservername;
	}

	/**
	*

	* Name of the SSL virtual server.
 Minimum length =  1
	*

	*/
	public String get_vservername() throws Exception {
		return this.vservername;
	}

	/**
	*

	* Port on which clear-text data is sent by the appliance to the server. Do not specify this parameter for SSL offloading with end-to-end encryption.
	*

	*/
	public Integer get_cleartextport() throws Exception {
		return this.cleartextport;
	}

	/**
	*

	* converts nitro response into object and returns the object array in case of get request.
	*

	*/
	protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception{
		sslvserver_sslcertkey_binding_response result = (sslvserver_sslcertkey_binding_response) service.get_payload_formatter().string_to_resource(sslvserver_sslcertkey_binding_response.class, response);
		if(result.errorcode != 0) {
			if (result.errorcode == 444) {
				service.clear_session();
			}
			if(result.severity != null)
			{
				if (result.severity.equals("ERROR"))
					throw new nitro_exception(result.message,result.errorcode);
			}
			else
			{
				throw new nitro_exception(result.message,result.errorcode);
			}
		}
		return result.sslvserver_sslcertkey_binding;
	}

	/**
	*

	* Returns the value of object identifier argument
	*

	*/

	protected String get_object_name() {
		return this.vservername;
	}

	public static base_response add(nitro_service client, sslvserver_sslcertkey_binding resource) throws Exception {
		sslvserver_sslcertkey_binding updateresource = new sslvserver_sslcertkey_binding();
		updateresource.vservername = resource.vservername;
		updateresource.certkeyname = resource.certkeyname;
		updateresource.ca = resource.ca;
		updateresource.crlcheck = resource.crlcheck;
		updateresource.skipcaname = resource.skipcaname;
		updateresource.snicert = resource.snicert;
		updateresource.ocspcheck = resource.ocspcheck;
		return updateresource.update_resource(client);
	}

	public static base_responses add(nitro_service client, sslvserver_sslcertkey_binding resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			sslvserver_sslcertkey_binding updateresources[] = new sslvserver_sslcertkey_binding[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new sslvserver_sslcertkey_binding();
				updateresources[i].vservername = resources[i].vservername;
				updateresources[i].certkeyname = resources[i].certkeyname;
				updateresources[i].ca = resources[i].ca;
				updateresources[i].crlcheck = resources[i].crlcheck;
				updateresources[i].skipcaname = resources[i].skipcaname;
				updateresources[i].snicert = resources[i].snicert;
				updateresources[i].ocspcheck = resources[i].ocspcheck;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}

	public static base_response delete(nitro_service client, sslvserver_sslcertkey_binding resource) throws Exception {
		sslvserver_sslcertkey_binding deleteresource = new sslvserver_sslcertkey_binding();
		deleteresource.vservername = resource.vservername;
		deleteresource.certkeyname = resource.certkeyname;
		deleteresource.ca = resource.ca;
		deleteresource.crlcheck = resource.crlcheck;
		deleteresource.snicert = resource.snicert;
		deleteresource.ocspcheck = resource.ocspcheck;
		return deleteresource.delete_resource(client);
	}

	public static base_responses delete(nitro_service client, sslvserver_sslcertkey_binding resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			sslvserver_sslcertkey_binding deleteresources[] = new sslvserver_sslcertkey_binding[resources.length];
			for (int i=0;i<resources.length;i++){
				deleteresources[i] = new sslvserver_sslcertkey_binding();
				deleteresources[i].vservername = resources[i].vservername;
				deleteresources[i].certkeyname = resources[i].certkeyname;
				deleteresources[i].ca = resources[i].ca;
				deleteresources[i].crlcheck = resources[i].crlcheck;
				deleteresources[i].snicert = resources[i].snicert;
				deleteresources[i].ocspcheck = resources[i].ocspcheck;
			}
			result = delete_bulk_request(client, deleteresources);
		}
		return result;
	}

	/**
	* Use this API to fetch sslvserver_sslcertkey_binding resources of given name .
	*/
	public static sslvserver_sslcertkey_binding[] get(nitro_service service, String vservername) throws Exception{
		sslvserver_sslcertkey_binding obj = new sslvserver_sslcertkey_binding();
		obj.set_vservername(vservername);
		sslvserver_sslcertkey_binding response[] = (sslvserver_sslcertkey_binding[]) obj.get_resources(service);
		return response;
	}

	/**
	* Use this API to fetch filtered set of sslvserver_sslcertkey_binding resources.
	* filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
	*/
	public static sslvserver_sslcertkey_binding[] get_filtered(nitro_service service, String vservername, String filter) throws Exception{
		sslvserver_sslcertkey_binding obj = new sslvserver_sslcertkey_binding();
		obj.set_vservername(vservername);
		options option = new options();
		option.set_filter(filter);
		sslvserver_sslcertkey_binding[] response = (sslvserver_sslcertkey_binding[]) obj.getfiltered(service, option);
		return response;
	}

	/**
	* Use this API to fetch filtered set of sslvserver_sslcertkey_binding resources.
	* set the filter parameter values in filtervalue object.
	*/
	public static sslvserver_sslcertkey_binding[] get_filtered(nitro_service service, String vservername, filtervalue[] filter) throws Exception{
		sslvserver_sslcertkey_binding obj = new sslvserver_sslcertkey_binding();
		obj.set_vservername(vservername);
		options option = new options();
		option.set_filter(filter);
		sslvserver_sslcertkey_binding[] response = (sslvserver_sslcertkey_binding[]) obj.getfiltered(service, option);
		return response;
	}

	/**
	* Use this API to count sslvserver_sslcertkey_binding resources configued on NetScaler.
	*/
	public static long count(nitro_service service, String vservername) throws Exception{
		sslvserver_sslcertkey_binding obj = new sslvserver_sslcertkey_binding();
		obj.set_vservername(vservername);
		options option = new options();
		option.set_count(true);
		sslvserver_sslcertkey_binding response[] = (sslvserver_sslcertkey_binding[]) obj.get_resources(service,option);
		if (response != null) {
			return response[0].__count;
		}
		return 0;
	}

	/**
	* Use this API to count the filtered set of sslvserver_sslcertkey_binding resources.
	* filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
	*/
	public static long count_filtered(nitro_service service, String vservername, String filter) throws Exception{
		sslvserver_sslcertkey_binding obj = new sslvserver_sslcertkey_binding();
		obj.set_vservername(vservername);
		options option = new options();
		option.set_count(true);
		option.set_filter(filter);
		sslvserver_sslcertkey_binding[] response = (sslvserver_sslcertkey_binding[]) obj.getfiltered(service, option);
		if (response != null) {
			return response[0].__count;
		}
		return 0;
	}

	/**
	* Use this API to count the filtered set of sslvserver_sslcertkey_binding resources.
	* set the filter parameter values in filtervalue object.
	*/
	public static long count_filtered(nitro_service service, String vservername, filtervalue[] filter) throws Exception{
		sslvserver_sslcertkey_binding obj = new sslvserver_sslcertkey_binding();
		obj.set_vservername(vservername);
		options option = new options();
		option.set_count(true);
		option.set_filter(filter);
		sslvserver_sslcertkey_binding[] response = (sslvserver_sslcertkey_binding[]) obj.getfiltered(service, option);
		if (response != null) {
			return response[0].__count;
		}
		return 0;
	}

	public static class ocspcheckEnum {
		public static final String Mandatory = "Mandatory";
		public static final String Optional = "Optional";
	}
	public static class crlcheckEnum {
		public static final String Mandatory = "Mandatory";
		public static final String Optional = "Optional";
	}
	public static class labeltypeEnum {
		public static final String vserver = "vserver";
		public static final String service = "service";
		public static final String policylabel = "policylabel";
	}

}


text:
__host__ __device__
#endif
inline
bool gdf_is_valid(const gdf_valid_type *valid, gdf_index_type pos) {
	if ( valid )
		return (valid[pos / GDF_VALID_BITSIZE] >> (pos % GDF_VALID_BITSIZE)) & 1;
	else
		return true;
}

#ifdef __CUDACC__
__host__ __device__
#endif
inline
gdf_size_type gdf_get_num_chars_bitmask(gdf_size_type size) {
	return (( size + ( GDF_VALID_BITSIZE - 1)) / GDF_VALID_BITSIZE );
}

#endif

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

using RedoxExtensions.Wrapper;

namespace RedoxExtensions.VirindiInterop
{
    [Flags]
    public enum VTStateOptions
    {
        DontChange = 0,
        Combat = 1,
        Nav = 2,
        Looting = 4,
        Buffing = 8,
        Meta = 16
    }

    public class VTStateScope : IDisposable
    {
        private readonly Dictionary<string, string> _previousStateOptions;

        public VTStateScope(VTStateOptions desiredEnabledStates, VTStateOptions desiredDisabledStates)
        {
            List<string> optionsToCheck = new List<string>();

            // Only check the options that will get changed.  That way we don't even mess with options
            // the scope doesn't care about.
            AddOptionIfGoingToChange(optionsToCheck, desiredEnabledStates, desiredDisabledStates, VTStateOptions.Combat, VTOptionNames.EnableCombat);
            AddOptionIfGoingToChange(optionsToCheck, desiredEnabledStates, desiredDisabledStates, VTStateOptions.Nav, VTOptionNames.EnableNav);
            AddOptionIfGoingToChange(optionsToCheck, desiredEnabledStates, desiredDisabledStates, VTStateOptions.Looting, VTOptionNames.EnableLooting);
            AddOptionIfGoingToChange(optionsToCheck, desiredEnabledStates, desiredDisabledStates, VTStateOptions.Buffing, VTOptionNames.EnableBuffing);
            AddOptionIfGoingToChange(optionsToCheck, desiredEnabledStates, desiredDisabledStates, VTStateOptions.Meta, VTOptionNames.EnableMeta);

            this._previousStateOptions = VTUtilities.GetVTOptions(optionsToCheck);

            REPlugin.Instance.Debug.WriteObject(this._previousStateOptions, "VTStateScope-CurrentBackup");

            // Apply enables first
            if (desiredEnabledStates != VTStateOptions.DontChange)
            {
                CheckAndSetState(desiredEnabledStates, VTStateOptions.Combat, VTActions.EnableCombat);
                CheckAndSetState(desiredEnabledStates, VTStateOptions.Nav, VTActions.EnableNav);
                CheckAndSetState(desiredEnabledStates, VTStateOptions.Looting, VTActions.EnableLooting);
                CheckAndSetState(desiredEnabledStates, VTStateOptions.Buffing, VTActions.EnableBuffing);
                CheckAndSetState(desiredEnabledStates, VTStateOptions.Meta, VTActions.EnableMeta);
            }

            // Then apply disables.  Yes, they could overwrite, consider that programmer error
            if (desiredDisabledStates != VTStateOptions.DontChange)
            {
                CheckAndSetState(desiredDisabledStates, VTStateOptions.Combat, VTActions.DisableCombat);
                CheckAndSetState(desiredDisabledStates, VTStateOptions.Nav, VTActions.DisableNav);
                CheckAndSetState(desiredDisabledStates, VTStateOptions.Looting, VTActions.DisableLooting);
                CheckAndSetState(desiredDisabledStates, VTStateOptions.Buffing, VTActions.DisableBuffing);
                CheckAndSetState(desiredDisabledStates, VTStateOptions.Meta, VTActions.DisableMeta);
            }
        }

        public static VTStateScope Enter(VTStateOptions enabledStates, VTStateOptions disabledStates)
        {
            return new VTStateScope(enabledStates, disabledStates);
        }

        public static VTStateScope EnterAllDisabled()
        {
            return new VTStateScope(VTStateOptions.DontChange, VTStateOptions.Nav | VTStateOptions.Meta | VTStateOptions.Looting | VTStateOptions.Combat | VTStateOptions.Buffing);
        }

        public static VTStateScope EnterNavDisabled()
        {
            return new VTStateScope(VTStateOptions.DontChange, VTStateOptions.Nav);
        }

        public void Dispose()
        {
            // Restore original state
            REPlugin.Instance.Debug.WriteObject(this._previousStateOptions, "VTStateScope-RestoringBackup");
            VTUtilities.SetOptions(this._previousStateOptions);
        }

        internal static void AddOptionIfGoingToChange(List<string> optionsToCheck, VTStateOptions desiredEnabledStates, VTStateOptions desiredDisabledStates, VTStateOptions checkState, string optionValueToAdd)
        {
            if ((desiredEnabledStates & checkState) != 0 || (desiredDisabledStates & checkState) != 0)
            {
                optionsToCheck.Add(optionValueToAdd);
            }
        }

        private static void CheckAndSetState(VTStateOptions desiredState, VTStateOptions checkState, SafeAction matchAction)
        {
            if ((desiredState & checkState) != 0)
            {
                matchAction();
            }
        }
    }
}


text:
import { historyPop } from '@shopgate/pwa-common/actions/router';
import { hex2bin } from '@shopgate/pwa-common/helpers/data';
import { userDidLogout$ } from '@shopgate/pwa-common/streams/user';
import { LoadingProvider } from '@shopgate/pwa-common/providers';
import {
  requestReviewSubmit$,
  responseReviewSubmit$,
  successReviewSubmit$,
} from '@shopgate/pwa-common-commerce/reviews/streams';
import { getCurrentRoute } from '@shopgate/pwa-common/selectors/router';
import fetchUserReview from '@shopgate/pwa-common-commerce/reviews/actions/fetchUserReview';
import flushUserReview from '@shopgate/pwa-common-commerce/reviews/actions/flushUserReview';
import ToastProvider from '@shopgate/pwa-common/providers/toast';
import { productRoutesWillEnter$ } from './streams';

/**
 * @param {Function} subscribe The subscribe function.
 */
export default function writeReview(subscribe) {
  /**
   * Gets triggered when item, reviews or write_reviews route will be entered.
   */
  subscribe(productRoutesWillEnter$, ({ action, dispatch, getState }) => {
    const state = getState();
    const { productId } = action.route.params;

    if (!productId || !state.user.login.isLoggedIn) {
      return;
    }

    dispatch(fetchUserReview(hex2bin(productId)));
  });

  /**
   * Get triggered when a review submit is requested.
   */
  subscribe(requestReviewSubmit$, ({ getState }) => {
    const { pathname } = getCurrentRoute(getState());
    LoadingProvider.setLoading(pathname);
  });

  /**
   * Get triggered when a review submitted got a response.
   */
  subscribe(responseReviewSubmit$, ({ getState }) => {
    const { pathname } = getCurrentRoute(getState());
    LoadingProvider.unsetLoading(pathname);
  });

  /**
   * Get triggered when a review was successfully submitted
   */
  subscribe(successReviewSubmit$, ({ dispatch, events }) => {
    dispatch(historyPop());
    events.emit(ToastProvider.ADD, {
      id: 'reviews.success_message',
      message: 'reviews.success_message',
    });
  });

  /**
   * When user is logged out reviews relation should be removed.
   */
  subscribe(userDidLogout$, ({ dispatch }) => dispatch(flushUserReview()));
}


text:
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef CPPSORT_DETAIL_PARTITION_H_
#define CPPSORT_DETAIL_PARTITION_H_

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <iterator>
#include <utility>
#include <cpp-sort/utility/iter_move.h>
#include "iterator_traits.h"

namespace cppsort
{
namespace detail
{
    template<typename Predicate, typename ForwardIterator>
    auto partition_impl(ForwardIterator first, ForwardIterator last, Predicate pred,
                        std::forward_iterator_tag)
        -> ForwardIterator
    {
        while (true) {
            if (first == last) {
                return first;
            }
            if (not pred(*first)) {
                break;
            }
            ++first;
        }
        for (auto p = first; ++p != last;) {
            if (pred(*p)) {
                using utility::iter_swap;
                iter_swap(first, p);
                ++first;
            }
        }
        return first;
    }

    template<typename Predicate, typename BidirectionalIterator>
    auto partition_impl(BidirectionalIterator first, BidirectionalIterator last, Predicate pred,
                        std::bidirectional_iterator_tag)
        -> BidirectionalIterator
    {
        while (true) {
            while (true) {
                if (first == last) {
                    return first;
                }
                if (not pred(*first)) {
                    break;
                }
                ++first;
            }
            do {
                if (first == --last) {
                    return first;
                }
            } while (not pred(*last));
            using utility::iter_swap;
            iter_swap(first, last);
            ++first;
        }
    }

    template<typename ForwardIterator, typename Predicate>
    auto partition(ForwardIterator first, ForwardIterator last, Predicate pred)
        -> ForwardIterator
    {
        return partition_impl<Predicate&>(
            std::move(first), std::move(last), pred,
            iterator_category_t<ForwardIterator>{}
        );
    }
}}

#endif // CPPSORT_DETAIL_PARTITION_H_


text:
package io.github.factoryfx.javafx.editor.attribute.visualisation;

import java.math.BigDecimal;
import java.text.DecimalFormat;

import io.github.factoryfx.factory.attribute.types.BigDecimalAttribute;
import io.github.factoryfx.javafx.editor.attribute.ValidationDecoration;
import io.github.factoryfx.javafx.editor.attribute.ValueAttributeVisualisation;
import io.github.factoryfx.javafx.editor.attribute.converter.BigDecimalStringConverter;
import io.github.factoryfx.javafx.util.TypedTextFieldHelper;
import javafx.scene.Node;
import javafx.scene.control.TextField;

public class BigDecimalAttributeVisualisation extends ValueAttributeVisualisation<BigDecimal,BigDecimalAttribute> {

    public final String decimalFormatPattern;

    public BigDecimalAttributeVisualisation(BigDecimalAttribute attribute, ValidationDecoration validationDecoration) {
        super(attribute, validationDecoration);
        this.decimalFormatPattern = attribute.internal_getDecimalFormatPattern();
    }

    @Override
    public Node createValueVisualisation() {
        TextField textField = new TextField();
        TypedTextFieldHelper.setupBigDecimalTextField(textField,decimalFormatPattern);

        DecimalFormat decimalFormat = new DecimalFormat(decimalFormatPattern);
        decimalFormat.setParseBigDecimal(true);
        textField.textProperty().bindBidirectional(observableAttributeValue, new BigDecimalStringConverter(decimalFormat));
        textField.disableProperty().bind(readOnly);
        return textField;
    }

}


text:
package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"encoding/json"
	"strconv"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// KubeProxyReplacement Status of kube-proxy replacement
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacement
type KubeProxyReplacement struct {

	//
	//
	// +k8s:deepcopy-gen=true
	DeviceList []*KubeProxyReplacementDeviceListItems0 `json:"deviceList"`

	// devices
	Devices []string `json:"devices"`

	// direct routing device
	DirectRoutingDevice string `json:"directRoutingDevice,omitempty"`

	// features
	Features *KubeProxyReplacementFeatures `json:"features,omitempty"`

	// mode
	// Enum: [Disabled Strict Probe Partial]
	Mode string `json:"mode,omitempty"`
}

// Validate validates this kube proxy replacement
func (m *KubeProxyReplacement) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateDeviceList(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateFeatures(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateMode(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *KubeProxyReplacement) validateDeviceList(formats strfmt.Registry) error {
	if swag.IsZero(m.DeviceList) { // not required
		return nil
	}

	for i := 0; i < len(m.DeviceList); i++ {
		if swag.IsZero(m.DeviceList[i]) { // not required
			continue
		}

		if m.DeviceList[i] != nil {
			if err := m.DeviceList[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("deviceList" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("deviceList" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

func (m *KubeProxyReplacement) validateFeatures(formats strfmt.Registry) error {
	if swag.IsZero(m.Features) { // not required
		return nil
	}

	if m.Features != nil {
		if err := m.Features.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features")
			}
			return err
		}
	}

	return nil
}

var kubeProxyReplacementTypeModePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["Disabled","Strict","Probe","Partial"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		kubeProxyReplacementTypeModePropEnum = append(kubeProxyReplacementTypeModePropEnum, v)
	}
}

const (

	// KubeProxyReplacementModeDisabled captures enum value "Disabled"
	KubeProxyReplacementModeDisabled string = "Disabled"

	// KubeProxyReplacementModeStrict captures enum value "Strict"
	KubeProxyReplacementModeStrict string = "Strict"

	// KubeProxyReplacementModeProbe captures enum value "Probe"
	KubeProxyReplacementModeProbe string = "Probe"

	// KubeProxyReplacementModePartial captures enum value "Partial"
	KubeProxyReplacementModePartial string = "Partial"
)

// prop value enum
func (m *KubeProxyReplacement) validateModeEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, kubeProxyReplacementTypeModePropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *KubeProxyReplacement) validateMode(formats strfmt.Registry) error {
	if swag.IsZero(m.Mode) { // not required
		return nil
	}

	// value enum
	if err := m.validateModeEnum("mode", "body", m.Mode); err != nil {
		return err
	}

	return nil
}

// ContextValidate validate this kube proxy replacement based on the context it is used
func (m *KubeProxyReplacement) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := m.contextValidateDeviceList(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateFeatures(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *KubeProxyReplacement) contextValidateDeviceList(ctx context.Context, formats strfmt.Registry) error {

	for i := 0; i < len(m.DeviceList); i++ {

		if m.DeviceList[i] != nil {
			if err := m.DeviceList[i].ContextValidate(ctx, formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("deviceList" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("deviceList" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

func (m *KubeProxyReplacement) contextValidateFeatures(ctx context.Context, formats strfmt.Registry) error {

	if m.Features != nil {
		if err := m.Features.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features")
			}
			return err
		}
	}

	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacement) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacement) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacement
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementDeviceListItems0
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementDeviceListItems0
type KubeProxyReplacementDeviceListItems0 struct {

	//
	//
	// +k8s:deepcopy-gen=true
	IP []string `json:"ip"`

	// name
	Name string `json:"name,omitempty"`
}

// Validate validates this kube proxy replacement device list items0
func (m *KubeProxyReplacementDeviceListItems0) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement device list items0 based on context it is used
func (m *KubeProxyReplacementDeviceListItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementDeviceListItems0) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementDeviceListItems0) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementDeviceListItems0
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeatures
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeatures
type KubeProxyReplacementFeatures struct {

	// external i ps
	ExternalIPs *KubeProxyReplacementFeaturesExternalIPs `json:"externalIPs,omitempty"`

	// graceful termination
	GracefulTermination *KubeProxyReplacementFeaturesGracefulTermination `json:"gracefulTermination,omitempty"`

	// host port
	HostPort *KubeProxyReplacementFeaturesHostPort `json:"hostPort,omitempty"`

	// host reachable services
	HostReachableServices *KubeProxyReplacementFeaturesHostReachableServices `json:"hostReachableServices,omitempty"`

	// nat46 x64
	Nat46X64 *KubeProxyReplacementFeaturesNat46X64 `json:"nat46X64,omitempty"`

	// node port
	NodePort *KubeProxyReplacementFeaturesNodePort `json:"nodePort,omitempty"`

	// session affinity
	SessionAffinity *KubeProxyReplacementFeaturesSessionAffinity `json:"sessionAffinity,omitempty"`

	// socket l b
	SocketLB *KubeProxyReplacementFeaturesSocketLB `json:"socketLB,omitempty"`

	// socket l b tracing
	SocketLBTracing *KubeProxyReplacementFeaturesSocketLBTracing `json:"socketLBTracing,omitempty"`
}

// Validate validates this kube proxy replacement features
func (m *KubeProxyReplacementFeatures) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateExternalIPs(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateGracefulTermination(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateHostPort(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateHostReachableServices(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateNat46X64(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateNodePort(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateSessionAffinity(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateSocketLB(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateSocketLBTracing(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *KubeProxyReplacementFeatures) validateExternalIPs(formats strfmt.Registry) error {
	if swag.IsZero(m.ExternalIPs) { // not required
		return nil
	}

	if m.ExternalIPs != nil {
		if err := m.ExternalIPs.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "externalIPs")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "externalIPs")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) validateGracefulTermination(formats strfmt.Registry) error {
	if swag.IsZero(m.GracefulTermination) { // not required
		return nil
	}

	if m.GracefulTermination != nil {
		if err := m.GracefulTermination.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "gracefulTermination")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "gracefulTermination")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) validateHostPort(formats strfmt.Registry) error {
	if swag.IsZero(m.HostPort) { // not required
		return nil
	}

	if m.HostPort != nil {
		if err := m.HostPort.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "hostPort")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "hostPort")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) validateHostReachableServices(formats strfmt.Registry) error {
	if swag.IsZero(m.HostReachableServices) { // not required
		return nil
	}

	if m.HostReachableServices != nil {
		if err := m.HostReachableServices.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "hostReachableServices")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "hostReachableServices")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) validateNat46X64(formats strfmt.Registry) error {
	if swag.IsZero(m.Nat46X64) { // not required
		return nil
	}

	if m.Nat46X64 != nil {
		if err := m.Nat46X64.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "nat46X64")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "nat46X64")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) validateNodePort(formats strfmt.Registry) error {
	if swag.IsZero(m.NodePort) { // not required
		return nil
	}

	if m.NodePort != nil {
		if err := m.NodePort.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "nodePort")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "nodePort")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) validateSessionAffinity(formats strfmt.Registry) error {
	if swag.IsZero(m.SessionAffinity) { // not required
		return nil
	}

	if m.SessionAffinity != nil {
		if err := m.SessionAffinity.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "sessionAffinity")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "sessionAffinity")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) validateSocketLB(formats strfmt.Registry) error {
	if swag.IsZero(m.SocketLB) { // not required
		return nil
	}

	if m.SocketLB != nil {
		if err := m.SocketLB.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "socketLB")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "socketLB")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) validateSocketLBTracing(formats strfmt.Registry) error {
	if swag.IsZero(m.SocketLBTracing) { // not required
		return nil
	}

	if m.SocketLBTracing != nil {
		if err := m.SocketLBTracing.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "socketLBTracing")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "socketLBTracing")
			}
			return err
		}
	}

	return nil
}

// ContextValidate validate this kube proxy replacement features based on the context it is used
func (m *KubeProxyReplacementFeatures) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := m.contextValidateExternalIPs(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateGracefulTermination(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateHostPort(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateHostReachableServices(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateNat46X64(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateNodePort(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateSessionAffinity(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateSocketLB(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateSocketLBTracing(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateExternalIPs(ctx context.Context, formats strfmt.Registry) error {

	if m.ExternalIPs != nil {
		if err := m.ExternalIPs.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "externalIPs")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "externalIPs")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateGracefulTermination(ctx context.Context, formats strfmt.Registry) error {

	if m.GracefulTermination != nil {
		if err := m.GracefulTermination.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "gracefulTermination")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "gracefulTermination")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateHostPort(ctx context.Context, formats strfmt.Registry) error {

	if m.HostPort != nil {
		if err := m.HostPort.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "hostPort")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "hostPort")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateHostReachableServices(ctx context.Context, formats strfmt.Registry) error {

	if m.HostReachableServices != nil {
		if err := m.HostReachableServices.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "hostReachableServices")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "hostReachableServices")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateNat46X64(ctx context.Context, formats strfmt.Registry) error {

	if m.Nat46X64 != nil {
		if err := m.Nat46X64.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "nat46X64")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "nat46X64")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateNodePort(ctx context.Context, formats strfmt.Registry) error {

	if m.NodePort != nil {
		if err := m.NodePort.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "nodePort")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "nodePort")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateSessionAffinity(ctx context.Context, formats strfmt.Registry) error {

	if m.SessionAffinity != nil {
		if err := m.SessionAffinity.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "sessionAffinity")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "sessionAffinity")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateSocketLB(ctx context.Context, formats strfmt.Registry) error {

	if m.SocketLB != nil {
		if err := m.SocketLB.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "socketLB")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "socketLB")
			}
			return err
		}
	}

	return nil
}

func (m *KubeProxyReplacementFeatures) contextValidateSocketLBTracing(ctx context.Context, formats strfmt.Registry) error {

	if m.SocketLBTracing != nil {
		if err := m.SocketLBTracing.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("features" + "." + "socketLBTracing")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("features" + "." + "socketLBTracing")
			}
			return err
		}
	}

	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeatures) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeatures) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeatures
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesExternalIPs
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesExternalIPs
type KubeProxyReplacementFeaturesExternalIPs struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`
}

// Validate validates this kube proxy replacement features external i ps
func (m *KubeProxyReplacementFeaturesExternalIPs) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement features external i ps based on context it is used
func (m *KubeProxyReplacementFeaturesExternalIPs) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesExternalIPs) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesExternalIPs) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesExternalIPs
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesGracefulTermination
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesGracefulTermination
type KubeProxyReplacementFeaturesGracefulTermination struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`
}

// Validate validates this kube proxy replacement features graceful termination
func (m *KubeProxyReplacementFeaturesGracefulTermination) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement features graceful termination based on context it is used
func (m *KubeProxyReplacementFeaturesGracefulTermination) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesGracefulTermination) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesGracefulTermination) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesGracefulTermination
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesHostPort
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesHostPort
type KubeProxyReplacementFeaturesHostPort struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`
}

// Validate validates this kube proxy replacement features host port
func (m *KubeProxyReplacementFeaturesHostPort) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement features host port based on context it is used
func (m *KubeProxyReplacementFeaturesHostPort) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesHostPort) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesHostPort) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesHostPort
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesHostReachableServices
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesHostReachableServices
type KubeProxyReplacementFeaturesHostReachableServices struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`

	// protocols
	Protocols []string `json:"protocols"`
}

// Validate validates this kube proxy replacement features host reachable services
func (m *KubeProxyReplacementFeaturesHostReachableServices) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement features host reachable services based on context it is used
func (m *KubeProxyReplacementFeaturesHostReachableServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesHostReachableServices) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesHostReachableServices) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesHostReachableServices
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesNat46X64
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesNat46X64
type KubeProxyReplacementFeaturesNat46X64 struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`
}

// Validate validates this kube proxy replacement features nat46 x64
func (m *KubeProxyReplacementFeaturesNat46X64) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement features nat46 x64 based on context it is used
func (m *KubeProxyReplacementFeaturesNat46X64) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesNat46X64) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesNat46X64) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesNat46X64
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesNodePort
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesNodePort
type KubeProxyReplacementFeaturesNodePort struct {

	// acceleration
	// Enum: [None Native Generic]
	Acceleration string `json:"acceleration,omitempty"`

	// algorithm
	// Enum: [Random Maglev]
	Algorithm string `json:"algorithm,omitempty"`

	// enabled
	Enabled bool `json:"enabled,omitempty"`

	// lut size
	LutSize int64 `json:"lutSize,omitempty"`

	// mode
	// Enum: [SNAT DSR Hybrid]
	Mode string `json:"mode,omitempty"`

	// port max
	PortMax int64 `json:"portMax,omitempty"`

	// port min
	PortMin int64 `json:"portMin,omitempty"`
}

// Validate validates this kube proxy replacement features node port
func (m *KubeProxyReplacementFeaturesNodePort) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateAcceleration(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateAlgorithm(formats); err != nil {
		res = append(res, err)
	}

	if err := m.validateMode(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

var kubeProxyReplacementFeaturesNodePortTypeAccelerationPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["None","Native","Generic"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		kubeProxyReplacementFeaturesNodePortTypeAccelerationPropEnum = append(kubeProxyReplacementFeaturesNodePortTypeAccelerationPropEnum, v)
	}
}

const (

	// KubeProxyReplacementFeaturesNodePortAccelerationNone captures enum value "None"
	KubeProxyReplacementFeaturesNodePortAccelerationNone string = "None"

	// KubeProxyReplacementFeaturesNodePortAccelerationNative captures enum value "Native"
	KubeProxyReplacementFeaturesNodePortAccelerationNative string = "Native"

	// KubeProxyReplacementFeaturesNodePortAccelerationGeneric captures enum value "Generic"
	KubeProxyReplacementFeaturesNodePortAccelerationGeneric string = "Generic"
)

// prop value enum
func (m *KubeProxyReplacementFeaturesNodePort) validateAccelerationEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, kubeProxyReplacementFeaturesNodePortTypeAccelerationPropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *KubeProxyReplacementFeaturesNodePort) validateAcceleration(formats strfmt.Registry) error {
	if swag.IsZero(m.Acceleration) { // not required
		return nil
	}

	// value enum
	if err := m.validateAccelerationEnum("features"+"."+"nodePort"+"."+"acceleration", "body", m.Acceleration); err != nil {
		return err
	}

	return nil
}

var kubeProxyReplacementFeaturesNodePortTypeAlgorithmPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["Random","Maglev"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		kubeProxyReplacementFeaturesNodePortTypeAlgorithmPropEnum = append(kubeProxyReplacementFeaturesNodePortTypeAlgorithmPropEnum, v)
	}
}

const (

	// KubeProxyReplacementFeaturesNodePortAlgorithmRandom captures enum value "Random"
	KubeProxyReplacementFeaturesNodePortAlgorithmRandom string = "Random"

	// KubeProxyReplacementFeaturesNodePortAlgorithmMaglev captures enum value "Maglev"
	KubeProxyReplacementFeaturesNodePortAlgorithmMaglev string = "Maglev"
)

// prop value enum
func (m *KubeProxyReplacementFeaturesNodePort) validateAlgorithmEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, kubeProxyReplacementFeaturesNodePortTypeAlgorithmPropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *KubeProxyReplacementFeaturesNodePort) validateAlgorithm(formats strfmt.Registry) error {
	if swag.IsZero(m.Algorithm) { // not required
		return nil
	}

	// value enum
	if err := m.validateAlgorithmEnum("features"+"."+"nodePort"+"."+"algorithm", "body", m.Algorithm); err != nil {
		return err
	}

	return nil
}

var kubeProxyReplacementFeaturesNodePortTypeModePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["SNAT","DSR","Hybrid"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		kubeProxyReplacementFeaturesNodePortTypeModePropEnum = append(kubeProxyReplacementFeaturesNodePortTypeModePropEnum, v)
	}
}

const (

	// KubeProxyReplacementFeaturesNodePortModeSNAT captures enum value "SNAT"
	KubeProxyReplacementFeaturesNodePortModeSNAT string = "SNAT"

	// KubeProxyReplacementFeaturesNodePortModeDSR captures enum value "DSR"
	KubeProxyReplacementFeaturesNodePortModeDSR string = "DSR"

	// KubeProxyReplacementFeaturesNodePortModeHybrid captures enum value "Hybrid"
	KubeProxyReplacementFeaturesNodePortModeHybrid string = "Hybrid"
)

// prop value enum
func (m *KubeProxyReplacementFeaturesNodePort) validateModeEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, kubeProxyReplacementFeaturesNodePortTypeModePropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *KubeProxyReplacementFeaturesNodePort) validateMode(formats strfmt.Registry) error {
	if swag.IsZero(m.Mode) { // not required
		return nil
	}

	// value enum
	if err := m.validateModeEnum("features"+"."+"nodePort"+"."+"mode", "body", m.Mode); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this kube proxy replacement features node port based on context it is used
func (m *KubeProxyReplacementFeaturesNodePort) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesNodePort) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesNodePort) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesNodePort
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesSessionAffinity
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesSessionAffinity
type KubeProxyReplacementFeaturesSessionAffinity struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`
}

// Validate validates this kube proxy replacement features session affinity
func (m *KubeProxyReplacementFeaturesSessionAffinity) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement features session affinity based on context it is used
func (m *KubeProxyReplacementFeaturesSessionAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesSessionAffinity) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesSessionAffinity) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesSessionAffinity
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesSocketLB
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesSocketLB
type KubeProxyReplacementFeaturesSocketLB struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`
}

// Validate validates this kube proxy replacement features socket l b
func (m *KubeProxyReplacementFeaturesSocketLB) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement features socket l b based on context it is used
func (m *KubeProxyReplacementFeaturesSocketLB) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesSocketLB) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesSocketLB) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesSocketLB
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}

// KubeProxyReplacementFeaturesSocketLBTracing
//
// +k8s:deepcopy-gen=true
//
// swagger:model KubeProxyReplacementFeaturesSocketLBTracing
type KubeProxyReplacementFeaturesSocketLBTracing struct {

	// enabled
	Enabled bool `json:"enabled,omitempty"`
}

// Validate validates this kube proxy replacement features socket l b tracing
func (m *KubeProxyReplacementFeaturesSocketLBTracing) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this kube proxy replacement features socket l b tracing based on context it is used
func (m *KubeProxyReplacementFeaturesSocketLBTracing) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesSocketLBTracing) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *KubeProxyReplacementFeaturesSocketLBTracing) UnmarshalBinary(b []byte) error {
	var res KubeProxyReplacementFeaturesSocketLBTracing
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}


text:
config-file-bi
=====

[![Greenkeeper badge](https://badges.greenkeeper.io/coderfox/config-file-bi.svg)](https://greenkeeper.io/)
[![Build Status](https://img.shields.io/travis/coderfox/config-file-bi.svg?style=flat-square)](https://travis-ci.org/coderfox/config-file-bi)
[![Coveralls](https://img.shields.io/coveralls/coderfox/config-file-bi.svg?style=flat-square)](https://coveralls.io/github/coderfox/config-file-bi)
[![license](https://img.shields.io/github/license/coderfox/config-file-bi.svg?style=flat-square)](https://github.com/coderfox/config-file-bi/blob/master/LICENSE)
[![npm](https://img.shields.io/npm/dt/config-file-bi.svg?style=flat-square)](https://www.npmjs.com/package/config-file-bi)
[![npm](https://img.shields.io/npm/v/config-file-bi.svg?style=flat-square)](https://www.npmjs.com/package/config-file-bi)

R/W config file management.

Install
-----

```
npm install config-file-bi --save
```

or

```
yarn add config-file-bi
```

Usage
-----

```TypeScript
import * as Config from "config-file-bi";

// previously only YAML format is supported
let config = new Config("./config.yaml");

// load config from file, which will automatically create
//     the file when file not exists
await config.pull();
// or
config.pullSync();

// and the not-creating file one
await config.pullWhenExists();
// or
config.pullSyncWhenExists();

// write config to file
await config.push();
// or
config.pushSync();

// get config by key
config.get("something");

// set config by key
config.set("something", data);

// set config by key, only when key exists
config.setWhenExists("something", data);

// throws error when key not exists for #get and #set
config.KeyNotExistsError
```

License
-----

```
The MIT License (MIT)
Copyright (c) 2016 coderfox

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```


text:
#include <iostream>

#include <Poco/Net/SocketReactor.h>
#include <Poco/Net/SocketAcceptor.h>
#include <Poco/Net/SocketNotification.h>
#include <Poco/Net/StreamSocket.h>
#include <Poco/Net/ServerSocket.h>
#include <Poco/NObserver.h>
#include <Poco/Exception.h>
#include <Poco/Thread.h>
#include <Poco/Timespan.h>
#include <Poco/Util/Application.h>
#include <Poco/Util/ServerApplication.h>
#include <Poco/Util/Option.h>
#include <Poco/Util/OptionSet.h>
#include <Poco/Util/HelpFormatter.h>

const Poco::UInt16 PORT = 32452;

class Session {
public:
	Session(Poco::Net::StreamSocket& socket, Poco::Net::SocketReactor& reactor) :
		m_socket(socket),
		m_reactor(reactor)
	{
		m_peerAddress = socket.peerAddress().toString();
		//std::cout << "connection from " << m_peerAddress << " ..." << std::endl;
		auto& app = Poco::Util::Application::instance();
		app.logger().information("Connection from " + socket.peerAddress().toString());

		m_reactor.addEventHandler(m_socket,
			Poco::Observer<Session, Poco::Net::ReadableNotification>(*this, &Session::onReadable));

		m_reactor.addEventHandler(m_socket, Poco::Observer<Session, Poco::Net::ShutdownNotification>(*this, &Session::onShutdown)); // Event Handler when Socket was shutdown on the remote/peer side
		m_reactor.addEventHandler(m_socket, Poco::Observer<Session, Poco::Net::ErrorNotification>(*this, &Session::onError)); //Event Handler when Socket throws an error
		m_reactor.addEventHandler(m_socket, Poco::Observer<Session, Poco::Net::IdleNotification>(*this, &Session::onIdle)); //select 호출 때
		m_reactor.addEventHandler(m_socket, Poco::Observer<Session, Poco::Net::TimeoutNotification>(*this, &Session::onTimeout)); //select 호출 후 지정 시간까지 이벤트가 없을 때

	}

	~Session()
	{
		std::cout << m_peerAddress << " disconnected ..." << std::endl;
		m_reactor.removeEventHandler(m_socket,
			Poco::Observer<Session, Poco::Net::ReadableNotification>(*this, &Session::onReadable)
			);

		m_reactor.removeEventHandler(m_socket, Poco::Observer<Session, Poco::Net::ShutdownNotification>(*this, &Session::onShutdown));
		m_reactor.removeEventHandler(m_socket, Poco::Observer<Session, Poco::Net::ErrorNotification>(*this, &Session::onError));
		m_reactor.removeEventHandler(m_socket, Poco::Observer<Session, Poco::Net::IdleNotification>(*this, &Session::onIdle));
		m_reactor.removeEventHandler(m_socket, Poco::Observer<Session, Poco::Net::TimeoutNotification>(*this, &Session::onTimeout));
	}

	void onReadable(Poco::Net::ReadableNotification* pNf)
	{
		pNf->release();

		char buffer[256] = { 0, };
		int n = m_socket.receiveBytes(buffer, sizeof(buffer));
		if (n > 0)
		{
			std::cout << "클라이언트에서 받은 메시지: " << buffer << std::endl;

			char szSendMessage[256] = { 0, };
			sprintf_s(szSendMessage, 256 - 1, "Re:%s", buffer);
			int nMsgLen = (int)strnlen_s(szSendMessage, 256 - 1);

			m_socket.sendBytes(szSendMessage, nMsgLen);
		}
		else
		{
			m_socket.shutdownSend();
			delete this;
		}
	}

	void onShutdown(Poco::Net::ShutdownNotification* pNf)
	{
		pNf->release();
	}

	void onError(Poco::Net::ErrorNotification* pNf)
	{
		pNf->release();

		Poco::Util::Application::instance().logger().information("onError called");
	}

	void onTimeout(Poco::Net::TimeoutNotification* pNf)
	{
		pNf->release();
		//Application::instance().logger().information("onTimeout called");
	}

	void onIdle(Poco::Net::IdleNotification* pNf)
	{
		pNf->release();

		//Application::instance().logger().information("onIdle called");
	}

private:
	Poco::Net::StreamSocket   m_socket;
	std::string m_peerAddress;
	Poco::Net::SocketReactor& m_reactor;
};

class EchoServer : public Poco::Util::ServerApplication
{
public:
	EchoServer() : _helpRequested(false)
	{
	}

	~EchoServer()
	{
	}

protected:
	void initialize(Application& self)
	{
		loadConfiguration(); // 만약 설정 파일이 있다면 로딩한다.
		ServerApplication::initialize(self);
	}

	void uninitialize()
	{
		ServerApplication::uninitialize();
	}

	void defineOptions(Poco::Util::OptionSet& options)
	{
		ServerApplication::defineOptions(options);

		options.addOption(
			Poco::Util::Option("help", "h", "display help information on command line arguments")
			.required(false)
			.repeatable(false));
	}

	void handleOption(const std::string& name, const std::string& value)
	{
		ServerApplication::handleOption(name, value);

		if (name == "help")
			_helpRequested = true;
	}

	void displayHelp()
	{
		Poco::Util::HelpFormatter helpFormatter(options());
		helpFormatter.setCommand(commandName());
		helpFormatter.setUsage("OPTIONS");
		helpFormatter.setHeader("An echo server implemented using the Reactor and Acceptor patterns.");
		helpFormatter.format(std::cout);
	}

	int main(const std::vector<std::string>& args)
	{
		if (_helpRequested)
		{
			displayHelp();
		}
		else
		{
			auto port = (unsigned short)config().getInt("EchoServer.port", PORT);

			Poco::Net::ServerSocket svs(port);

			Poco::Timespan timeout(10,0);
			Poco::Net::SocketReactor reactor(timeout);
			Poco::Net::SocketAcceptor<Session> acceptor(svs, reactor);

			Poco::Thread thread;
			thread.start(reactor);

			// wait for CTRL-C or kill
			Poco::Util::ServerApplication::waitForTerminationRequest();

			// Stop the SocketReactor
			reactor.stop();
			thread.join();
		}

		return Application::EXIT_OK;
	}

private:
	bool _helpRequested;
};

int main(int argc, char** argv)
{
	EchoServer app;
	return app.run(argc, argv);
}


text:
package com.dada.pay.core;

public abstract class BaseService {

}


text:
#include "ResponseBody.h"

namespace swing
{
	namespace vscode
	{

	}
}


text:
package swarm.shared.structs;

import swarm.shared.utils.U_Bits;
import swarm.shared.app.BaseAppContext;
import swarm.shared.debugging.U_Debug;
import swarm.shared.entities.E_CodeSafetyLevel;
import swarm.shared.entities.E_CodeType;
import swarm.shared.json.A_JsonEncodable;
import swarm.shared.json.A_JsonFactory;
import swarm.shared.json.E_JsonKey;
import swarm.shared.json.I_JsonArray;
import swarm.shared.json.I_JsonObject;
import swarm.shared.json.JsonHelper;

public class Code extends A_JsonEncodable
{
	protected String m_rawCode;

	protected int m_standInFlags;

	protected E_CodeSafetyLevel m_safetyLevel;

	public Code(A_JsonFactory jsonFactory, I_JsonObject json, E_CodeType ... standInTypes)
	{
		super(jsonFactory, json);

		init(standInTypes);
	}

	public Code(String rawCode, E_CodeType ... standInTypes)
	{
		m_rawCode = rawCode;

		init(standInTypes);
	}

	public void setSafetyLevel(E_CodeSafetyLevel safetyLevel)
	{
		m_safetyLevel = safetyLevel;
	}

	public E_CodeSafetyLevel getSafetyLevel()
	{
		return m_safetyLevel;
	}

	private void addStandInType(E_CodeType standInType)
	{
		m_standInFlags |= U_Bits.calcOrdinalBit(standInType.ordinal());
	}

	private void init(E_CodeType[] standInTypes)
	{
		m_safetyLevel = m_safetyLevel == null? E_CodeSafetyLevel.NO_SANDBOX_STATIC : m_safetyLevel;

		if( standInTypes.length == 0 )
		{
			throw new RuntimeException("Code must have at least one stand-in type assigned.");
		}

		for( int i = 0; i < standInTypes.length; i++ )
		{
			addStandInType(standInTypes[i]);
		}
	}

	public String getRawCode()
	{
		return m_rawCode;
	}

	public boolean isStandInFor(E_CodeType type)
	{
		return (U_Bits.calcOrdinalBit(type.ordinal()) & m_standInFlags) != 0;
	}

	public int getStandInFlags()
	{
		return m_standInFlags;
	}

	public boolean isEmpty()
	{
		return m_rawCode == null || m_rawCode.length() == 0;
	}

	public int getRawCodeLength()
	{
		return isEmpty() ? 0 : m_rawCode.length();
	}

	@Override
	public void writeJson(I_JsonObject json_out, A_JsonFactory factory)
	{
		factory.getHelper().putString(json_out, E_JsonKey.rawCode, m_rawCode);
		factory.getHelper().putInt(json_out, E_JsonKey.standInFlags, m_standInFlags);
		factory.getHelper().putEnum(json_out, E_JsonKey.codeSafetyLevel, m_safetyLevel);
	}

	@Override
	public void readJson(I_JsonObject json, A_JsonFactory factory)
	{
		m_standInFlags = 0x0;

		m_rawCode = factory.getHelper().getString(json, E_JsonKey.rawCode);

		m_standInFlags = factory.getHelper().getInt(json, E_JsonKey.standInFlags);

		m_safetyLevel = factory.getHelper().getEnum(json, E_JsonKey.codeSafetyLevel, E_CodeSafetyLevel.values());
	}
}


text:
package com.flipkart.gradle.test;

/**
 * Created by imteyaz.khan on 22/09/17.
 */
public class MathUtil {
    public static int add(int no1,int no2) {
        return no1+no2;
    }
}


text:
package org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports;

import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.util.ArrayFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.GrTopStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;

/**
 * @author ilyas
 */
public interface GrImportStatement extends GrTopStatement {
  GrImportStatement[] EMPTY_ARRAY = new GrImportStatement[0];

  ArrayFactory<GrImportStatement> ARRAY_FACTORY = count -> count == 0 ? EMPTY_ARRAY : new GrImportStatement[count];

  @Nullable
  GrCodeReferenceElement getImportReference();

  @Nullable
  String getImportedName();

  boolean isOnDemand();

  boolean isStatic();

  boolean isAliasedImport();

  @NotNull
  GrModifierList getAnnotationList();

  @Nullable
  PsiClass resolveTargetClass();

  @Nullable
  PsiElement getAliasNameElement();
}


text:
package com.parakultura.familytree.familytreeserver.repositories;

import com.parakultura.familytree.familytreeserver.entities.FamilyMemberEntity;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

@SuppressWarnings("unused")
public interface FamilyMemberRepository extends CrudRepository<FamilyMemberEntity, Long> {
    List<FamilyMemberEntity> findByLastName(String name);
}


text:
curl   -H "X-HockeyAppToken: c42fd975a0c24b00ae1d43673f26d225"   https://rink.hockeyapp.net/api/2/apps/4c6931e7bcf5ad25dba351ee77c0db08/app_versions?include_build_urls=true > link.json

build=$(cat link.json | jq '.app_versions[0] .build_url')
build=${build#'"'}
build=${build%'"'}

echo Downloading app

curl -o logbook-debug.apk -O -L $build

aws devicefarm create-upload --project-arn arn:aws:devicefarm:us-west-2:110312683877:project:c288772b-c1e9-4aad-bc4d-1837a21c2cfb --name logbook-debug.apk --type ANDROID_APP > upload.json

apparn=$(cat upload.json | jq '.upload.arn')
apparn=${apparn#'"'}
apparn=${apparn%'"'}

uploadurl=$(cat upload.json | jq '.upload.url')
uploadurl=${uploadurl#'"'}
uploadurl=${uploadurl%'"'}

echo Uploading app

curl -T logbook-debug.apk $uploadurl

aws devicefarm create-upload --project-arn arn:aws:devicefarm:us-west-2:110312683877:project:c288772b-c1e9-4aad-bc4d-1837a21c2cfb --name zip-with-dependencies.zip --type APPIUM_JAVA_TESTNG_TEST_PACKAGE > upload.json

testarn=$(cat upload.json | jq '.upload.arn')
testarn=${testarn#'"'}
testarn=${testarn%'"'}

uploadurl=$(cat upload.json | jq '.upload.url')
uploadurl=${uploadurl#'"'}
uploadurl=${uploadurl%'"'}

echo Uploading test

curl -T /Users/kyletang/Desktop/aws_device_farm/target/zip-with-dependencies.zip $uploadurl

echo Waiting for 5 seconds

sleep 5

aws devicefarm schedule-run --project-arn arn:aws:devicefarm:us-west-2:110312683877:project:c288772b-c1e9-4aad-bc4d-1837a21c2cfb --app-arn $apparn --device-pool-arn arn:aws:devicefarm:us-west-2:110312683877:devicepool:c288772b-c1e9-4aad-bc4d-1837a21c2cfb/c208533b-12f6-40dc-9177-386891ef616b --test '{"type": "APPIUM_JAVA_TESTNG","testPackageArn":"'"$testarn"'"}'

echo Tests are running


text:
namespace PDC {

LinkTypeFactory::LinkTypeFactory()
{
}

PDC::LinkType* LinkTypeFactory::Create(std::string jointType,std::string linkTypeId)
{
    PDC::LinkType* linkType = NULL;
    if (jointType == "Prismatic")
    {
        linkType = new PDC::PrismaticLinkType(linkTypeId);
    }
    else if (jointType == "Revolute")
    {
        linkType = new PDC::RevoluteLinkType(linkTypeId);
    }
    return linkType;
}

} // namespace PDC


text:
[TOC]

## Overview

Enable support for a [USB-C] [PPC].

## Kconfig Options

The Kconfig option `CONFIG_PLATFORM_EC_USBC_PPC` enables the selection of a [PPC].
See the file [Kconfig.ppc] for all Kconfig options related to this feature.

## Devicetree Nodes

The `PPC` device tree nodes are defined in the [`DTS Bindings`] file for
each type of `PPC` that extends [ppc-chip.yaml]. The `PPC` device is added
to the corresponding I2C bus node and the "named-usbc-port" contains a
phandle to the `PPC` device.

## Board Specific Code

None required.

## Threads

PPC support does not enable any threads.

## Testing and Debugging

The [`I2C bus scan`] can be used to verify the PPC device can be accessed and
the `ppc_dump` console command can be used to dump the PPC register.

```
Usage: ppc_dump <USB-C port>
```

## Example

The Hoglin system uses the Silergy SYV682X PPC on USBC port 0.

```
CONFIG_PLATFORM_EC_USBC_PPC=y
CONFIG_PLATFORM_EC_USBC_PPC_SYV682X=y
```

```
port0@0 {
	compatible = "named-usbc-port";
	reg = <0>;
	ppc = <&ppc_port1>;
};

&i2c2_0 {
	ppc_port1: syv682x@41 {
		compatible = "silergy,syv682x";
		status = "okay";
		reg = <0x41>;
		frs_en_gpio = <&gpio_usb_c1_frs_en>;
	};
};
```

[USB-C]: ../usb-c.md
[PPC]: ../ec_terms.md#ppc
[`I2C bus scan`]: ./zephyr_i2c.md#Shell-Command_i2c
[Kconfig.ppc]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/Kconfig.ppc
[`DTS Bindings`]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/dts/bindings/usbc/ppc
[ppc-chip.yaml]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/dts/bindings/usbc/ppc-chip.yaml


text:
#!/usr/bin/env node

const Logger = require('modern-logger')

const { VERSION, VERSION_COMMIT, VERSION_BUILD_DATE } = process.env

Logger.configure({
  transports: {
    console: [
      {
        colorize: false,
        timestamp: false
      }
    ]
  }
})

if (VERSION && VERSION_COMMIT && VERSION_BUILD_DATE) {
  Logger.info(
    `Running version ${VERSION} from commit ${VERSION_COMMIT} built on ${VERSION_BUILD_DATE}`
  )
}

const Server = require('./server')

// shutdown gracefully
const shutdown = (exitStatus = 0) => {
  return Server.stop().finally(() => process.exit(exitStatus))
}

const logErrorAndShutdown = error => {
  return Logger.error(error).finally(() => shutdown(1))
}

process.on('SIGINT', shutdown)
process.on('SIGTERM', shutdown)
process.on('SIGHUP', shutdown) // reload
process.on('SIGABRT', () => process.exit(1)) // force immediate shutdown, i.e. systemd watchdog?
process.on('uncaughtException', logErrorAndShutdown)
process.on('unhandledRejection', logErrorAndShutdown)

Server.start()


text:
package com.hhx.manage.service.impl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hhx.manage.dao.CodeTableDAO;
import com.hhx.manage.dao.CollegeProductionDAO;
import com.hhx.manage.dao.RejectProDAO;
import com.hhx.manage.domain.Author;
import com.hhx.manage.domain.CodeTable;
import com.hhx.manage.domain.CollegeProPage;
import com.hhx.manage.domain.Production;
import com.hhx.manage.domain.Teacher;
import com.hhx.manage.service.CollegeProductionService;

@Service
public class CollegeProductionServiceImpl implements CollegeProductionService {

	@Resource
	private CollegeProductionDAO collegeProductionDAO;
	@Resource
	private CodeTableDAO codeTableDAO;
	@Resource
	private RejectProDAO rejectDao;

	@Override
	public List<CollegeProPage> collegeProPage(Map<String, Object> map) {

		Map<String, Map<Integer,String>> typeAndGroupMap=this.getProTypeAndGroupMap();
		 Map<Integer,String> typeMap=typeAndGroupMap.get("proType");
		 Map<Integer, String> groupMap=typeAndGroupMap.get("proGroup");

		List<CollegeProPage> collegeProPage = collegeProductionDAO.collegeProPage(map);
		String qteacher = (String) map.get("teacher");
		String qauthor = (String) map.get("author");
		List<CollegeProPage> collegeProViewList = new ArrayList<CollegeProPage>();
		if(!CollectionUtils.isEmpty(collegeProPage))
		for (CollegeProPage collegePro : collegeProPage) {
			String name = collegePro.getName();
			int indexOf = name.indexOf("-");
			String proCode = name.substring(0, indexOf);
			String proName = name.substring(indexOf + 1);
			collegePro.setProCode(proCode);
			collegePro.setProName(proName);
			collegePro.setGroupStr(groupMap.get(collegePro.getGroupid()));
			collegePro.setProType(typeMap.get(collegePro.getTypeid()));
			collegePro.setProNum("91000999".equals(collegePro.getProNum())?null:collegePro.getProNum());
			CodeTable codeInfo = codeTableDAO.getCodeInfo("pro_state", String.valueOf(collegePro.getState()));
			if(collegePro.getState()==2){
				collegePro.setRejectReason(rejectDao.getLatestRejReason(collegePro.getId()));
			}
			if(null!=map.get("state")&&"3".equals(map.get("state").toString())){
				 if(4==collegePro.getState()||5==collegePro.getState()||6==collegePro.getState()){
					 collegePro.setStateStr(codeInfo.getCodeName());
				 }else{
					 collegePro.setStateStr("入围决赛");
				 }
			}else{
				collegePro.setStateStr(codeInfo.getCodeName());
			}
			String author = collegePro.getAuthor();
			JSONArray authorJson = JSONArray.parseArray(author);
			Author author1 = JSONObject.toJavaObject((JSON)authorJson.get(0), Author.class);
			if (!StringUtils.isEmpty(qauthor)) {
				if (!author1.getAuthorname().contains(qauthor)) {
					continue;
				}
			}
			collegePro.setAuthor1(author1.getAuthorname());
			collegePro.setAuthor1Num(author1.getNum());
			StringBuilder otherAuthorInfo=new StringBuilder();
			for (Object object : authorJson) {
				Author tempAuthor= JSONObject.toJavaObject((JSON)object, Author.class);
				if(null!=tempAuthor&&(StringUtils.isEmpty(tempAuthor.getIsFirstAuth())||!"yes".equalsIgnoreCase(tempAuthor.getIsFirstAuth()))){
					otherAuthorInfo.append(otherAuthorInfo.length()>0?"</br>":"").append("姓名:").append(tempAuthor.getAuthorname()).append("  ").append("学号:").append(tempAuthor.getNum());
				}
			}
			collegePro.setOtherAuthor(otherAuthorInfo.toString());
			String teacher = collegePro.getTeacher();
			if (!teacher.equals("[]")) {
				JSONArray teacherJson = JSONArray.parseArray(teacher);
				Teacher teacherName1 = JSONObject.toJavaObject((JSON)teacherJson.get(0), Teacher.class);
				String teacherToQ="";
				teacherToQ=teacherToQ+teacherName1.getName();
				collegePro.setTeacher1(teacherName1.getName());
				try {
					Teacher teacherName2 = JSONObject.toJavaObject((JSON)teacherJson.get(1), Teacher.class);
					collegePro.setTeacher2(teacherName2.getName());
					teacherToQ=teacherToQ+","+teacherName2.getName();
				} catch (IndexOutOfBoundsException e) {

				}
				if (!StringUtils.isEmpty(qteacher)) {
					if (!teacherToQ.contains(qteacher)) {
						continue;
					}
				}
			}
			collegeProViewList.add(collegePro);
		}
		return collegeProViewList;
	}

	@Override
	public int collegeProPageCount(Map<String, Object> map) {
		return collegeProductionDAO.collegeProPageCount(map);
	}

	@Override
	public List<CollegeProPage> collegeProReportPage(Map<String, Object> map) {
		List<CollegeProPage> collegeProPage = collegeProductionDAO.collegeProReportPage(map);
		List<CollegeProPage> collegeProViewList = new ArrayList<CollegeProPage>();
		for (CollegeProPage collegePro : collegeProPage) {
			String name = collegePro.getName();
			int indexOf = name.indexOf("-");
			String proCode = name.substring(0, indexOf);
			String proName = name.substring(indexOf + 1);
			collegePro.setProCode(proCode);
			collegePro.setProName(proName);
			CodeTable codeInfo = codeTableDAO.getCodeInfo("pro_state", String.valueOf(collegePro.getState()));
			collegePro.setStateStr(codeInfo.getCodeName());
			String author = collegePro.getAuthor();
			JSONArray authorJson = JSONArray.parseArray(author);
			Author author1 = JSONObject.toJavaObject((JSON)authorJson.get(0), Author.class);
			collegePro.setAuthor1(author1.getAuthorname());
			String teacher = collegePro.getTeacher();
			if (!teacher.equals("[]")) {
				JSONArray teacherJson = JSONArray.parseArray(teacher);
				Teacher teacherName1 = JSONObject.toJavaObject((JSON)teacherJson.get(0), Teacher.class);
				collegePro.setTeacher1(teacherName1.getName());
				try {
					Teacher teacherName2 = JSONObject.toJavaObject((JSON)teacherJson.get(1), Teacher.class);
					collegePro.setTeacher2(teacherName2.getName());
				} catch (IndexOutOfBoundsException e) {

				}
			}
			collegeProViewList.add(collegePro);
		}
		return collegeProViewList;
	}

	@Override
	public int collegeProReportCount(Map<String, Object> map) {
		return collegeProductionDAO.collegeProReportCount(map);
	}

	@Override
	public int rejectProduction(Long proId) {
		Production production = new Production();
		production.setId(proId);
		production.setState((byte) 2);
		return collegeProductionDAO.rejectProduction(production);
	}

	@Override
	public int batchUpdateStudentWithMap(Map<String, Object> map) {
		return collegeProductionDAO.batchUpdateStudentWithMap(map);
	}

	@Override
	public List<CollegeProPage> collegeProReportXls(Map<String, Object> map) {
		List<CollegeProPage> collegeProPage = collegeProductionDAO.collegeProReportXls(map);
		List<CollegeProPage> collegeProViewList = new ArrayList<CollegeProPage>();
		for (CollegeProPage collegePro : collegeProPage) {
			String name = collegePro.getName();
			int indexOf = name.indexOf("-");
			String proCode = name.substring(0, indexOf);
			String proName = name.substring(indexOf + 1);
			collegePro.setProCode(proCode);
			collegePro.setProName(proName);
			CodeTable codeInfo = codeTableDAO.getCodeInfo("pro_state", String.valueOf(collegePro.getState()));
			collegePro.setStateStr(codeInfo.getCodeName());
			String author = collegePro.getAuthor();
			JSONArray authorJson = JSONArray.parseArray(author);
			Author author1 = JSONObject.toJavaObject((JSON)authorJson.get(0), Author.class);
			collegePro.setAuthor1(author1.getAuthorname());
			String teacher = collegePro.getTeacher();
			if (!teacher.equals("[]")) {
				JSONArray teacherJson = JSONArray.parseArray(teacher);
				Teacher teacherName1 = JSONObject.toJavaObject((JSON)teacherJson.get(0), Teacher.class);
				collegePro.setTeacher1(teacherName1.getName());
				try {
					Teacher teacherName2 = JSONObject.toJavaObject((JSON)teacherJson.get(1), Teacher.class);
					collegePro.setTeacher2(teacherName2.getName());
				} catch (IndexOutOfBoundsException e) {

				}
			}
			collegeProViewList.add(collegePro);
		}
		return collegeProViewList;
	}

	/**
	 * 拼装作品类型和组别的分装信息
	 * @return
	 */
	private Map<String, Map<Integer,String>> getProTypeAndGroupMap(){

		Map<String, Map<Integer,String>> resultMap=new HashMap<>();
		Map<Integer,String> proTypeMap=new HashMap<>(4);
		List<CodeTable> codeTypeList=codeTableDAO.getCodeInfoListByCodeType("pro_type");
		codeTypeList.forEach(code->{
			proTypeMap.put(Integer.valueOf(code.getCode()), code.getCodeName());
		});
		resultMap.put("proType", proTypeMap);
		Map<Integer,String> proGroupMap=new HashMap<>(3);
		proGroupMap.put(1, "高职");
		proGroupMap.put(3, "本科");
		proGroupMap.put(4, "研究生");
		resultMap.put("proGroup", proGroupMap);

		return resultMap;
	}
}


text:
FROM centos:7

MAINTAINER Joan Ordinas <jordinas@escoladeltreball.org>

# messages in english, assume xterm-like terminal...
ENV TZ=Europe/Andorra \
    LANG=en_US.UTF-8 \
    TERM=xterm-256color

# enable several locales
RUN localedef --quiet --inputfile /usr/share/i18n/locales/ca_ES@euro ca_ES.utf8; \
    localedef --quiet --inputfile /usr/share/i18n/locales/es_ES@euro es_ES.utf8;

# disable password for root
RUN echo 'root:' | chpasswd

# enable delta RPMs and add EPEL
RUN yum --assumeyes install deltarpm; \
    yum --quiet --assumeyes update; \
    yum --assumeyes install \
        epel-release \
        ; \
    yum clean all

# add apps specific packages
RUN yum --assumeyes install \
        python-pip \
        ; \
    yum clean all

# all apps listen to this port
EXPOSE 8080

# Not necessary, but...
RUN [ "mkdir", "/app" ]
WORKDIR /app

# vim:syntax=dockerfile:ai:sw=4:ts=4:et


text:
<?php
namespace Paranoia\Processor;

use Paranoia\ConfigurationInterface;
use Paranoia\ProcessorInterface;

abstract class AbstractProcessor implements ProcessorInterface
{
    /** @var \Paranoia\ConfigurationInterface  */
    private $config;

    public function __construct(ConfigurationInterface $config)
    {
        $this->config = $config;
    }

    /**
     * @return \Paranoia\ConfigurationInterface
     */
    protected function getConfig()
    {
        return $this->config;
    }
}


text:
Lagom services are described by an interface, known as a service descriptor.  This interface not only defines how the service is invoked and implemented, it also defines the metadata that describes how the interface is mapped down onto an underlying transport protocol.  Generally, the service descriptor, its implementation and consumption should remain agnostic to what transport is being used, whether that's REST, websockets, or some other transport.  Let's take a look at a simple descriptor:

@[hello-service](code/ServiceDescriptors.scala)

This descriptor defines a service with one call, the `sayHello` call. `sayHello` is a method that returns something of type [`ServiceCall`](api/com/lightbend/lagom/scaladsl/api/ServiceCall.html), this is a representation of the call that can be invoked when consuming the service, and implemented by the service itself.  This is what the interface looks like:

@[service-call](code/ServiceDescriptors.scala)

An important thing to note here is that invoking the `sayHello` method does not actually invoke the call, it simply gets a handle to the call, which can then be invoked using the `invoke` method.

[`ServiceCall`](api/com/lightbend/lagom/scaladsl/api/ServiceCall.html) takes two type parameters, `Request` and `Response`.  The `Request` parameter is the type of the incoming request message, and the `Response` parameter is the type of the outgoing response message.  In the example above, these are both `String`, so our service call just handles simple text messages.

While the `sayHello` method describes how the call will be programmatically invoked or implemented, it does not describe how this call gets mapped down onto the transport.  This is done by providing an implementation of the [`descriptor`](api/com/lightbend/lagom/scaladsl/api/Service.html#descriptor:Descriptor) call, whose interface is described by [`Service`](api/com/lightbend/lagom/scaladsl/api/Service.html).

You can see that we're returning a service named `hello`, and we're describing one call, the `sayHello` call.  Because this service is so simple, in this case we don't need to do anything more than simply passing the Service call `sayHello` defined above in the example as a method reference to the [`call`](api/com/lightbend/lagom/scaladsl/api/Service$.html#call[Request,Response]\(ScalaMethodServiceCall[Request,Response]\)\(MessageSerializer[Request,_],MessageSerializer[Response,_]\):Call[Request,Response]) method.

## Call identifiers

Each service call needs to have an identifier.  An identifier is used to provide routing information to the implementation of the client and the service, so that calls over the wire can be mapped to the appropriate call.  Identifiers can be a static name or path, or they can have dynamic components, where dynamic path parameters are extracted from the path and passed to the service call methods.

The simplest type of identifier is a name, and by default, that name is set to be the same name as the name of the method on the interface that implements it. In the example above, we've used the `call` method to create a service call with a name of `sayHello`. A custom name can also be supplied, by using the [`namedCall`](api/com/lightbend/lagom/scaladsl/api/Service$.html#namedCall[Request,Response]\(String,ScalaMethodServiceCall[Request,Response]\)\(MessageSerializer[Request,_],MessageSerializer[Response,_]\):Call[Request,Response]) method:

@[call-id-name](code/ServiceDescriptors.scala)

In this case, we've named it `hello`, instead of the default of `sayHello`.  When implemented using REST, this will mean this call will have a path of `/hello`.

### Path based identifiers

The second type of identifier is a path based identifier.  This uses a URI path and query string to route calls, and from it dynamic path parameters can optionally be extracted out.  They can be configured using the [`pathCall`](api/com/lightbend/lagom/scaladsl/api/Service$.html#pathCall[Request,Response]\(String,ScalaMethodServiceCall[Request,Response]\)\(MessageSerializer[Request,_],MessageSerializer[Response,_]\):Call[Request,Response]) method.

Dynamic path parameters are extracted from the path by declaring dynamic parts in the path.  These are prefixed with a colon, for example, a path of `/order/:id` has a dynamic part called `id`. Lagom will extract this parameter from the path, and pass it to the service call method. In order to convert it to the type accepted by the method, Lagom will use an implicitly provided [`PathParamSerializer`](api/com/lightbend/lagom/scaladsl/api/deser/PathParamSerializer.html).  Lagom includes many `PathParamSerializer`'s out of the box, such as for `String`, `Long`, `Int`, `Boolean` and `UUID`.  Here's an example of extracting a `long` parameter from the path and passing it to a service call:

@[call-long-id](code/ServiceDescriptors.scala)

Note that this time we're using an [eta-expanded](https://www.scala-lang.org/files/archive/spec/2.12/06-expressions.html#method-values) reference to the method. This is because the method takes a parameter.

Multiple parameters can of course be extracted out, these will be passed to your service call method in the order they are extracted from the URL:

@[call-complex-id](code/ServiceDescriptors.scala)

Query string parameters can also be extracted from the path, using a `&` separated list after a `?` at the end of the path.  For example, the following service call uses query string parameters to implement paging:

@[call-query-string-parameters](code/ServiceDescriptors.scala)

When you use `call`, `namedCall` or `pathCall`, if Lagom maps that down to REST, Lagom will make a best effort attempt to map it down to REST in a semantic fashion. So for example, if there is a request message it will use the `POST` method, whereas if there's none it will use `GET`.

### REST identifiers

The final type of identifier is a REST identifier. REST identifiers are designed to be used when creating semantic REST APIs.  They use both a path, as with the path based identifier, and a request method, to identify them.  They can be configured using the [`restCall`](api/com/lightbend/lagom/scaladsl/api/Service$.html#restCall[Request,Response]\(Method,String,ScalaMethodServiceCall[Request,Response]\)\(MessageSerializer[Request,_],MessageSerializer[Response,_]\):Call[Request,Response]) method:

@[call-rest](code/ServiceDescriptors.scala)

## Messages

Every service call in Lagom has a request message type and a response message type.  When the request or response message isn't used, the `akka.NotUsed` can be used in their place.  Request and response message types fall into two categories, strict and streamed.

### Strict messages

A strict message is a single message that can be represented by a simple Scala object, typically a case class.  The message will be buffered into memory, and then parsed, for example, as JSON.  When both message types are strict, the call is said to be a synchronous call, that is, a request is sent and received, then a response is sent and received.  The caller and callee have synchronized in their communication.

So far, all of the service call examples we've seen have used strict messages, for example, the order service descriptors above accept and return items and orders.  The input value is passed directly to the service call, and returned directly from the service call, and these values are serialized to a JSON buffer in memory before being sent, and read entirely into memory before being deserialized back from JSON.

### Streamed messages

A streamed message is a message of type [`Source`](https://doc.akka.io/api/akka/2.6/akka/stream/scaladsl/Source.html). `Source` is an [Akka streams](https://doc.akka.io/docs/akka/2.6/stream/?language=scala) API that allows asynchronous streaming and handling of messages.  Here's an example streamed service call:

@[call-stream](code/ServiceDescriptors.scala)

This service call has a strict request type and a streamed response type.  An implementation of this might return a `Source` that sends the input tick message `String` at the specified interval.

A bidirectional streamed call might look like this:

@[hello-stream](code/ServiceDescriptors.scala)

In this case, the server might return a `Source` that converts every message received in the request stream to messages prefixed with `Hello`.

Lagom will choose an appropriate transport for the stream, typically, this will be WebSockets.  The WebSocket protocol supports bidirectional streaming, so is a good general purpose option for streaming.  When only one of the request or response message is streamed, Lagom will implement the sending and receiving of the strict message by sending or receiving a single message, and then leaving the WebSocket open until the other direction closes.  Otherwise, Lagom will close the WebSocket when either direction closes.

### Message serialization

Message serializers for requests and responses are provided using type classes.  Each of the `call`, `namedCall`, `pathCall` and `restCall` methods take an implicit [`MessageSerializer`](api/com/lightbend/lagom/scaladsl/api/deser/MessageSerializer.html) for each of the request and response messages. Out of the box Lagom provides a serializer for `String` messages, as well as serializers that implicitly convert a Play JSON [`Format`](https://www.playframework.com/documentation/2.8.x/api/scala/play/api/libs/json/Format.html) type class to a message serializer.

#### Using Play JSON

Play JSON provides a functional type class based library for composing JSON formatters. For detailed documentation on how to use this library, see the [Play documentation](https://www.playframework.com/documentation/2.8.x/ScalaJsonCombinators). For now, we will just look at how to define JSON formats for case classes using Play's JSON format macro.

Let's say you have a `User` case class that looks like this:

@[user-class](code/ServiceDescriptors.scala)

A Play JSON format can be defined on the `User` companion object like so:

@[user-format](code/ServiceDescriptors.scala)

This format will generate and parse JSON in the following format:

```json
{
  "id": 12345,
  "name": "John Smith",
  "email": "john.smith@example.org"
}
```

Fields can be made optional by making them of type `Option`, this will mean the format will not fail to parse the JSON if the property is not present, and when it generates JSON, it will simply not generate that property.

By defining the format on the `User` companion object, we can ensure that this format will be automatically used whenever it is required, due to Scala's implicit scoping rules. This means that aside from declaring the format, no further work needs to be done to ensure that this format will be used for the `MessageSerializer`.

Note that if your case class references another, non primitive type, such as another case class, you'll need to also define a format for that case class.

#### Writing custom message serializers

You can also write custom message serializers, for example, to use protocol buffers or other message format types.  For more information, see the [[message serializers documentation|MessageSerializers]].


text: exec sp_rename '[person]', 'person';


text:
require 'test_helper'

class I18nSimpleBackendApiTest < Test::Unit::TestCase
  class Backend < I18n::Backend::Simple
    include I18n::Backend::Pluralization
  end

  def setup
    I18n.backend = I18n::Backend::Simple.new
    super
  end

  include I18n::Tests::Basics
  include I18n::Tests::Defaults
  include I18n::Tests::Interpolation
  include I18n::Tests::Link
  include I18n::Tests::Lookup
  include I18n::Tests::Pluralization
  include I18n::Tests::Procs
  include I18n::Tests::Localization::Date
  include I18n::Tests::Localization::DateTime
  include I18n::Tests::Localization::Time
  include I18n::Tests::Localization::Procs

  test "make sure we use the Simple backend" do
    assert_equal I18n::Backend::Simple, I18n.backend.class
  end
end


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--Generated by DS Annotation Builder [src/com/kuebler/osgi/ds/equinox/EquinoxAppConfigurator.java]-->
<scr:component name="com.kuebler.osgi.ds.equinox.EquinoxAppConfigurator" activate="activate" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
    <reference name="ConfigAdmin" interface="org.osgi.service.cm.ConfigurationAdmin" cardinality="1..1" policy="dynamic" bind="bindConfigAdmin" unbind="unbindConfigAdmin"/>
    <implementation class="com.kuebler.osgi.ds.equinox.EquinoxAppConfigurator"/>
</scr:component>