本文整理汇总了Java中org.apache.ibatis.reflection.MetaObject.hasGetter方法的典型用法代码示例。如果您正苦于以下问题:Java MetaObject.hasGetter方法的具体用法?Java MetaObject.hasGetter怎么用?Java MetaObject.hasGetter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ibatis.reflection.MetaObject
的用法示例。
在下文中一共展示了MetaObject.hasGetter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasGetter
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
@Override
public boolean hasGetter(String name) {
PropertyTokenizer prop = new PropertyTokenizer(name);
if (prop.hasNext()) {
if (map.containsKey(prop.getIndexedName())) {
MetaObject metaValue = metaObject.metaObjectForProperty(prop.getIndexedName());
if (metaValue == SystemMetaObject.NULL_META_OBJECT) {
return true;
} else {
return metaValue.hasGetter(prop.getChildren());
}
} else {
return false;
}
} else {
return map.containsKey(prop.getName());
}
}
示例2: hasGetter
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
@Override
public boolean hasGetter(String name) {
PropertyTokenizer prop = new PropertyTokenizer(name);
if (prop.hasNext()) {
if (metaClass.hasGetter(prop.getIndexedName())) {
MetaObject metaValue = metaObject.metaObjectForProperty(prop.getIndexedName());
if (metaValue == SystemMetaObject.NULL_META_OBJECT) {
return metaClass.hasGetter(name);
} else {
return metaValue.hasGetter(prop.getChildren());
}
} else {
return false;
}
} else {
return metaClass.hasGetter(name);
}
}
示例3: hasGetter
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
public boolean hasGetter(String name) {
PropertyTokenizer prop = new PropertyTokenizer(name);
if (prop.hasNext()) {
if (map.containsKey(prop.getIndexedName())) {
MetaObject metaValue = metaObject.metaObjectForProperty(prop
.getIndexedName());
if (metaValue == SystemMetaObject.NULL_META_OBJECT) {
return true;
} else {
return metaValue.hasGetter(prop.getChildren());
}
} else {
return false;
}
} else {
return map.containsKey(prop.getName());
}
}
示例4: hasGetter
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
public boolean hasGetter(String name) {
PropertyTokenizer prop = new PropertyTokenizer(name);
if (prop.hasNext()) {
if (metaClass.hasGetter(prop.getIndexedName())) {
MetaObject metaValue = metaObject.metaObjectForProperty(prop
.getIndexedName());
if (metaValue == SystemMetaObject.NULL_META_OBJECT) {
return metaClass.hasGetter(name);
} else {
return metaValue.hasGetter(prop.getChildren());
}
} else {
return false;
}
} else {
return metaClass.hasGetter(name);
}
}
示例5: findTargetObject
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
public static MetaObject findTargetObject(Invocation invocation) {
MetaObject metaObject = MetaObject.forObject(invocation.getTarget(), OBJECT_FACTORY, OBJECT_WRAPPER_FACTORY);
while (metaObject.hasGetter(HANDLER_FIELD)) {
Object o = metaObject.getValue(HANDLER_FIELD);
metaObject = MetaObject.forObject(o, OBJECT_FACTORY, OBJECT_WRAPPER_FACTORY);
if (metaObject.hasGetter(TARGET_FIELD)) {
o = metaObject.getValue(TARGET_FIELD);
metaObject = MetaObject.forObject(o, OBJECT_FACTORY, OBJECT_WRAPPER_FACTORY);
}
}
return metaObject;
}
示例6: setValue
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
private void setValue(MetaObject metaParam, String property, Object value) {
if (metaParam.hasSetter(property)) {
if(metaParam.hasGetter(property)){
Object defaultValue = metaParam.getValue(property);
if(defaultValue != null){
return;
}
}
metaParam.setValue(property, value);
} else {
throw new ExecutorException("No setter found for the keyProperty '" + property + "' in " + metaParam.getOriginalObject().getClass().getName() + ".");
}
}
示例7: getParamValue
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
/**
* 从对象中取参数
*
* @param paramsObject
* @param paramName
* @param required
* @return
*/
public static Object getParamValue(MetaObject paramsObject, String paramName, boolean required) {
Object value = null;
if (paramsObject.hasGetter(PARAMS.get(paramName))) {
value = paramsObject.getValue(PARAMS.get(paramName));
}
if (required && value == null) {
throw new RuntimeException("分页查询缺少必要的参数:" + PARAMS.get(paramName));
}
return value;
}
示例8: setFieldValByName
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
/**
* <p>
* Common method to set value for java bean.
* </p>
* <p>
* 如果包含前缀 et 使用该方法,否则可以直接 metaObject.setValue(fieldName, fieldVal);
* </p>
*
* @param fieldName java bean property name
* @param fieldVal java bean property value
* @param metaObject meta object parameter
*/
public MetaObjectHandler setFieldValByName(String fieldName, Object fieldVal, MetaObject metaObject) {
if (metaObject.hasSetter(fieldName) && metaObject.hasGetter(fieldName)) {
metaObject.setValue(fieldName, fieldVal);
} else if (metaObject.hasGetter(META_OBJ_PREFIX)) {
Object et = metaObject.getValue(META_OBJ_PREFIX);
if (et != null) {
MetaObject etMeta = SystemMetaObject.forObject(et);
if (etMeta.hasSetter(fieldName)) {
etMeta.setValue(fieldName, fieldVal);
}
}
}
return this;
}
示例9: getFieldValByName
import org.apache.ibatis.reflection.MetaObject; //导入方法依赖的package包/类
/**
* <p>
* get value from java bean by propertyName
* </p>
* <p>
* 如果包含前缀 et 使用该方法,否则可以直接 metaObject.setValue(fieldName, fieldVal);
* </p>
*
* @param fieldName java bean property name
* @param metaObject parameter wrapper
* @return
*/
public Object getFieldValByName(String fieldName, MetaObject metaObject) {
if (metaObject.hasGetter(fieldName)) {
return metaObject.getValue(fieldName);
} else if (metaObject.hasGetter(META_OBJ_PREFIX + "." + fieldName)) {
return metaObject.getValue(META_OBJ_PREFIX + "." + fieldName);
}
return null;
}