Search in sources :

Example 6 with ParameterMetaData

use of org.glassfish.admin.rest.provider.ParameterMetaData in project Payara by payara.

the class ResourceUtil method getParameterMetaData.

// Construct parameter meta-data from the model
static ParameterMetaData getParameterMetaData(CommandModel.ParamModel paramModel) {
    Param param = paramModel.getParam();
    ParameterMetaData parameterMetaData = new ParameterMetaData();
    parameterMetaData.putAttribute(Constants.TYPE, getXsdType(paramModel.getType().toString()));
    parameterMetaData.putAttribute(Constants.OPTIONAL, Boolean.toString(param.optional()));
    String val = param.defaultValue();
    if ((val != null) && (!val.equals("\u0000"))) {
        parameterMetaData.putAttribute(Constants.DEFAULT_VALUE, param.defaultValue());
    }
    parameterMetaData.putAttribute(Constants.ACCEPTABLE_VALUES, param.acceptableValues());
    return parameterMetaData;
}
Also used : Param(org.glassfish.api.Param) ParameterMetaData(org.glassfish.admin.rest.provider.ParameterMetaData)

Aggregations

ParameterMetaData (org.glassfish.admin.rest.provider.ParameterMetaData)6 MethodMetaData (org.glassfish.admin.rest.provider.MethodMetaData)3 Method (java.lang.reflect.Method)2 HashMap (java.util.HashMap)2 Param (org.glassfish.api.Param)2 MultiException (org.glassfish.hk2.api.MultiException)2 Attribute (org.jvnet.hk2.config.Attribute)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 MultivaluedMap (javax.ws.rs.core.MultivaluedMap)1 CommandModel (org.glassfish.api.admin.CommandModel)1 ParameterMap (org.glassfish.api.admin.ParameterMap)1 ConfigBeanProxy (org.jvnet.hk2.config.ConfigBeanProxy)1