当前位置: 首页>>代码示例>>Java>>正文


Java BeanMap.get方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:xtuhcy,项目名称:gecco,代码行数:18,代码来源:ImageFieldRender.java

示例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));
}
 
开发者ID:ioprotocol,项目名称:engine,代码行数:9,代码来源:DateTimeCoder.java

示例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);
    }
}
 
开发者ID:ioprotocol,项目名称:engine,代码行数:11,代码来源:DateTimeCoder.java

示例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);
    }
}
 
开发者ID:ioprotocol,项目名称:engine,代码行数:15,代码来源:AsciiStringCoder.java

示例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("}");
}
 
开发者ID:ioprotocol,项目名称:engine,代码行数:46,代码来源:ProtocolEngine.java

示例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");
}
 
开发者ID:ioprotocol,项目名称:engine,代码行数:14,代码来源:TestDouble.java

示例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("}");
}
 
开发者ID:xsyjjh,项目名称:protocol-engine,代码行数:45,代码来源:ProtocolEngine.java

示例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");
}
 
开发者ID:xsyjjh,项目名称:protocol-engine,代码行数:14,代码来源:TestDouble.java

示例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);
}
 
开发者ID:ioprotocol,项目名称:engine,代码行数:7,代码来源:AsciiStringCoder.java


注:本文中的net.sf.cglib.beans.BeanMap.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。