com.kuka.common.params
Class AbstractParameterSet

java.lang.Object
  extended by com.kuka.common.params.AbstractParameterSet
All Implemented Interfaces:
IParameterSet, Iterable<IParameter<?>>
Direct Known Subclasses:
ParameterSet

public abstract class AbstractParameterSet
extends Object
implements IParameterSet

Base class for immutable, type safe parameter sets.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Constructor Summary
protected AbstractParameterSet(String name, Map<Class<? extends IParameter<?>>,IParameter<?>> parameters)
          Creates a new instance of the parameter set with the given values.
 
Method Summary
 IParameterSet combine(IParameterSet other)
          Combines this parameter set with another set and returns the resulting set.
<T extends IParameter<?>>
boolean
contains(Class<T> paramType)
          Determines if this set contains the given parameter.
protected abstract  IParameterSetBuilder<?> createBuilder()
          Return a parameter set builder.
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean isEmpty()
          Checks whether this parameter set is empty.
 Iterator<IParameter<?>> iterator()
           
 String name()
          Gets the name of this parameter set.
<T extends IParameter<?>>
T
optionalParameter(Class<T> paramType)
          Gets the parameter with the specified name.
<V,W extends V,T extends IParameter<V>>
V
optionalValue(Class<T> paramType, W defaultValue)
          Gets the parameter with the specified name.
 int paramCount()
          Gets the number of parameters in the set.
<T extends IParameter<?>>
T
requiredParameter(Class<T> paramType)
          Gets the parameter with the specified name.
<V,T extends IParameter<V>>
V
requiredValue(Class<T> paramType)
          Gets the parameter with the specified name.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractParameterSet

protected AbstractParameterSet(String name,
                               Map<Class<? extends IParameter<?>>,IParameter<?>> parameters)
Creates a new instance of the parameter set with the given values. This parameter set is meant to be immutable.

Parameters:
name - name of the parameter set. Can be null.
parameters - a map of parameters for this set
Method Detail

createBuilder

protected abstract IParameterSetBuilder<?> createBuilder()
Return a parameter set builder. This is used by subclasses to provide a parameter set builder of a specific type.

Returns:
a parameter set builder

name

public final String name()
Description copied from interface: IParameterSet
Gets the name of this parameter set.

Specified by:
name in interface IParameterSet
Returns:
The name of this parameter set. Can be null.

optionalParameter

public final <T extends IParameter<?>> T optionalParameter(Class<T> paramType)
Description copied from interface: IParameterSet
Gets the parameter with the specified name. Returns null if the parameter was not found.

Specified by:
optionalParameter in interface IParameterSet
Type Parameters:
T - parameter type
Parameters:
paramType - The parameter type class object.
Returns:
The parameter value or null.

optionalValue

public final <V,W extends V,T extends IParameter<V>> V optionalValue(Class<T> paramType,
                                                                     W defaultValue)
Description copied from interface: IParameterSet
Gets the parameter with the specified name. Returns the given default value if no parameter was found.

Specified by:
optionalValue in interface IParameterSet
Type Parameters:
V - value supertype
W - value type
T - parameter type
Parameters:
paramType - The parameter type class object.
defaultValue - The default value which is returned when no parameter was found.
Returns:
The parameter value or the default value.

requiredParameter

public final <T extends IParameter<?>> T requiredParameter(Class<T> paramType)
Description copied from interface: IParameterSet
Gets the parameter with the specified name. Fails if the parameter was not found.

Specified by:
requiredParameter in interface IParameterSet
Type Parameters:
T - parameter type
Parameters:
paramType - The parameter type class object.
Returns:
The parameter with the specified name.

requiredValue

public final <V,T extends IParameter<V>> V requiredValue(Class<T> paramType)
Description copied from interface: IParameterSet
Gets the parameter with the specified name. Fails if the parameter was not found.

Specified by:
requiredValue in interface IParameterSet
Type Parameters:
V - value type
T - parameter type
Parameters:
paramType - The parameter type class object.
Returns:
The parameter with the specified name.

contains

public final <T extends IParameter<?>> boolean contains(Class<T> paramType)
Description copied from interface: IParameterSet
Determines if this set contains the given parameter.

Specified by:
contains in interface IParameterSet
Type Parameters:
T - parameter type
Parameters:
paramType - The parameter type class object.
Returns:
True if this set contains the specified parameter.

toString

public String toString()
Overrides:
toString in class Object

isEmpty

public final boolean isEmpty()
Description copied from interface: IParameterSet
Checks whether this parameter set is empty.

Specified by:
isEmpty in interface IParameterSet
Returns:
True if this set is empty, false otherwise.

iterator

public final Iterator<IParameter<?>> iterator()
Specified by:
iterator in interface IParameterSet
Specified by:
iterator in interface Iterable<IParameter<?>>

combine

public final IParameterSet combine(IParameterSet other)
Description copied from interface: IParameterSet
Combines this parameter set with another set and returns the resulting set. The order of the sets is important: Parameters in the primary sets take precedence over parameters in the second set.

Specified by:
combine in interface IParameterSet
Parameters:
other - The other set
Returns:
A new, combined set.

paramCount

public int paramCount()
Description copied from interface: IParameterSet
Gets the number of parameters in the set.

Specified by:
paramCount in interface IParameterSet
Returns:
the number of parameters in the set.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2019. All rights reserved.