
com.univocity.api.engine.NameMatcher Maven / Gradle / Ivy
Show all versions of univocity-api Show documentation
/*******************************************************************************
* Copyright (c) 2013 uniVocity Software Pty Ltd. All rights reserved.
* This file is subject to the terms and conditions defined in file
* 'LICENSE.txt', which is part of this source code package.
******************************************************************************/
package com.univocity.api.engine;
import com.univocity.api.config.builders.*;
/**
* A NameMatcher
provides a custom implementation for automatic detection of mappings based on entity names.
*
* By default, {@link DataStoreMapping#autodetectMappings()} and {@link EntityMapping#autodetectMappings()} will automatically
* create associations between entities and their fields based on their names.
* Entities with similar names will be automatically associated. Underscores and spaces are ignored, for example: entity1
will
* be associated with ENTITY 1
or ENTITY_1
*
* To override this behavior and provide a custom auto detection mechanism,
* {@link DataStoreMapping#autodetectMappings(NameMatcher, NameMatcher)} and {@link EntityMapping#autodetectMappings(NameMatcher)}
* accept an implementation of NameMatcher
.
*
* @see DataStoreMapping
* @see EntityMapping
*
* @author uniVocity Software Pty Ltd - [email protected]
*
*/
public interface NameMatcher {
/**
* Identifies whether two entity or field names match and should be associated with each other automatically.
* @param nameInSource the name in the source
* @param nameInDestination the name in the destination
* @return {@code true} if the entity of field name in source must be mapped to the entity or field name in the destination, otherwise {@code false}.
*/
public boolean matches(String nameInSource, String nameInDestination);
}