コード例 #1
0
 private void callPut(
     java.lang.Object object,
     com.beust.jcommander.Parameterized parameterized,
     java.lang.String key,
     java.lang.String value) {
   try {
     java.lang.reflect.Method m;
     m = findPut(parameterized.getType());
     m.invoke(parameterized.get(object), key, value);
   } catch (java.lang.SecurityException e) {
     e.printStackTrace();
   } catch (java.lang.IllegalAccessException e) {
     e.printStackTrace();
   } catch (java.lang.reflect.InvocationTargetException e) {
     e.printStackTrace();
   } catch (java.lang.NoSuchMethodException e) {
     e.printStackTrace();
   }
 }
コード例 #2
0
 public void addValue(
     com.beust.jcommander.Parameterized parameterized,
     java.lang.Object object,
     java.lang.Object value) {
   if (m_parameter != null) {
     parameterized.set(object, value);
   } else {
     java.lang.String a = m_dynamicParameter.assignment();
     java.lang.String sv = value.toString();
     int aInd = sv.indexOf(a);
     if (aInd == -1) {
       throw new com.beust.jcommander.ParameterException(
           "Dynamic parameter expected a value of the form a" + a + "b" + " but got:" + sv);
     }
     callPut(object, parameterized, sv.substring(0, aInd), sv.substring(aInd * 1));
   }
 }