[Minor] Code formatting

This commit is contained in:
Robert von Burg 2014-03-31 21:37:13 +02:00
parent 6ae9cbf866
commit c8cedae647
3 changed files with 100 additions and 82 deletions

View File

@ -49,7 +49,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Default Constructor
*
*
* @param id
* @param name
* @param type
@ -66,8 +66,9 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Sets the type of this {@link GroupedParameterizedElement}
*
* @param type the type to set
*
* @param type
* the type to set
*/
public void setType(String type) {
if (StringHelper.isEmpty(type)) {
@ -82,10 +83,12 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the given bagKey, or null if
* the {@link Parameter} or the {@link ParameterBag} does not exist
*
* @param bagKey the key of the {@link ParameterBag} from which the {@link Parameter} is to be returned
* @param paramKey the key of the {@link Parameter} which is to be returned
*
*
* @param bagKey
* the key of the {@link ParameterBag} from which the {@link Parameter} is to be returned
* @param paramKey
* the key of the {@link Parameter} which is to be returned
*
* @return the found {@link Parameter} or null if it was not found
*/
public <T> T getParameter(String bagKey, String paramKey) {
@ -102,11 +105,14 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Adds a new {@link Parameter} to the {@link ParameterBag} with the given key
*
* @param bagKey the key of the {@link ParameterBag} to which the {@link Parameter} should be added
* @param parameter the {@link Parameter} to be added to the {@link ParameterBag}
*
* @throws StrolchException if the {@link ParameterBag} does not exist
*
* @param bagKey
* the key of the {@link ParameterBag} to which the {@link Parameter} should be added
* @param parameter
* the {@link Parameter} to be added to the {@link ParameterBag}
*
* @throws StrolchException
* if the {@link ParameterBag} does not exist
*/
public void addParameter(String bagKey, Parameter<?> parameter) throws StrolchException {
if (this.parameterBagMap == null) {
@ -124,10 +130,12 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Removes the {@link Parameter} with the given paramKey from the {@link ParameterBag} with the given bagKey
*
* @param bagKey the key of the {@link ParameterBag} from which the {@link Parameter} is to be removed
* @param paramKey the key of the {@link Parameter} which is to be removed
*
*
* @param bagKey
* the key of the {@link ParameterBag} from which the {@link Parameter} is to be removed
* @param paramKey
* the key of the {@link Parameter} which is to be removed
*
* @return the removed {@link Parameter} or null if it did not exist
*/
public <T> Parameter<T> removeParameter(String bagKey, String paramKey) {
@ -144,9 +152,10 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Returns the {@link ParameterBag} with the given key, or null if it does not exist
*
* @param key the key of the {@link ParameterBag} to return
*
*
* @param key
* the key of the {@link ParameterBag} to return
*
* @return the {@link ParameterBag} with the given key, or null if it does not exist
*/
public ParameterBag getParameterBag(String key) {
@ -158,22 +167,29 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Adds the given {@link ParameterBag} to this {@link GroupedParameterizedElement}
*
* @param bag the {@link ParameterBag} to add
*
* @param bag
* the {@link ParameterBag} to add
*/
public void addParameterBag(ParameterBag bag) {
if (this.parameterBagMap == null) {
this.parameterBagMap = new HashMap<String, ParameterBag>();
}
if (this.parameterBagMap.containsKey(bag.getId())) {
String msg = "A ParameterBag already exists with id {0} on {1}";
throw new StrolchException(MessageFormat.format(msg, bag.getId(), getLocator()));
}
this.parameterBagMap.put(bag.getId(), bag);
bag.setParent(this);
}
/**
* Removes the {@link ParameterBag} with the given key
*
* @param key the key of the {@link ParameterBag} to remove
*
*
* @param key
* the key of the {@link ParameterBag} to remove
*
* @return the removed {@link ParameterBag}, or null if it does not exist
*/
public ParameterBag removeParameterBag(String key) {
@ -185,7 +201,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Returns true if this {@link GroupedParameterizedElement} has any {@link ParameterBag ParameterBag}
*
*
* @return true if this {@link GroupedParameterizedElement} has any {@link ParameterBag ParameterBag}
*/
public boolean hasParameterBags() {
@ -194,8 +210,9 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Returns true if the {@link ParameterBag} with the given key exists on this {@link GroupedParameterizedElement}.
*
* @param bagKey the key of the {@link ParameterBag} which is to be checked for existence
*
* @param bagKey
* the key of the {@link ParameterBag} which is to be checked for existence
* @return true if the {@link ParameterBag} with the given key exists on this {@link GroupedParameterizedElement}.
*/
public boolean hasParameterBag(String bagKey) {
@ -205,13 +222,15 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Returns true if the {@link Parameter} with the given paramKey exists on the {@link ParameterBag} with the given
* bagKey
*
* @param bagKey the key of the {@link ParameterBag} on which to find the {@link Parameter}
* @param paramKey the key of the {@link Parameter} to be found
*
*
* @param bagKey
* the key of the {@link ParameterBag} on which to find the {@link Parameter}
* @param paramKey
* the key of the {@link Parameter} to be found
*
* @return true if the {@link Parameter} with the given paramKey exists on the {@link ParameterBag} with the given
* bagKey. False is returned if the {@link ParameterBag} does not exist, or the {@link Parameter} does not exist on
* the {@link ParameterBag}
* bagKey. False is returned if the {@link ParameterBag} does not exist, or the {@link Parameter} does not
* exist on the {@link ParameterBag}
*/
public boolean hasParameter(String bagKey, String paramKey) {
if (this.parameterBagMap == null) {
@ -227,7 +246,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Returns the {@link Set} of keys for the {@link ParameterBag}s on this {@link GroupedParameterizedElement}
*
*
* @return the {@link Set} of keys for the {@link ParameterBag}s on this {@link GroupedParameterizedElement}
*/
public Set<String> getParameterBagKeySet() {
@ -265,7 +284,7 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
/**
* Fills {@link GroupedParameterizedElement} properties of this clone
*
*
* @param clone
*/
protected void fillClone(GroupedParameterizedElement clone) {

View File

@ -16,6 +16,7 @@
package li.strolch.model;
import ch.eitchnet.utils.dbc.DBC;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
@ -61,7 +62,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Default Constructor
*
*
* @param id
* @param name
* @param type
@ -79,8 +80,9 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Sets the type of this {@link ParameterizedElement}
*
* @param type the type to set
*
* @param type
* the type to set
*/
public void setType(String type) {
if (StringHelper.isEmpty(type)) {
@ -94,9 +96,10 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Returns the {@link Parameter} with the given id, or null if it does not exist
*
* @param key the id of the parameter to return
*
*
* @param key
* the id of the parameter to return
*
* @return the {@link Parameter} with the given id, or null if it does not exist
*/
@SuppressWarnings("unchecked")
@ -109,22 +112,29 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Adds the given {@link Parameter} to the {@link ParameterizedElement}
*
* @param parameter the {@link Parameter} to add
*
* @param parameter
* the {@link Parameter} to add
*/
public void addParameter(Parameter<?> parameter) {
if (this.parameterMap == null) {
this.parameterMap = new HashMap<String, Parameter<?>>();
}
if (this.parameterMap.containsKey(parameter.getId())) {
String msg = "A Parameter already exists with id {0} on {1}";
throw new StrolchException(MessageFormat.format(msg, parameter.getId(), getLocator()));
}
this.parameterMap.put(parameter.getId(), parameter);
parameter.setParent(this);
}
/**
* Removes the {@link Parameter} with the given key
*
* @param key the key of the {@link Parameter} to remove
*
*
* @param key
* the key of the {@link Parameter} to remove
*
* @return the removed {@link Parameter}, or null if it does not exist
*/
@SuppressWarnings("unchecked")
@ -137,7 +147,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Returns a list of all the {@link Parameter}s in this {@link ParameterizedElement}
*
*
* @return a list of all the {@link Parameter}s in this {@link ParameterizedElement}
*/
public List<Parameter<?>> getParameters() {
@ -149,7 +159,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Returns true, if the this {@link ParameterizedElement} has any {@link Parameter Parameters}, false otherwise
*
*
* @return true, if the this {@link ParameterizedElement} has any {@link Parameter Parameters}, false otherwise
*/
public boolean hasParameters() {
@ -158,9 +168,10 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Returns true, if the {@link Parameter} exists with the given key, false otherwise
*
* @param key the key of the {@link Parameter} to check for
*
*
* @param key
* the key of the {@link Parameter} to check for
*
* @return true, if the {@link Parameter} exists with the given key, false otherwise
*/
public boolean hasParameter(String key) {
@ -172,7 +183,7 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Returns a {@link Set} of all the {@link Parameter} keys in this {@link ParameterizedElement}
*
*
* @return a {@link Set} of all the {@link Parameter} keys in this {@link ParameterizedElement}
*/
public Set<String> getParameterKeySet() {
@ -269,8 +280,9 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
/**
* Set the parent for this {@link ParameterizedElement}
*
* @param parent the parent to set
*
* @param parent
* the parent to set
*/
public void setParent(GroupedParameterizedElement parent) {
this.parent = parent;

View File

@ -15,15 +15,13 @@
*/
package li.strolch.model.parameter;
import li.strolch.model.Order;
import li.strolch.model.ParameterizedElement;
import li.strolch.model.Resource;
import li.strolch.model.StrolchElement;
import li.strolch.model.visitor.ParameterVisitor;
/**
* @author Robert von Burg <eitch@eitchnet.ch>
*
*
*/
public interface Parameter<T> extends StrolchElement {
@ -37,84 +35,73 @@ public interface Parameter<T> extends StrolchElement {
*/
public static final String UOM_NONE = "None"; //$NON-NLS-1$
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
* to a {@link Resource}
*/
public static final String INTERPRETATION_RESOURCE_REF = "Resource-Reference"; //$NON-NLS-1$
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
* to a {@link Order}
*/
public static final String INTERPRETATION_ORDER_REF = "Order-Reference"; //$NON-NLS-1$
/**
* the value of the parameter as string
*
*
* @return String
*/
public String getValueAsString();
/**
* the value of the parameter
*
*
* @return
*/
public T getValue();
/**
* the value of the parameter
*
*
* @param value
*/
public void setValue(T value);
/**
* get the hidden attribute
*
*
* @return
*/
public boolean isHidden();
/**
* set the hidden attribute
*
*
* @param hidden
*/
public void setHidden(boolean hidden);
/**
* Get the UOM of this {@link Parameter}
*
*
* @return
*/
public String getUom();
/**
* Set the UOM of this {@link Parameter}
*
*
* @param uom
*/
public void setUom(String uom);
/**
* Returns the index of this {@link Parameter}. This can be used to sort the parameters in a UI
*
*
* @return the index of this {@link Parameter}. This can be used to sort the parameters in a UI
*/
public int getIndex();
/**
* Set the index of this {@link Parameter}. This can be used to sort the parameters in a UI
*
* @param index the index to set
*
* @param index
* the index to set
*/
public void setIndex(int index);
/**
* The {@link ParameterizedElement} parent to which this {@link Parameter} belongs
*
*
* @return
*/
public ParameterizedElement getParent();
@ -132,7 +119,7 @@ public interface Parameter<T> extends StrolchElement {
* <li>{@link Parameter#INTERPRETATION_ORDER_REF}</li>
* <li>{@link Parameter#INTERPRETATION_RESOURCE_REF}</li>
* </ul>
*
*
* @return string value
*/
public String getInterpretation();
@ -145,7 +132,7 @@ public interface Parameter<T> extends StrolchElement {
* <li>{@link Parameter#INTERPRETATION_ORDER_REF}</li>
* <li>{@link Parameter#INTERPRETATION_RESOURCE_REF}</li>
* </ul>
*
*
* @param interpretation
*/
public void setInterpretation(String interpretation);