Package org.glassfish.common.util.admin
Class ParameterMapExtractor
- java.lang.Object
-
- org.glassfish.common.util.admin.ParameterMapExtractor
-
public class ParameterMapExtractor extends Object
Extracts a ParameterMap corresponding to the parameters defined on injected objects, such as AdminCommand or CommandParameters implementations.This can be useful from a supplemental command which needs to create a new command invocation, with parameters similar to its own, for execution on a cluster.
- Author:
- Tim Quinn
-
-
Constructor Summary
Constructors Constructor Description ParameterMapExtractor(Object... targets)
Creates a new extractor based on the injected values in one or more injected targets, typically AdminCommand or CommandParameters implementations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterMap
extract()
Creates a ParameterMap from the @Param fields defined on the injected objects provided in the constructor call.ParameterMap
extract(Collection<String> parameterNamesToExclude)
Creates a ParameterMap from the @Param fields defined on the injected objects provided in the constructor call, excluding selected parameters.static String
propertiesToPropertiesString(Properties props, char sep)
String
propertiesValue(Properties props, char sep)
-
-
-
Constructor Detail
-
ParameterMapExtractor
public ParameterMapExtractor(Object... targets)
Creates a new extractor based on the injected values in one or more injected targets, typically AdminCommand or CommandParameters implementations.Note that the objects are processed in the order specified, and any values set in later objects will override values that were set from earlier objects.
- Parameters:
targets
- the objects to inspect for injected @Param values- Throws:
IllegalArgumentException
- if a null is passed for the targets
-
-
Method Detail
-
extract
public ParameterMap extract() throws IllegalArgumentException, IllegalAccessException
Creates a ParameterMap from the @Param fields defined on the injected objects provided in the constructor call.- Returns:
- ParameterMap for the parameters injected into the admin object
- Throws:
IllegalArgumentException
IllegalAccessException
-
extract
public ParameterMap extract(Collection<String> parameterNamesToExclude) throws IllegalArgumentException, IllegalAccessException
Creates a ParameterMap from the @Param fields defined on the injected objects provided in the constructor call, excluding selected parameters.- Parameters:
parameterNamesToExclude
- parameter names to exclude from the parameter map- Returns:
- ParameterMap for the parameters injected into the targets passed to the constructor
- Throws:
IllegalArgumentException
IllegalAccessException
-
propertiesToPropertiesString
public static String propertiesToPropertiesString(Properties props, char sep)
-
propertiesValue
public String propertiesValue(Properties props, char sep)
-
-