You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jm...@apache.org on 2004/08/27 05:26:40 UTC
cvs commit: jakarta-commons-sandbox/resources/contrib/src/java/org/apache/commons/resources/impl DatabaseBasicMessage.java
jmitchell 2004/08/26 20:26:40
Added: resources/contrib/src/java/org/apache/commons/resources/impl
DatabaseBasicMessage.java
Log:
Move to contrib due to lgpl license restrictions
Revision Changes Path
1.1 jakarta-commons-sandbox/resources/contrib/src/java/org/apache/commons/resources/impl/DatabaseBasicMessage.java
Index: DatabaseBasicMessage.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons-sandbox/resources/contrib/src/java/org/apache/commons/resources/impl/DatabaseBasicMessage.java,v 1.1 2004/08/27 03:26:40 jmitchell Exp $
* $Revision: 1.1 $
* $Date: 2004/08/27 03:26:40 $
*
* ====================================================================
*
* Copyright 2003-2004 The Apache Software Foundation
*
* 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 org.apache.commons.resources.impl;
/**
* BasicMessage to allow standard Hibernate
* configuration (no complex keys).
*
* @author James Mitchell
*
*/
public class DatabaseBasicMessage extends BasicMessage {
public DatabaseBasicMessage() {
super();
}
/**
*
* @param id The id (primary key) for this message.
* @param locale The locale used to retrieve the value for the specified key
* @param key The key for this message.
* @param value The value for this message.
*/
public DatabaseBasicMessage(String locale, String key, Object[] values) {
super(key, values);
this.locale = locale;
}
private String locale = null;
/**
* @return Returns the locale.
*/
public String getLocale() {
return locale;
}
/**
* @param locale The locale to set.
*/
public void setLocale(String locale) {
this.locale = locale;
}
public void setKey(String key) {
this.key = key;
}
public void setValue(String value) {
this.values = new String[]{value};
}
public String getValue() {
if (values == null || values.length < 1) {
throw new IllegalStateException("The retrived value for msg " +
this.key + "was null");
}
if (values.length > 1) {
throw new IllegalStateException("There were more than one values " +
"retrived value for msg " +
this.key);
}
return (String)getValues()[0];
}
public boolean equals(Object obj) {
if (obj instanceof DatabaseBasicMessage){
if (((DatabaseBasicMessage)obj).getKey().equals(this.key) &&
((DatabaseBasicMessage)obj).getLocale().equals(this.locale)){
return true;
}
}
return false;
}
public int hashCode() {
return super.hashCode();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org