001: /*
002: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
007: *
008: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
009: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
010: * the license for the specific language governing your rights and limitations.
011: *
012: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
013: */
014: package org.pentaho.reportdesigner.crm.report.datasetplugin.properties;
015:
016: import org.jetbrains.annotations.NotNull;
017: import org.jetbrains.annotations.Nullable;
018:
019: /**
020: * User: Martin
021: * Date: 16.02.2006
022: * Time: 16:16:32
023: */
024: public class PropertyInfo implements Comparable<Object> {
025: @NotNull
026: private String key;
027: @NotNull
028: private Class<?> clazz;
029: @Nullable
030: private Object value;
031:
032: public PropertyInfo(@NotNull
033: String key, @NotNull
034: Class<?> clazz, @Nullable
035: Object value) {
036: this .key = key;
037: this .clazz = clazz;
038: this .value = value;
039: }
040:
041: @NotNull
042: public String getKey() {
043: return key;
044: }
045:
046: public void setKey(@NotNull
047: String key) {
048: this .key = key;
049: }
050:
051: @NotNull
052: public Class<?> getClazz() {
053: return clazz;
054: }
055:
056: public void setClazz(@NotNull
057: Class<?> clazz) {
058: this .clazz = clazz;
059: }
060:
061: @Nullable
062: public Object getValue() {
063: return value;
064: }
065:
066: public void setValue(@Nullable
067: Object value) {
068: this .value = value;
069: }
070:
071: public boolean equals(@Nullable
072: Object o) {
073: if (this == o)
074: return true;
075: if (o == null || getClass() != o.getClass())
076: return false;
077:
078: PropertyInfo that = (PropertyInfo) o;
079:
080: if (!clazz.equals(that.clazz))
081: return false;
082: return key.equals(that.key);
083: }
084:
085: public int hashCode() {
086: int result;
087: result = key.hashCode();
088: result = 31 * result + clazz.hashCode();
089: return result;
090: }
091:
092: public int compareTo(@Nullable
093: Object o) {
094: if (o instanceof PropertyInfo) {
095: PropertyInfo propertyInfo = (PropertyInfo) o;
096: return key.compareTo(propertyInfo.key);
097: }
098: return 0;
099: }
100: }
|