001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package com.sun.rave.web.ui.component.util.event;
042:
043: /**
044: * <P> This class holds OutputMapping value meta information for individual
045: * instances of Handler Objects. This information is necessary to provide
046: * the location to store the output value for a specific invocation of a
047: * handler. This is data consists of the name the Handler uses for the
048: * output, the OutputType, and optionally the OutputType key to use when
049: * storing/retrieving the output value.</P>
050: *
051: * @author Ken Paulsen (ken.paulsen@sun.com)
052: */
053: public class OutputMapping implements java.io.Serializable {
054:
055: /**
056: * <P> Constructor with targetKey as null. This constructor will
057: * throw an IllegalArgumentException if outputName or targetOutputType is
058: * null.</P>
059: *
060: * @param outputName The name the Handler uses for output value
061: * @param targetOutputType OutputType that will store the output value
062: *
063: * @see OutputTypeManager
064: *
065: * @throws IllegalArumentException If outputName or targetOutputType is null
066: */
067: public OutputMapping(String outputName, String targetOutputType) {
068: this (outputName, null, targetOutputType);
069: }
070:
071: /**
072: * <P> Constructor with all values supplied as Strings. This constructor
073: * will throw an IllegalArgumentException if outputName or
074: * targetOutputType is null.</P>
075: *
076: * @param outputName The name the Handler uses for output value
077: * @param targetKey The key the OutputType will use
078: * @param targetOutputType OutputType that will store the output value
079: *
080: * @see OutputTypeManager
081: *
082: * @throws IllegalArumentException If outputName or targetOutputType is null
083: */
084: public OutputMapping(String outputName, String targetKey,
085: String targetOutputType) {
086: // Sanity checks...
087: if ((outputName == null) || (outputName.length() == 0)) {
088: throw new NullPointerException("'outputName' is required!");
089: }
090: if (targetOutputType == null) {
091: throw new NullPointerException(
092: "'targetOutputType' is required!");
093: }
094: _outputName = outputName;
095: _targetKey = targetKey;
096: _targetOutputType = targetOutputType;
097: }
098:
099: /**
100: * <P> Constructor with all the values passed in. This constructor will
101: * throw an IllegalArgumentException if outputName or
102: * targetOutputType is null.</P>
103: *
104: * @param outputName The name the Handler uses for output value
105: * @param targetKey The key the OutputType will use
106: * @param targetOutputType OutputType that will store the output value
107: *
108: * @see OutputTypeManager
109: *
110: * @throws IllegalArumentException If outputName or
111: * targetOutputType is null
112: public OutputMapping(String outputName, String targetKey, OutputType targetOutputType) {
113: _outputName = outputName;
114: _targetKey = targetKey;
115: _targetOutputType = targetOutputType;
116: }
117: */
118:
119: /**
120: * Accessor for outputName.
121: */
122: public String getOutputName() {
123: return _outputName;
124: }
125:
126: /**
127: * Accessor for targetKey.
128: */
129: public String getOutputKey() {
130: return _targetKey;
131: }
132:
133: /**
134: * Accessor for targetOutputType.
135: */
136: public OutputType getOutputType() {
137: return OutputTypeManager.getInstance().getOutputType(
138: _targetOutputType);
139: }
140:
141: private String _outputName = null;
142: private String _targetKey = null;
143: private String _targetOutputType = null;
144: }
|