/** * @param bean * @param propertyName * @return {@link JavaBeanObjectProperty} */ protected static JavaBeanObjectProperty<Object> objectProperty(Object bean, String propertyName) { Object key = key(bean, propertyName); if (OBJECT_PROPERTIES.containsKey(key)) { return OBJECT_PROPERTIES.get(key); } try { @SuppressWarnings("unchecked") JavaBeanObjectProperty<Object> property = JavaBeanObjectPropertyBuilder.create().bean(bean).name(propertyName).build(); OBJECT_PROPERTIES.put(key, property); return property; } catch (NoSuchMethodException e) { throw new IllegalStateException(e); } }
@SuppressWarnings("unchecked") private JavaBeanObjectProperty<char[]> createPassphraseProperty() { try { return JavaBeanObjectPropertyBuilder.create() .bean(createPgpKeyParam) .name(CreatePgpKeyParam.PropertyEnum.passphrase.name()) .build(); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } }
@SuppressWarnings("unchecked") private JavaBeanObjectProperty<CreatePgpKeyParam.Algorithm> createAlgorithmProperty() { try { return JavaBeanObjectPropertyBuilder.create() .bean(createPgpKeyParam) .name(CreatePgpKeyParam.PropertyEnum.algorithm.name()) .build(); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } }