1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
/*****************************************************************************
* Java Plug-in Framework (JPF)
* Copyright (C) 2006-2007 Dmitry Olshansky
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
package org.java.plugin.tools.mocks;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import org.java.plugin.registry.ExtensionPoint;
import org.java.plugin.registry.ParameterMultiplicity;
import org.java.plugin.registry.ParameterType;
import org.java.plugin.registry.ExtensionPoint.ParameterDefinition;
/**
* @version $Id$
*/
public class MockParameterDefinition
extends MockPluginElement<ParameterDefinition>
implements ParameterDefinition {
private String customData;
private ExtensionPoint declaringExtensionPoint;
private String defaultValue;
private ParameterMultiplicity multiplicity;
private ParameterType type;
private ParameterDefinition superDefinition;
private LinkedList<ParameterDefinition> subDefinitions = new LinkedList<ParameterDefinition>();
/**
* @see org.java.plugin.registry.ExtensionPoint.ParameterDefinition#getCustomData()
*/
public String getCustomData() {
return customData;
}
/**
* @param value the custom data to set
* @return this instance
*/
public MockParameterDefinition setCustomData(final String value) {
customData = value;
return this;
}
/**
* @see org.java.plugin.registry.ExtensionPoint.ParameterDefinition#getDeclaringExtensionPoint()
*/
public ExtensionPoint getDeclaringExtensionPoint() {
return declaringExtensionPoint;
}
/**
* @param value the declaring extension point to set
* @return this instance
*/
public MockParameterDefinition setDeclaringExtensionPoint(
final ExtensionPoint value) {
declaringExtensionPoint = value;
return this;
}
/**
* @see org.java.plugin.registry.ExtensionPoint.ParameterDefinition#getDefaultValue()
*/
public String getDefaultValue() {
return defaultValue;
}
/**
* @param value the default value to set
* @return this instance
*/
public MockParameterDefinition setDefaultValue(final String value) {
defaultValue = value;
return this;
}
/**
* @see org.java.plugin.registry.ExtensionPoint.ParameterDefinition#getMultiplicity()
*/
public ParameterMultiplicity getMultiplicity() {
return multiplicity;
}
/**
* @param value the multiplicity to set
* @return this instance
*/
public MockParameterDefinition setMultiplicity(
final ParameterMultiplicity value) {
multiplicity = value;
return this;
}
/**
* @see org.java.plugin.registry.ExtensionPoint.ParameterDefinition#getSubDefinition(java.lang.String)
*/
public ParameterDefinition getSubDefinition(String id) {
for (ParameterDefinition paramDef : subDefinitions) {
if (paramDef.getId().equals(id)) {
return paramDef;
}
}
throw new IllegalArgumentException(
"unknown parameter definition ID " + id); //$NON-NLS-1$
}
/**
* @see org.java.plugin.registry.ExtensionPoint.ParameterDefinition#getSubDefinitions()
*/
public Collection<ParameterDefinition> getSubDefinitions() {
return Collections.unmodifiableCollection(subDefinitions);
}
/**
* @param parameterDefinition sub-parameter definition to add
* @return this instance
*/
public MockParameterDefinition addSubDefinition(
final ParameterDefinition parameterDefinition) {
subDefinitions.add(parameterDefinition);
return this;
}
/**
* @see org.java.plugin.registry.ExtensionPoint.ParameterDefinition#getSuperDefinition()
*/
public ParameterDefinition getSuperDefinition() {
return superDefinition;
}
/**
* @param value the super definition to set
* @return this instance
*/
public MockParameterDefinition setSuperDefinition(
final ParameterDefinition value) {
superDefinition = value;
return this;
}
/**
* @see org.java.plugin.registry.ExtensionPoint.ParameterDefinition#getType()
*/
public ParameterType getType() {
return type;
}
/**
* @param value the type to set
* @return this instance
*/
public MockParameterDefinition setType(final ParameterType value) {
type = value;
return this;
}
}
|