WordPress数据库错误: [Got error 28 from storage engine]
SHOW FULL COLUMNS FROM `wp_options`

WordPress数据库错误: [Got error 28 from storage engine]
SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (114) ORDER BY t.name ASC

使用反射(reflection)的简单例子 – Crazy knowledge base
Crazy knowledge base

使用反射(reflection)的简单例子

运用反射访问类的私有方法是一件比较有趣的事情,这个对于类的测试也很有实用价值。

例如下面的ClassA是要访问的类 :

package reflecttest;

public class ClassA {
 private String id;
 public ClassA(String id){
  this.id = id;
 }
 public String getId() {
  return id;
 }
 private void setId(String id) {
  this.id = id;
 }
  
}

下面为实现访问的简单例子:

package reflecttest;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class ReflectSample {

 public static void main(String[] args) {
  try {
   //要被加载的类名,可以通过配置文件指定
   String className = “reflecttest.ClassA”;
   
   //根据类名加载类
   Class c = Class.forName(className);

   //设置构造器参数
   Class[] paramTypes = new Class[1];
   paramTypes[0] = String.class;
   
   //生成构造器
   Constructor cs = c.getConstructor(paramTypes);
   
   //设置构造器参数值
   Object[] paramValue = new Object[1];
   paramValue[0] = “testID”;
   
   //构造类实例
   Object obj = cs.newInstance(paramValue);
   
   //调用类中的方法: getId()
   String methodNameA = “getId”;
   Method mA = c.getMethod(methodNameA, null);
   System.out.println(mA.invoke(obj, null));
   
   //调用类中的方法: setId()
   String methodNameB = “setId”;
   Method mB = c.getMethod(methodNameB, new Class[]{String.class});   
   mB.invoke(obj, new Object[]{“newId”});
   
   //查看修改后的结果
   System.out.println(mA.invoke(obj, null));
   
   
  } catch (Exception ex) {
   ex.printStackTrace();
  }
 }

}

原地址:
http://blog.csdn.net/zzyy00/archive/2006/09/03/1172321.aspx

使用反射(reflection)的简单例子

WordPress数据库错误: [Got error 28 from storage engine]
SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (113) ORDER BY t.name ASC

WordPress数据库错误: [Got error 28 from storage engine]
SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (115) ORDER BY t.name ASC

滚动到顶部