>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>欢迎转载,转载请注明出处-VirgoArt,www.cnblogs.com

一、Web项目链接配置(这里可以优化成连接池)(关于构造,是为了满足JUnit测试需求)

package com.pj.util;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent; public class HBaseConnectionUtil implements ApplicationListener<ContextRefreshedEvent> {
public static Connection connection;
private static boolean isCreate = false; public HBaseConnectionUtil() {
if (!isCreate) {
this.onApplicationEvent(null);
}
} /** 这里结合Spring配置,实现初始化完成后的消息事件触发 */
@Override
public void onApplicationEvent(ContextRefreshedEvent arg0) {
if (!isCreate) {
Configuration conf = HBaseConfiguration.create();
conf.set(SystemConfigUtil.getInstance().getProValue("HBASE_ZK_PATH"),
SystemConfigUtil.getInstance().getProValue("HBASE_ZK_IP"));
try {
connection = ConnectionFactory.createConnection(conf);
} catch (IOException e) {
e.printStackTrace();
}
isCreate = true;
}
}
}

二、常用的表级、列级操作

package com.pj.util;

import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.FilterList;
import org.apache.hadoop.hbase.filter.PageFilter;
import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
import org.apache.hadoop.hbase.util.Bytes;
import org.slf4j.LoggerFactory; import com.pj.entity.ResultBean; import ch.qos.logback.classic.Logger; public class HBaseUtil {
public final static Logger log = (Logger) LoggerFactory.getLogger(HBaseUtil.class); /** 封装Table
*
* @deprecated 建议使用getTablePlus */
@Deprecated
public static Table getTable(String tableName) {
try {
return HBaseConnectionUtil.connection.getTable(TableName.valueOf(tableName));
} catch (IOException e) {
log.info(tableName + "表对象创建失败.");
e.printStackTrace();
return null;
}
} public static ResultBean<Table> getTablePlus(String tableName) {
ResultBean<Table> res = null;
try {
Table table = HBaseConnectionUtil.connection.getTable(TableName.valueOf(tableName));
res = new ResultBean<Table>(table);
} catch (IOException e) {
log.info(tableName + "表对象创建失败.");
res = new ResultBean<>(e);
}
return res;
} /** 通过Get进行单条查询,返回为单条结果
*
* @param table
* @param rowKey
* @param clazz
* @return */
@SuppressWarnings({ "deprecation", "unchecked" })
public static <T> ResultBean<T> getDataFBean(Table table, String rowKey, Class<?> clazz) {
Get get = new Get(Bytes.toBytes(rowKey));
Result result = null;
try {
result = table.get(get);
} catch (IOException e) {
return new ResultBean<T>(e);
}
T t = null;
try {
t = (T) clazz.newInstance();
} catch (InstantiationException e) {
return new ResultBean<T>(e);
} catch (IllegalAccessException e) {
return new ResultBean<T>(e);
}
Method[] methods = clazz.getMethods();
try {
if (null == result) {
return new ResultBean<T>(true, "Get Null result");
}
for (KeyValue keyValue : result.list()) {
String row = Bytes.toString(result.getRow());
String k = Bytes.toString(keyValue.getQualifier());
String v = Bytes.toString(keyValue.getValue());
for (Method method : methods) {
// 如果Bean中存在rowKey字段,用Key进行赋值
if (method.getName().equalsIgnoreCase("setRowKey")) {
try {
method.invoke(t, row);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
if (method.getName().equalsIgnoreCase("set" + k)) {
try {
method.invoke(t, v);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
} catch (Exception e) {
return new ResultBean<T>(e);
}
return new ResultBean<T>(t);
} /** 封装结果集 */
@Deprecated
public static ResultScanner getResultScanner(Table table, Scan scan) {
try {
return table.getScanner(scan);
} catch (IOException e) {
log.info("扫描" + table.getName() + "失败.");
e.printStackTrace();
return null;
}
} /** get方式查询数据
*
* @param table
* @param getList
* @param clazz
* @return */
public static List<?> getResultScannerPlus(Table table, List<Get> getList, Class<?> clazz) {
List<Object> list = new ArrayList<Object>();
Result[] results;
try {
results = table.get(getList);
for (Result result : results) {
Object instance = clazz.newInstance();
for (Cell kv : result.rawCells()) {
Field field = clazz.getDeclaredField(new String(CellUtil.cloneQualifier(kv)));
field.setAccessible(true);
field.set(instance, new String(CellUtil.cloneValue(kv)));
}
list.add(instance);
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
} public static ResultBean<ResultScanner> getResultScannerPlus(Table table, Scan scan) {
try {
//scan.setCaching(1000);
return new ResultBean<ResultScanner>(table.getScanner(scan));
} catch (IOException e) {
log.info("扫描" + table.getName() + "失败.");
e.printStackTrace();
return new ResultBean<>(e);
}
} /** 封装结果数据Map */
@SuppressWarnings({ "unchecked", "deprecation" })
public static <T> Map<String, T> getResultObjectMap(ResultScanner resultScanner, Class<?> clazz) {
Map<String, T> resultMap = new HashMap<String, T>();
Method[] methods = clazz.getMethods(); for (Result res : resultScanner) {
String key = Bytes.toString(res.getRow());
T t = null;
try {
t = (T) clazz.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} for (KeyValue keyValue : res.list()) {
String k = Bytes.toString(keyValue.getQualifier());
String v = Bytes.toString(keyValue.getValue());
for (Method method : methods) {
// 如果Bean中存在rowKey字段,用Key进行赋值
if (method.getName().equalsIgnoreCase("setRowKey")) {
try {
method.invoke(t, key);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
if (method.getName().equalsIgnoreCase("set" + k)) {
try {
method.invoke(t, v);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
resultMap.put(key, t);
}
return resultMap;
} /** 封装结果数据List */
@SuppressWarnings({ "unchecked", "deprecation" })
public static <T> List<T> getResultObjectList_bck(ResultScanner resultScanner, Class<?> clazz) {
List<T> resultList = new ArrayList<>();
Method[] methods = clazz.getMethods(); for (Result res : resultScanner) {
String key = Bytes.toString(res.getRow());
T t = null;
try {
t = (T) clazz.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
for (int i = 0; i < res.list().size(); i++) {
KeyValue keyValue = res.list().get(i);
String k = Bytes.toString(keyValue.getQualifier());
String v = Bytes.toString(keyValue.getValue());
for (int j = 0; j < methods.length; i++) {
Method method = methods[i];
if (method.getName().equalsIgnoreCase("setRowKey")) {
try {
method.invoke(t, key);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
if (method.getName().equalsIgnoreCase("set" + k)) {
try {
method.invoke(t, v);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
/*
* for (KeyValue keyValue : res.list()) { String k =
* Bytes.toString(keyValue.getQualifier()); String v =
* Bytes.toString(keyValue.getValue()); for (Method method : methods) { //
* 如果Bean中存在rowKey字段,用Key进行赋值 if
* (method.getName().equalsIgnoreCase("setRowKey")) { try { method.invoke(t,
* key); } catch (IllegalAccessException e) { e.printStackTrace(); } catch
* (IllegalArgumentException e) { e.printStackTrace(); } catch
* (InvocationTargetException e) { e.printStackTrace(); } } if
* (method.getName().equalsIgnoreCase("set" + k)) { try { method.invoke(t, v); }
* catch (IllegalAccessException e) { e.printStackTrace(); } catch
* (IllegalArgumentException e) { e.printStackTrace(); } catch
* (InvocationTargetException e) { e.printStackTrace(); } } } }
*/
resultList.add(t);
}
return resultList;
} @SuppressWarnings({ "deprecation", "unchecked" })
public static <T> List<T> getResultObjectList(ResultScanner resultScanner, Class<?> clazz) {
List<T> resultList = new ArrayList<>();
// Method[] methods = clazz.getMethods();
for (Result res : resultScanner) {
String key = Bytes.toString(res.getRow());
T t = null;
try {
t = (T) clazz.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
for (int i = 0; i < res.list().size(); i++) {
KeyValue keyValue = res.list().get(i);
String k = Bytes.toString(keyValue.getQualifier());
String v = Bytes.toString(keyValue.getValue());
Field field = null;
try {
if (!k.equals("serialVersionUID")) {
if (i == 1) {
field = clazz.getDeclaredField("rowKey");
field.setAccessible(true);
field.set(t, key);
}
field = clazz.getDeclaredField(k);
field.setAccessible(true);
field.set(t, v);
}
} catch (IllegalArgumentException | NoSuchFieldException | SecurityException
| IllegalAccessException e) {
e.printStackTrace();
}
}
resultList.add(t);
}
return resultList;
} /** 封装Put get */
public static Put getPut(String rowKye) {
Put put = new Put(Bytes.toBytes(rowKye));
return put;
} /** 封装Put set
*
* @throws IOException */
@Deprecated
public static void setPut(Table table, Put put) throws IOException {
table.put(put);
} public static ResultBean<String> setPutPlus(Table table, Put put) {
try {
table.put(put);
return new ResultBean<String>("Put Success");
} catch (IOException e) {
e.printStackTrace();
return new ResultBean<String>(e);
}
} /** 封装Put add */
@SuppressWarnings("deprecation")
public static Put putAdd(Put put, String colunmFamily, String colunmName, String value) {
put.add(Bytes.toBytes(colunmFamily), Bytes.toBytes(colunmName), Bytes.toBytes(value));
return put;
} /** 封装Delete,ROWKEY delete */
@Deprecated
public static void deleteRowByRowKey(Table table, String rowKey) {
Delete delete = new Delete(Bytes.toBytes(rowKey));
try {
table.delete(delete);
} catch (IOException e) {
log.info(rowKey + "行删除失败.");
e.printStackTrace();
}
} public static ResultBean<String> deleteRowByRowKeyPlus(Table table, String rowKey) {
Delete delete = new Delete(Bytes.toBytes(rowKey));
try {
table.delete(delete);
return new ResultBean<String>("Delete Success");
} catch (IOException e) {
log.info(rowKey + "行删除失败.");
return new ResultBean<String>(e);
}
} /** Close:需要调用时注意序列,从小到大进行排列 */
public static void close(Object... objects) {
for (Object o : objects) {
if (null != o) {
if (o instanceof ResultScanner) {
((ResultScanner) o).close();
} else if (o instanceof Scan) { } else if (o instanceof Table) {
try {
((Table) o).close();
} catch (IOException e) {
e.printStackTrace();
}
} else if (o instanceof Connection) {
try {
((Connection) o).close();
} catch (IOException e) {
e.printStackTrace();
}
} else {
throw new RuntimeException("未知对象:" + o.getClass().getName());
}
}
}
} /** 列过滤器:SingleColumnValueFilter<br>
* 用于在进行条件查询时,通过过滤参数条件自动生成过滤器(单个)<br>
* compareOp:
* <code>LESS 小于,LESS_OR_EQUAL 小于等于,EQUAL 等于,NOT_EQUAL 不等于,GREATER_OR_EQUAL 大于等于,GREATER 大于</code> */
public static Filter setSingleColumnValueFilter(String colunmFilterString, String splitString, String compareOp) {
String[] sp = colunmFilterString.split(splitString);
return new SingleColumnValueFilter(Bytes.toBytes(sp[0]), Bytes.toBytes(sp[1]), CompareOp.valueOf(compareOp),
Bytes.toBytes(sp[2].toString()));
} /** 对列过滤器设计过滤条件:SingleColumnValueFilter<br>
* 用于在进行条件查询时,通过对象合成过滤条件 */
public static List<String> setSingleColumnValueFilterParam(String colunmFamily, Object object, String splitString) {
List<String> params = new ArrayList<>();
for (Field field : object.getClass().getDeclaredFields()) {
Object value = ReflectUtil.getFiledValueByName(field.getName(), object);
if (null != value && !"".equals(value.toString())) {
params.add(colunmFamily + splitString + field.getName() + splitString + value.toString());
}
}
return params;
} /** 对HTable求Count(在有查询条件时,表现有问题,初步判断是由于FirstKeyOnlyFilter与其他过滤器不兼容) */
public static long getCountByFilter(String tableName, FilterList fl) {
long count = 0;
Scan scan = new Scan();
scan.setFilter(fl);
ResultScanner rs = null;
try {
rs = HBaseUtil.getTable(tableName).getScanner(scan);
Iterator<Result> it = rs.iterator();
while (it.hasNext()) {
it.next();
count += 1;
}
} catch (IOException e) {
e.printStackTrace();
}
close(rs);
return count;
} /** 做全表扫描时,根据page对象进行分页(可以通过FilterList传入过滤条件) */
public static <T> List<T> scanTableByPage(String tableName, Page page, Class<?> clazz, FilterList fl) {
List<T> rsList = null;
Scan scan = new Scan();// 全表扫描Scan
Filter pageFilter = null;// 分页过滤器
ResultScanner rs = null;
page.setTotalRecord((int) getCountByFilter(tableName, fl));// 设置page对象中总记录数
int pageNow = page.getPageNo();// 当前页
int pageSize = page.getPageSize();// 页大小
int recordSize = page.getTotalPage();// 总条数
int begin = 0;// 内容显示时开始的行号
if (pageNow == 1) {
// 首页分页处理,直接返回页大小值
pageFilter = new PageFilter(pageSize);
fl.addFilter(pageFilter);
scan.setFilter(fl);
rs = HBaseUtil.getResultScanner(HBaseUtil.getTable(tableName), scan);
rsList = HBaseUtil.getResultObjectList(rs, clazz);
} else {
begin = (pageNow - 1) * pageSize + 1;
if (begin > recordSize) {
// 如果是尾页,修改开始扫描行号
begin = (pageNow - 1) * pageSize + 1;
}
pageFilter = new PageFilter(begin);// 一次性扫描前n页+1的数据
fl.addFilter(pageFilter);
scan.setFilter(fl);
rs = HBaseUtil.getResultScanner(HBaseUtil.getTable(tableName), scan);
Iterator<Result> it = rs.iterator();
int b = 0;
byte[] startRow = null;
while (it.hasNext()) {
b++;
if (b == begin) {
startRow = it.next().getRow();// 通过迭代获取当前显示页首数据RowKey
}
it.next();
}
pageFilter = new PageFilter(pageSize);// 重置分页过滤器为页面数据大小
fl.addFilter(pageFilter);
scan.setFilter(fl);
scan.setStartRow(startRow);// 设置起始扫描RowKey
rs = HBaseUtil.getResultScanner(HBaseUtil.getTable(tableName), scan);
rsList = HBaseUtil.getResultObjectList(rs, clazz); }
// page.setTotalRecord(rsList.size());//
// 由于getCountByFilter在条件环境下有问题,重新进行值的设定
close(rs);
return rsList;
} /** 从KeyValue类型中,getKeyString方法获取真实的RowKey */
@SuppressWarnings({ "deprecation", "static-access" })
public static String getRealRowKey(KeyValue kv) {
int rowLength = Bytes.toShort(kv.getBuffer(), kv.getOffset() + kv.ROW_OFFSET);
String rowKey = Bytes.toStringBinary(kv.getBuffer(), kv.getOffset() + kv.ROW_OFFSET + Bytes.SIZEOF_SHORT,
rowLength);
return rowKey;
} public static Put putAddByBean(Put put, Object obj) {
for (Field field : obj.getClass().getDeclaredFields()) {
String firstLetter = field.getName().substring(0, 1).toUpperCase();
String getter = "get" + firstLetter + field.getName().substring(1);
Object value = null;
try {
// 构造的GET方法,如果没有,抛异常NoSuchMethodException
Method getMethod = obj.getClass().getMethod(getter, new Class[] {});
// 代理obj的GET方法,获取返回值
value = getMethod.invoke(obj, new Object[] {});
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
if (null == value || value.equals("") || value.equals("null")) { } else {
HBaseUtil.putAdd(put, "cf1", field.getName(), value.toString());
}
}
return put;
}
}

三、简单的HDFS文件存储(为了支持Hbase中的文件索引)

package com.pj.util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils; /** 操作分布式集群HDFS工具类
*
* @author ChenWen */
public class HDFSOptionUtil { /** 将本地文件上传到HDFS(不清楚为什么本地文件复制到HDFS,API会将本地文件删除掉):方法将true改成false
*
* @param localPathStr
* @param hdfsPathStr
* @throws IOException */
public static void localfileUpload(String localPathStr, String hdfsPathStr) throws IOException {
Configuration conf = new Configuration();
conf.addResource(new Path("hdfs-site.xml"));
conf.addResource(new Path("core-site.xml"));
FileSystem fs = FileSystem.get(conf);
Path localPath = new Path(localPathStr);
Path hdfsPath = new Path(hdfsPathStr);
fs.copyFromLocalFile(true, localPath, hdfsPath);
} /** HDFS文件下载
*
* @param hdfsPathStr
* @param localPathStr
* @throws IOException */
public static void fsFileDownload(String hdfsPathStr, String localPathStr) throws IOException {
Configuration conf = new Configuration();
conf.addResource(new Path("hdfs-site.xml"));
conf.addResource(new Path("core-site.xml"));
FileSystem fs = FileSystem.get(conf);
FSDataInputStream in = null;
FileOutputStream out = null;
try {
File aimFilePath = new File(localPathStr);
if (!aimFilePath.exists()) {
aimFilePath.mkdirs();
}
Path srcPath = new Path(hdfsPathStr); in = fs.open(srcPath);
File aimFile = new File(aimFilePath, srcPath.getName());
if (!aimFile.exists()) {
aimFile.createNewFile();
}
out = new FileOutputStream(aimFile);
IOUtils.copyBytes(in, out, 4096, false);
} finally {
IOUtils.closeStream(in);
IOUtils.closeStream(out);
}
}
}

四、补充

  1.使用的SystemConfig是用来获取系统配置文件键值对。

  2.ResultBean用来自定义返回值,具有异常栈存储、消息、值存储。

Hbase API 简单封装的更多相关文章

  1. Httpclient Fluent API简单封装

    import java.io.IOException;import java.util.ArrayList;import java.util.HashMap;import java.util.List ...

  2. 简单封装axios api

    可以在代码逻辑中写axios请求,处理请求结果,但是随着项目越来越大,代码会很繁琐,不容易维护,所以,可以把一些在所有请求中都要处理的逻辑抽取出来,封装成api方法.比如每次请求中都要判断是否有权限, ...

  3. FMDB简单封装和使用

    工具:火狐浏览器+SQLite Manager插件 ; Xcode; FMDB库; 效果: 项目地址: https://github.com/sven713/PackFMDB 主要参考这两篇博客: 1 ...

  4. Android--Retrofit+RxJava的简单封装(三)

    1,继续接着上一篇的讲讲,话说如果像上一篇这样的话,那么我们每一次请求一个结构都要创建一堆的Retrofit对象,而且代码都是相同的,我们可以试试封装一下 先创建一个HttpMethods类,将Ret ...

  5. 嵌入式 Linux下curl库API简单介绍

    1:CURLcode curl_global_init(long flags); 这个函数全局需要调用一次(多次调用也可以,不过没有必要), 所以这也是把Curlplus设计成单体类的原因,curl_ ...

  6. activemq api的封装

    今天无聊写段代码..学习一下activemq,简单封装了一下activemq 的topic api.跟jdbc很类似 主要代码: import java.io.Serializable; import ...

  7. MySQL的C++简单封装

    /* *介绍:MySQL的简单封装,支持流操作输入输出MySQL语句,然而并没有什么软用,大二学生自娱自乐,有不足求指点 *作者:MrEO *日期:2016.3.26 */ 头文件 my_sql.h ...

  8. salesforce零基础学习(八十五)streaming api 简单使用(接近实时获取你需要跟踪的数据的更新消息状态)

    Streaming API参考链接: https://trailhead.salesforce.com/en/modules/api_basics/units/api_basics_streaming ...

  9. DBUtils-对JDBC简单封装的开源工具类库

    DBUtils 是对JDBC简单封装的开源工具类 详细介绍地址:  https://baike.baidu.com/item/Dbutils/10655914?fr=aladdin 在使用DBUtil ...

随机推荐

  1. 阿里百川SDK初始化失败 错误码是203

    由idea换到Androidstudio 了,结果报这个错,之前好好的啊!!! 设置问题:

  2. jmeter 多个sql写在一个jdbc请求中注意事项

    在url里面加上?allowMultiQueries=true 类型选callableStatement

  3. js重点--原型链

    通过将一个构造函数的原型对象指向父类的实例,就可以调用父类中的实例属性及父类的原型对象属性,实现继承. function animals(){ this.type = "animals&qu ...

  4. Tomcat系列(11)——Tomcat 部署web应用的4种方法

    核心内容 1.在Tomcat中有四种部署Web应用的方式,分别是: (1)利用Tomcat自动部署(项目直接拷贝OR WAR包拷贝 到webapps下) (2)利用控制台进行部署(tomcat的man ...

  5. JS中如何获取JSON有多少个字段,JSON子项的个数或叫length

    如有JSON数据格式如下: {names:'张三','age':16,'sex':‘男’} 或 {names:'张三','age':16,'sex':‘男’} 如何获取JSON子键的数量?挺头疼的.使 ...

  6. [源码分析]StringBuilder

    [源码分析]StringBuilder StringBuilder是继承自AbstractStringBuilder的. 这里附上另外两篇文章的连接: AbstractStringBuilder :  ...

  7. 转载---JavaScript执行机制

    很好的一篇文章,原地址 JavaScript执行机制 这一次,彻底弄懂 JavaScript 执行机制 本文的目的就是要保证你彻底弄懂javascript的执行机制,如果读完本文还不懂,可以揍我. 不 ...

  8. vue+element 正则表达式进行表单验证

    <template> <el-form :model="form" label-width="115px" ref="form&qu ...

  9. navicat连接IEE数据库查询话单

    select * from cdl_raw_1x_12501_ztev8_sht_201811 t1 WHERE ( t1.call_start_time >= STR_TO_DATE( '20 ...

  10. 使用hql动态创建对象问题

    前段时间由于需求要添加报表数据,调整ireport后,打印pdf文件出现数据错位的情况,调试发现不是ireport问题,就查看了后台传送的数据,最后发现传送的对象属性值已经就是错位的,那就是获取对象时 ...