use of com.geccocrawler.gecco.dynamic.DynamicField in project dq-easy-cloud by dq-open-cloud.
the class EcReptileUtils method buildDynamicFieldName.
/**
* <p>
* 根据动态属性的名称
* </p>
* <p>
* <pre>
* 所需参数示例及其说明
* 参数名称 : 示例值 : 说明 : 是否必须
* dataFieldDTO.fieldType : int : 属性类型 :是
* dataFieldDTO.fieldName : userName : 属性名称 :是
* </pre>
*
* @param dynamicBean : 动态bean
* @param dataFieldDTO : 数据属性数据传输对象
* @return
* @author daiqi
* @创建时间 2018年6月7日 下午8:14:25
*/
private static DynamicField buildDynamicFieldName(JavassistDynamicBean dynamicBean, EcReptileDataFieldDTO dataFieldDTO) {
String fieldName = dataFieldDTO.getFieldName();
String fieldType = dataFieldDTO.getFieldType();
DynamicField dynamicField;
if (EcStringUtils.equalsIgnoreCase(fieldType, EcDataFieldTypeEnum.LIST.type())) {
if (EcStringUtils.isNotEmpty(dataFieldDTO.getSubFieldClassName())) {
Class<?> ruleClass = EcReptileConfig.getReptileEngineBeanClassDTO().getRuleBeanClazz(dataFieldDTO.getSubFieldClassName());
dynamicField = dynamicBean.listField(fieldName, ruleClass);
} else {
dynamicField = dynamicBean.listField(fieldName, Object.class);
}
} else if (EcStringUtils.equalsIgnoreCase(fieldType, EcDataFieldTypeEnum.REQUEST.type())) {
dynamicField = dynamicBean.requestField(fieldName);
} else {
dynamicField = dynamicBean.field(fieldName, Object.class);
}
return dynamicField;
}
use of com.geccocrawler.gecco.dynamic.DynamicField in project dq-easy-cloud by dq-open-cloud.
the class EcReptileUtils method buildDynamicField.
/**
* <p>
* 构建动态bean的动态数据属性
* </p>
* <p>
* <pre>
* 所需参数示例及其说明
* 参数名称 : 示例值 : 说明 : 是否必须
* </pre>
*
* @param dynamicBean
* @param dynamicBeanDTO
* @author daiqi
* @创建时间 2018年6月7日 下午8:13:04
*/
private static void buildDynamicField(JavassistDynamicBean dynamicBean, EcReptileDynamicBeanDTO dynamicBeanDTO) {
for (EcReptileDataFieldDTO dataFieldDTO : dynamicBeanDTO.getReptileDataFieldDTOs()) {
if (EcBaseUtils.equals(dataFieldDTO.getAvailable(), EcAvailableEnum.YES.type())) {
DynamicField dynamicField = buildDynamicFieldName(dynamicBean, dataFieldDTO);
dynamicField = buildDynamicValueSourceType(dynamicField, dynamicBean, dataFieldDTO);
dynamicField = buildDynamicValueSource(dynamicField, dynamicBean, dataFieldDTO);
dynamicField.build();
}
}
}
Aggregations