- 👋 Hi, I’m @zhongl ...
zhongl / hs4j Goto Github PK
View Code? Open in Web Editor NEWThis project forked from killme2008/hs4j
HandlerSocket client for java
Home Page: http://code.google.com/p/hs4j/
License: Apache License 2.0
This project forked from killme2008/hs4j
HandlerSocket client for java
Home Page: http://code.google.com/p/hs4j/
License: Apache License 2.0
example:
@HandlerSocket(UPDATE)
boolean update(Block block) throws IOException;
Block is a self-defined type, includes some member variables, and the primary key of indicated table block_t is a composite key: id and datanode_id.
when update is executed, only the id is passed as the key, i read the code in KIT and found the reason:
Collector<String[]> com.github.zhongl.hs4j.kit.proxy.UpdateHandler.keysCollector is initialized as "new EntityCollector(KEYS)", so toStringArray(fieldValues[PRIMARY]) will generate the key, and only the (CollectStrategy.PRIMARY = 0) is used to collect the key.
@HandlerSocket(UPDATE)
public void update(User user);
hs4j-kit would open index with columns
are all the fields of User, but UpdateHandler send the values
not include id's .
A null
value maybe insert
or update
in same scene, but StringUtils.toStringArray can not handle it.
HandlerSocket open two port to separate read and write, so it would be better that HandlerSocketProxyFactory can support read by readable HsClient, and write by writable HsClient.
ResultItertor is friendly to Resultset but not to users.
So, primitive, string, entity or collection would be better, like as:
interface UserRepository {
User findById(long value);
Collection<User> findByName(String value);
Collection<Integer> findAgesOfUserByName(String value);
}
ReturnType.toUserFriendlyObject(ResultSet result)对于返回的null类型<太友好了>,如果非基本类型直接设置为null会更好一点。比如对于Integer类型,如果返回值之null不要转换为0,直接设置为null会更好
准确说,这个bug来自于HS4J本身,对于Integer等类型的null值备自动设置为0了,0和null实际上是不同的结果
A UndeclaredThrowableException maybe throwed by proxy from hs4j , that is not good for using.
By declaring Exception on method, or an option can be set to ProxyFactory, a customized Exception can be throwed instead of UndeclaredThrowableException.
For easier parallel development, developer need set his owner database for debug in the same mysql server.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.