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

com.itshidu.ffmpeg.modelmapper.NotDefaultCondition Maven / Gradle / Ivy

The newest version!
package com.itshidu.ffmpeg.modelmapper;

import com.google.common.base.Defaults;
import com.google.common.base.Objects;
import com.google.errorprone.annotations.Immutable;
import org.modelmapper.Condition;
import org.modelmapper.spi.MappingContext;

/**
 * Only maps properties which are not their type's default value.
 *
 * @param  source type
 * @param  destination type
 * @author bramp
 */
@Immutable
public class NotDefaultCondition implements Condition {

  public static final NotDefaultCondition notDefault = new NotDefaultCondition<>();

  @Override
  public boolean applies(MappingContext context) {
    return !Objects.equal(context.getSource(), Defaults.defaultValue(context.getSourceType()));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy