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

net.projectmonkey.object.mapper.analysis.duplicates.PropertyPathAndTokens Maven / Gradle / Ivy

Go to download

Object mapping implementation written as an alternative to modelmapper which is able to support inheritance, handles flattening / expanding in a precise way, and is extensible / configurable

The newest version!
package net.projectmonkey.object.mapper.analysis.duplicates;

/*
 *
 *  * Copyright 2012 the original author or authors.
 *  *
 *  * Licensed under the Apache License, Version 2.0 (the "License");
 *  * you may not use this file except in compliance with the License.
 *  * You may obtain a copy of the License at
 *  *
 *  *      http://www.apache.org/licenses/LICENSE-2.0
 *  *
 *  * Unless required by applicable law or agreed to in writing, software
 *  * distributed under the License is distributed on an "AS IS" BASIS,
 *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  * See the License for the specific language governing permissions and
 *  * limitations under the License.
 *
 */

import net.projectmonkey.object.mapper.analysis.result.PropertyPath;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Andy Moody
 */
public class PropertyPathAndTokens
{

	private final PropertyPath path;
	private final List> tokens;

	public PropertyPathAndTokens()
	{
		this(null, new ArrayList>());
	}

	/**
	 * @param path - the path to the final destination property
	 * @param tokens - the tokens representing the matching part of the hierarchy.
	 *               Each element in the array should represent the tokens for a property
	 *               at one level of the hierarchy.
	 */
	public PropertyPathAndTokens(PropertyPath path, List> tokens)
	{
		this.path = path;
		this.tokens = tokens;
	}

	public PropertyPath getPath()
	{
		return path;
	}

	public List> getTokens()
	{
		return tokens;
	}

	@Override
	public boolean equals(final Object o)
	{
		if (this == o)
		{
			return true;
		}
		if (!(o instanceof PropertyPathAndTokens))
		{
			return false;
		}

		PropertyPathAndTokens that = (PropertyPathAndTokens) o;

		if (path != null ? !path.equals(that.path) : that.path != null)
		{
			return false;
		}
		if (tokens != null ? !tokens.equals(that.tokens) : that.tokens != null)
		{
			return false;
		}

		return true;
	}

	@Override
	public int hashCode()
	{
		int result = path != null ? path.hashCode() : 0;
		result = 31 * result + (tokens != null ? tokens.hashCode() : 0);
		return result;
	}

	@Override
	public String toString()
	{
		return "PropertyPathAndTokens{" +
				"path=" + path +
				'}';
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy