001: /*
002: * Copyright 2006 Holger West, Ralf Joachim
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package log4j;
017:
018: /**
019: * A <code>LogReferenceExtension</code> for saving a reference to another object. Use in
020: * that way e.g.: <code>LOG.warn(object)</code>.
021: *
022: * <p> To write your own extension, the following requirements has to be fulfilled:
023: * 1. The customized class must extend the <code>LogEntry</code> class.
024: * 2. A table in the database must be created.
025: * 3. The castor mapping file must be customized for the new class. As base the existing
026: * one can be used.
027: *
028: * @author <a href="mailto:holger.west@syscon-informatics.de">Holger West</a>
029: */
030: public final class LogReferenceExtension extends LogEntry {
031: // -----------------------------------------------------------------------------------
032:
033: /** The type this object references to. */
034: private String _type;
035:
036: /** The value this object references to. */
037: private String _value;
038:
039: // -----------------------------------------------------------------------------------
040:
041: /**
042: * Default constructor.
043: */
044: public LogReferenceExtension() {
045: super ();
046: }
047:
048: /**
049: * Construct a new <code>LogReferenceExtension</code> with the given message, type
050: * and value.
051: *
052: * @param message The message to set for this object.
053: * @param type The type this oject references to.
054: * @param value The value this object references to.
055: */
056: public LogReferenceExtension(final String message,
057: final String type, final String value) {
058:
059: super (message);
060: _type = type;
061: _value = value;
062: }
063:
064: // -----------------------------------------------------------------------------------
065:
066: /**
067: * Get the type this object references to.
068: *
069: * @return The type this object references to.
070: */
071: public String getType() {
072: return _type;
073: }
074:
075: /**
076: * Set the type this object references to.
077: *
078: * @param type The type this object references to.
079: */
080: public void setType(final String type) {
081: _type = type;
082: }
083:
084: /**
085: * Get the value this object references to.
086: *
087: * @return The value this object references to.
088: */
089: public String getValue() {
090: return _value;
091: }
092:
093: /**
094: * Set the value this object references to.
095: *
096: * @param value The value this object references to.
097: */
098: public void setValue(final String value) {
099: _value = value;
100: }
101:
102: // -----------------------------------------------------------------------------------
103: }
|