Package org.apdplat.platform.annotation

Examples of org.apdplat.platform.annotation.ModelCollRef


                data.put(fieldName, "");
                return;
            }
            //处理集合类型
            if(field.isAnnotationPresent(ModelCollRef.class)){
                ModelCollRef ref = field.getAnnotation(ModelCollRef.class);
                String fieldRef = ref.value();
                Collection col=(Collection)value;
                String colStr="";
                if(col!=null){
                    LOG.debug("处理集合,字段为:"+field.getName()+",大小为:"+col.size());
                    if(col.size()>0){
                        StringBuilder str=new StringBuilder();
                        for(Object m : col){
                            str.append(ReflectionUtils.getFieldValue(m, fieldRef).toString()).append(",");
                        }
                        str=str.deleteCharAt(str.length()-1);
                        colStr=str.toString();
                    }
                }else{
                    LOG.debug("处理集合失败,"+value+" 不能转换为集合");
                }
                data.put(fieldName, colStr);
                return ;
            }
            //处理复杂对象类型
            if(field.isAnnotationPresent(ModelAttrRef.class)){
                LOG.debug("处理对象,字段为:"+field.getName());
                ModelAttrRef ref = field.getAnnotation(ModelAttrRef.class);
                String fieldRef = ref.value();
                //加入复杂对象的ID
                Object id = ReflectionUtils.getFieldValue(value, "id");
                data.put(fieldName+"_id", id.toString());
                //因为是复杂对象,所以变换字段名称
                fieldName=fieldName+"_"+fieldRef;
View Full Code Here


                //字段值处理
                String valueClass=value.getClass().getSimpleName();
                LOG.debug("fieldAttr: "+fieldAttr+" fieldName: "+fieldName+" valueClass: "+valueClass);                     
                //处理集合类型
                if(field.isAnnotationPresent(ModelCollRef.class)){
                    ModelCollRef ref = field.getAnnotation(ModelCollRef.class);
                    String fieldRef = ref.value();
                    Collection collection=(Collection)value; 
                    LOG.debug("处理集合,字段为:"+fieldName+",大小为:"+collection.size());
                    if(collection.size() > 0){
                        StringBuilder str=new StringBuilder();
                        for(Object object : collection){
                            str.append(ReflectionUtils.getFieldValue(object, fieldRef).toString()).append(",");
                        }
                        str=str.deleteCharAt(str.length()-1);
                        value=str.toString();
                    }
                }
                //处理复杂对象类型
                if(field.isAnnotationPresent(ModelAttrRef.class)){
                    LOG.debug("处理对象,字段为:"+fieldName);
                    ModelAttrRef ref = field.getAnnotation(ModelAttrRef.class);
                    String fieldRef = ref.value();
                    //获取fieldRef的值
                    value = ReflectionUtils.getFieldValue(value, fieldRef);
                }
                if("Timestamp".equals(valueClass) || "Date".equals(valueClass)){
                    if(field.isAnnotationPresent(RenderDate.class)){
View Full Code Here

TOP

Related Classes of org.apdplat.platform.annotation.ModelCollRef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.