本文整理汇总了Java中net.sf.cglib.beans.BeanMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java BeanMap.get方法的具体用法?Java BeanMap.get怎么用?Java BeanMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.cglib.beans.BeanMap
的用法示例。
在下文中一共展示了BeanMap.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: injectImageField
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Object injectImageField(HttpRequest request, BeanMap beanMap, SpiderBean bean, Field field) {
Object value = beanMap.get(field.getName());
if(value == null) {
return null;
}
if(value instanceof Collection) {
Collection<Object> collection = (Collection<Object>)value;
for(Object item : collection) {
String imgUrl = downloadImage(request, field, item.toString());
item = imgUrl;
}
return collection;
} else {
return downloadImage(request, field, value.toString());
}
}
示例2: encode
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
public void encode(BitBuffer bitBuffer, BeanMap beanMap, Field field, Annotation annotation) throws Exception {
DateTime dateTime = (DateTime) annotation;
long millSec = (Long) beanMap.get(field.getName());
if(dateTime.isBCDCode())
bitBuffer.write(ByteBufferUtil.date2bcdbuf(millSec));
else
bitBuffer.write(ByteBufferUtil.date2buf(millSec));
}
示例3: toPrettyHexString
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
@Override
public String toPrettyHexString(BitBuffer bitBuffer, BeanMap beanMap, Field field, Annotation annotation) throws Exception {
DateTime dateTime = (DateTime) annotation;
long millSec = (Long) beanMap.get(field.getName());
if(dateTime.isBCDCode()) {
return String.format(FIELD_TEMPLATE, HexStringUtil.toHexString(ByteBufferUtil.date2bcdbuf(millSec)), field.getName(), millSec);
} else {
return String.format(FIELD_TEMPLATE, HexStringUtil.toHexString(ByteBufferUtil.date2buf(millSec)), field.getName(), millSec);
}
}
示例4: encode
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
public void encode(BitBuffer bitBuffer, BeanMap beanMap, Field field, Annotation annotation) throws Exception {
AsciiString arrayAnnocation = (AsciiString) annotation;
int length = CoderHelper.caculateArrayLength(beanMap.getBean(), arrayAnnocation.length());
String value = (String) beanMap.get(field.getName());
byte[] buf = value.getBytes(arrayAnnocation.charsetName());
if(length != buf.length)
throw new Exception(field.getName() + " length is not equal to " + length);
if (buf != null && buf.length > 0) {
bitBuffer.write(buf);
}
}
示例5: doPrettyHexString
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
/**
* Begin to print pretty string
*
* @param obj The JavaBean
* @param prettyStringBuilder The prettystring builder
* @throws Exception error
*/
private void doPrettyHexString(Object obj, StringBuilder prettyStringBuilder) throws Exception {
prettyStringBuilder.append(obj.getClass().getSimpleName() + "={");
Field[] fields = pool.getFields(obj.getClass());
BeanMap beanMap = BeanMap.create(obj);
int length = fields.length;
for (int i = 0; i < length; i++) {
Field field = fields[i];
Annotation[] annotations = pool.getAnnotations(field);
if (annotations != null && annotations.length > 0) {
if (annotations[0] instanceof Element) {
Element anno = (Element) annotations[0];
int arraySize = CoderHelper.caculateArrayLength(obj, anno.length());
if (arraySize == 1) {
prettyStringBuilder.append(field.getName() + "={");
doPrettyHexString(beanMap.get(field.getName()), prettyStringBuilder);
prettyStringBuilder.append("},");
} else {
Object[] objs = (Object[]) beanMap.get(field.getName());
for (Object ob : objs) {
prettyStringBuilder.append(field.getName() + "={");
doPrettyHexString(ob, prettyStringBuilder);
prettyStringBuilder.append("},");
}
}
} else {
String line = coderFactory.toPrettyHexString(bitBuffer.get(), beanMap, field, annotations[0]);
if (i == (length - 1)) {
line = line.replace(",", "");
}
prettyStringBuilder.append(line);
}
}
}
prettyStringBuilder.append("}");
}
示例6: test
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
@Test
public void test() {
TestDouble testDouble = new TestDouble();
testDouble.setV1(12.35f);
testDouble.setV2(12.35f);
testDouble.setV3(12.35d);
testDouble.setV4(12.35d);
BeanMap beanMap = BeanMap.create(testDouble);
double v = (float)beanMap.get("v1");
v = (Float)beanMap.get("v2");
v = (Double)beanMap.get("v3");
v = (Double)beanMap.get("v4");
}
示例7: doPrettyHexString
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
/**
*
* @param obj
* @param prettyStringBuilder
* @throws Exception
*/
private void doPrettyHexString(Object obj, StringBuilder prettyStringBuilder) throws Exception {
prettyStringBuilder.append(obj.getClass().getSimpleName() + "={");
Field[] fields = pool.getFields(obj.getClass());
BeanMap beanMap = BeanMap.create(obj);
int length = fields.length;
for (int i = 0; i < length; i++) {
Field field = fields[i];
Annotation[] annotations = pool.getAnnotations(field);
if(annotations != null && annotations.length > 0) {
if (annotations[0] instanceof Element) {
Element anno = (Element) annotations[0];
int arraySize = CoderHelper.caculateArrayLength(obj, anno.length());
if(arraySize == 1) {
prettyStringBuilder.append(field.getName() + "={");
doPrettyHexString(beanMap.get(field.getName()), prettyStringBuilder);
prettyStringBuilder.append("},");
} else {
Object[] objs = (Object[]) beanMap.get(field.getName());
for (Object ob : objs) {
prettyStringBuilder.append(field.getName() + "={");
doPrettyHexString(ob, prettyStringBuilder);
prettyStringBuilder.append("},");
}
}
} else {
String line = coderFactory.toPrettyHexString(bitBuffer, beanMap, field, annotations[0]);
if(i == (length - 1)) {
line = line.replace(",", "");
}
prettyStringBuilder.append(line);
}
}
}
prettyStringBuilder.append("}");
}
示例8: test
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
@Test
public void test() {
TestDouble testDouble = new TestDouble();
testDouble.setV1(12.35f);
testDouble.setV2(12.35f);
testDouble.setV3(12.35d);
testDouble.setV4(12.35d);
BeanMap beanMap = BeanMap.create(testDouble);
double v = (double)beanMap.get("v1");
v = (double)beanMap.get("v2");
v = (Double)beanMap.get("v3");
v = (Double)beanMap.get("v4");
}
示例9: toPrettyHexString
import net.sf.cglib.beans.BeanMap; //导入方法依赖的package包/类
@Override
public String toPrettyHexString(BitBuffer bitBuffer, BeanMap beanMap, Field field, Annotation annotation) throws Exception {
AsciiString arrayAnnocation = (AsciiString) annotation;
String value = (String) beanMap.get(field.getName());
return String.format(FIELD_TEMPLATE, HexStringUtil.toHexString(value, arrayAnnocation.charsetName()), field.getName(), value);
}