是否有Android的兼容替代房地产utils的? [英] Are there Android compatible alternatives to Property Utils?
问题描述
有一个方便,花花公子相当于 org.apache.commons.beanutils.PropertyUtils
在Android?
Is there a handy-dandy equivalent to org.apache.commons.beanutils.PropertyUtils
on Android?
我似乎不能用Bean utils的
在我的Android应用程序,由于对的PropertyDescriptor
一些依赖,以及 IndexedPropertyDescriptor
。所以,我不知道是否有任何替代品?
I can't seem to use bean utils
in my android app due to some dependencies on PropertyDescriptor
,and IndexedPropertyDescriptor
. So I'm wondering if there are any alternatives?
基本上所有我想要做的是使用方法名作为一个字符串的someMethod和饲料的成使用setMethod(anObject的someMethod,值)
,很像 PropertyUtils
做;不过,无需求助于反射的脏东西......
Basically all I want to do is use a method name as a string "someMethod" and feed that into setMethod(anObject, "someMethod", value)
, much like PropertyUtils
does; but without having to resort to the nasties of reflection...
或者,我的双手被反绑,我需要使用反射?
Or are my hands tied and I need to use Reflection?
推荐答案
有一个possibilty使用图书馆或写自己的code根据 PropertyUtils
。但可以肯定的是不是花花公子。你可以得到什么已经在此 线程 一做的总体思路>。
There is a possibilty to use libraries or write own code depending on the PropertyUtils
. But it sure isn't dandy. You can get the general idea about what has to be done in this thread.
有显然有些项目谁成功地解决了这个问题,所以你可以研究thier解决方案。看看 Drawingpad基 和 libgdx 。你可以找到 PropertyUtils
在第一个项目包 com.madrobot.beans
和 COM在第二.badlogic.gdx.beans
。
There are apparently some projects who have successfully solved the issue, so you can study thier solution. Take a look at Drawingpad-base and libgdx. You can find PropertyUtils
in the package com.madrobot.beans
in the first project and com.badlogic.gdx.beans
in the second.
这篇关于是否有Android的兼容替代房地产utils的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!