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

com.remondis.remap.Projection Maven / Gradle / Ivy

There is a newer version: 4.3.7
Show newest version
package com.remondis.remap;

/**
 * This class defines a projection from a type to another type.
 *
 * @param 
 *          The source type
 * @param 
 *          The destination type
 * @author schuettec
 *
 */
class Projection {

  private Class source;
  private Class destination;

  Projection(Class source, Class destination) {
    super();
    this.source = source;
    this.destination = destination;
  }

  /**
   * @return the source
   */
  public Class getSource() {
    return source;
  }

  /**
   * @return the destination
   */
  public Class getDestination() {
    return destination;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((destination == null) ? 0 : destination.hashCode());
    result = prime * result + ((source == null) ? 0 : source.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    @SuppressWarnings("rawtypes")
    Projection other = (Projection) obj;
    if (destination == null) {
      if (other.destination != null)
        return false;
    } else if (!destination.equals(other.destination))
      return false;
    if (source == null) {
      if (other.source != null)
        return false;
    } else if (!source.equals(other.source))
      return false;
    return true;
  }

  @Override
  public String toString() {
    return "Projection [source=" + source + ", destination=" + destination + "]";
  }

}