
br.com.objectos.comuns.io.ColumnKey Maven / Gradle / Ivy
/*
* Copyright 2012 Objectos, Fábrica de Software LTDA.
*
* 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.
*/
package br.com.objectos.comuns.io;
import java.util.Objects;
/**
* @author [email protected] (Marcio Endo)
*/
public class ColumnKey {
private final Class type;
private final String name;
public ColumnKey(Class type, String name) {
this.type = Objects.requireNonNull(type, "type");
this.name = name;
}
public Class getType() {
return type;
}
public static ColumnKey of(Class type) {
return new ColumnKey(type, null);
}
public static ColumnKey of(Class type, String name) {
return new ColumnKey(type, name);
}
@Override
public String toString() {
return "ColumnKey=" + type.toString() + "=" + name;
}
@Override
public final int hashCode() {
return Objects.hash(type, name);
}
@Override
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ColumnKey) {
final ColumnKey> that = (ColumnKey>) obj;
return Objects.equals(this.type, that.type)
&& Objects.equals(this.name, that.name);
} else {
return false;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy