All Downloads are FREE. Search and download functionalities are using the official Maven repository.

no.entur.mapstruct.example.EnumPostfixOverrideMapperImpl Maven / Gradle / Ivy

package no.entur.mapstruct.example;

/*-
 * #%L
 * protobuf-usage
 * %%
 * Copyright (C) 2019 - 2024 Entur
 * %%
 * Licensed under the EUPL, Version 1.1 or – as soon they will be
 * approved by the European Commission - subsequent versions of the
 * EUPL (the "Licence");
 * 
 * You may not use this work except in compliance with the Licence.
 * You may obtain a copy of the Licence at:
 * 
 * http://ec.europa.eu/idabc/eupl5
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the Licence is distributed on an "AS IS" basis,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the Licence for the specific language governing permissions and
 * limitations under the Licence.
 * #L%
 */

import no.entur.mapstruct.spi.protobuf.EnumPostfixOverrideValues;

/*
@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2024-11-22T07:51:22+0000",
    comments = "version: 1.6.3, compiler: javac, environment: Java 18.0.2 (Eclipse Adoptium)"
)
*/
public class EnumPostfixOverrideMapperImpl implements EnumPostfixOverrideMapper {

    @Override
    public EnumPostfixOverrideProtos.EnumPostfixOverrideValuesDTO map(EnumPostfixOverrideValues value) {
        if ( value == null ) {
            return EnumPostfixOverrideProtos.EnumPostfixOverrideValuesDTO.ENUM_POSTFIX_OVERRIDE_VALUES_D_T_O_INVALID;
        }

        EnumPostfixOverrideProtos.EnumPostfixOverrideValuesDTO enumPostfixOverrideValuesDTO;

        switch ( value ) {
            case ONE: enumPostfixOverrideValuesDTO = EnumPostfixOverrideProtos.EnumPostfixOverrideValuesDTO.ENUM_POSTFIX_OVERRIDE_VALUES_D_T_O_ONE;
            break;
            case TWO: enumPostfixOverrideValuesDTO = EnumPostfixOverrideProtos.EnumPostfixOverrideValuesDTO.ENUM_POSTFIX_OVERRIDE_VALUES_D_T_O_TWO;
            break;
            default: throw new IllegalArgumentException( "Unexpected enum constant: " + value );
        }

        return enumPostfixOverrideValuesDTO;
    }

    @Override
    public EnumPostfixOverrideValues map(EnumPostfixOverrideProtos.EnumPostfixOverrideValuesDTO dto) {
        if ( dto == null ) {
            return null;
        }

        EnumPostfixOverrideValues enumPostfixOverrideValues;

        switch ( dto ) {
            case ENUM_POSTFIX_OVERRIDE_VALUES_D_T_O_INVALID: enumPostfixOverrideValues = null;
            break;
            case ENUM_POSTFIX_OVERRIDE_VALUES_D_T_O_ONE: enumPostfixOverrideValues = EnumPostfixOverrideValues.ONE;
            break;
            case ENUM_POSTFIX_OVERRIDE_VALUES_D_T_O_TWO: enumPostfixOverrideValues = EnumPostfixOverrideValues.TWO;
            break;
            case UNRECOGNIZED: enumPostfixOverrideValues = null;
            break;
            default: throw new IllegalArgumentException( "Unexpected enum constant: " + dto );
        }

        return enumPostfixOverrideValues;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy