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

com.speedment.jpastreamer.field.internal.method.GetCharImpl Maven / Gradle / Ivy

/*
 * JPAstreamer - Express JPA queries with Java Streams
 * Copyright (c) 2020-2020, Speedment, Inc. All Rights Reserved.
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * See: https://github.com/speedment/jpa-streamer/blob/master/LICENSE
 */
package com.speedment.jpastreamer.field.internal.method;

import com.speedment.jpastreamer.field.method.CharGetter;
import com.speedment.jpastreamer.field.method.GetChar;
import com.speedment.jpastreamer.field.trait.HasCharValue;

import static java.util.Objects.requireNonNull;

/**
 * Default implementation of the {@link GetChar}-interface.
 * 
 * @param  the entity type
 *
 * @author Emil Forslund
 * @since  3.0.2
 */
public final class GetCharImpl implements GetChar {
    
    private final HasCharValue field;
    private final CharGetter getter;
    
    public GetCharImpl(HasCharValue field, CharGetter getter) {
        this.field  = requireNonNull(field);
        this.getter = requireNonNull(getter);
    }
    
    @Override
    public HasCharValue getField() {
        return field;
    }
    
    @Override
    public char applyAsChar(ENTITY instance) {
        return getter.applyAsChar(instance);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy