@Test public void testBuild() throws Exception { MyBean bean = new MyBean(); bean.setString("aaa"); bean.setInteger(1); bean.setBool(true); bean.setCh('a'); bean.setMyEnum(MyEnum.AAA); bean.setList(Arrays.asList("aaa", "bbb")); bean.setFile(new File("aaa")); ArgumentsBuilder builder = new ArgumentsBuilder(bean); List<String> args = builder.build(); assertEquals(7, args.size()); assertTrue(args.contains("string='aaa'")); assertTrue(args.contains("integer=1")); assertTrue(args.contains("bool=true")); assertTrue(args.contains("ch=\\u0097")); assertTrue(args.contains("myEnum=AAA")); assertTrue(args.contains("list=['aaa','bbb']")); assertTrue(args.contains("file='" + new File("aaa").getCanonicalPath() + "'")); }
public List<String> build() { ArrayList<String> args = new ArrayList<String>(); for (int i = 0; i < beanDesc.getPropertyDescSize(); i++) { PropertyDesc propertyDesc = beanDesc.getPropertyDesc(i); if (!propertyDesc.hasReadMethod()) { continue; } ArgumentType<Object> argumentType = ArgumentTypeRegistry .getArgumentType(propertyDesc); if (argumentType == null) { String message = String .format( "No ArgumentType for the property(%s) of class(%s). Process skipped.", propertyDesc.getPropertyName(), bean.getClass() .getName()); logger.warn(message); continue; } String name = propertyDesc.getPropertyName(); Object value = propertyDesc.getValue(bean); args.add(name + "=" + argumentType.toText(value)); } return args; }
ArgumentsBuilder { public List<String> build() { ArrayList<String> args = new ArrayList<String>(); for (int i = 0; i < beanDesc.getPropertyDescSize(); i++) { PropertyDesc propertyDesc = beanDesc.getPropertyDesc(i); if (!propertyDesc.hasReadMethod()) { continue; } ArgumentType<Object> argumentType = ArgumentTypeRegistry .getArgumentType(propertyDesc); if (argumentType == null) { String message = String .format( "No ArgumentType for the property(%s) of class(%s). Process skipped.", propertyDesc.getPropertyName(), bean.getClass() .getName()); logger.warn(message); continue; } String name = propertyDesc.getPropertyName(); Object value = propertyDesc.getValue(bean); args.add(name + "=" + argumentType.toText(value)); } return args; } }
ArgumentsBuilder { public List<String> build() { ArrayList<String> args = new ArrayList<String>(); for (int i = 0; i < beanDesc.getPropertyDescSize(); i++) { PropertyDesc propertyDesc = beanDesc.getPropertyDesc(i); if (!propertyDesc.hasReadMethod()) { continue; } ArgumentType<Object> argumentType = ArgumentTypeRegistry .getArgumentType(propertyDesc); if (argumentType == null) { String message = String .format( "No ArgumentType for the property(%s) of class(%s). Process skipped.", propertyDesc.getPropertyName(), bean.getClass() .getName()); logger.warn(message); continue; } String name = propertyDesc.getPropertyName(); Object value = propertyDesc.getValue(bean); args.add(name + "=" + argumentType.toText(value)); } return args; } ArgumentsBuilder(Object bean); }
ArgumentsBuilder { public List<String> build() { ArrayList<String> args = new ArrayList<String>(); for (int i = 0; i < beanDesc.getPropertyDescSize(); i++) { PropertyDesc propertyDesc = beanDesc.getPropertyDesc(i); if (!propertyDesc.hasReadMethod()) { continue; } ArgumentType<Object> argumentType = ArgumentTypeRegistry .getArgumentType(propertyDesc); if (argumentType == null) { String message = String .format( "No ArgumentType for the property(%s) of class(%s). Process skipped.", propertyDesc.getPropertyName(), bean.getClass() .getName()); logger.warn(message); continue; } String name = propertyDesc.getPropertyName(); Object value = propertyDesc.getValue(bean); args.add(name + "=" + argumentType.toText(value)); } return args; } ArgumentsBuilder(Object bean); List<String> build(); }
ArgumentsBuilder { public List<String> build() { ArrayList<String> args = new ArrayList<String>(); for (int i = 0; i < beanDesc.getPropertyDescSize(); i++) { PropertyDesc propertyDesc = beanDesc.getPropertyDesc(i); if (!propertyDesc.hasReadMethod()) { continue; } ArgumentType<Object> argumentType = ArgumentTypeRegistry .getArgumentType(propertyDesc); if (argumentType == null) { String message = String .format( "No ArgumentType for the property(%s) of class(%s). Process skipped.", propertyDesc.getPropertyName(), bean.getClass() .getName()); logger.warn(message); continue; } String name = propertyDesc.getPropertyName(); Object value = propertyDesc.getValue(bean); args.add(name + "=" + argumentType.toText(value)); } return args; } ArgumentsBuilder(Object bean); List<String> build();  }