Java coding specification (daily coding summary, standardizing project team members have a unified specification, convenient cooperation, error checking, refactoring, etc.) When you abandon the specification to write code as you like when you come back to read it, Remove all the impulses of rewriting.
MIT License
DaZhePromotion [] / getPingfenByName() [] / int = 3
alibaba / taobao / youku / hangzhou
MarcoPolo / UserDO / XmlService / TcpUdpDeal / TaPromotion
macroPolo / UserDo / XMLService / TCPUDPDeal / TAPromotion
localValue / getHttpMessage() / inputUserId
MAX_STOCK_COUNT
MAX_COUNT
com.java.open.util MessageUtilsspring
AbstractClass
AbsClass``condition
condi
public class OrderFactory;
public class LoginProxy;
public class ResourceObserver;
DealStatusEnum``SUCCESS / UNKOWN_REASON
_name / __name / $Object / name_ / name$ / Object$
static final int CONNECTION_TIMEOUT = 10000
String key = "Id#taobao_"+tradeId
cache.put(key, value);
Long a = 2l; 21 Long 2?
CacheConsts ConfigConsts
1 client.jar constant
2 modules constant
A public static final String YES = "yes";
B public static final String YES = "y";
A.YES.equals(B.YES) true false
3 constant
4 constant
5 private static final
public Enum {
MONDAY(1),
TUESDAY(2),
WEDNESDAY(3),
THURSDAY(4),
FRIDAY(5),
SATURDAY(6),
SUNDAY(7);
}
tab 1 tab 4 IDEA tab 4 Use tab character
eclipse insert spaces for tabs
tab,html
Javadoc
/**
* Javadoc
*
* @param
* @return
* @throws
* @version
* @author
* @see
* @deprecated
*/
POJO gmtCreate new Date(); ,
POJO toString()
Service DAO getter/setter
public Integer getData() {
if (true) {
return data + 100;
} else {
return data - 100;
}
}
1 2 final 3
1 new private 2 public default 3 static protected 4 static private 5 static private 6 static final 7 private 8 protected
private public service public
List<String> a = new ArrayList<String>();
a.add("1");
a.add("2");
for (String temp : a) {
if ("1".equals(temp)) {
a.remove(temp);
}
}
Iterator<String> it = a.iterator();
while (it.hasNext()) {
String temp = it.next();
if () {
it.remove();
}
}
logger.error( toString + "_" + e.getMessage(), e);
: <JAVA>
// 2017/01/04 http://192.168.1.88:8010/index.php?m=story&f=view&storyID=7775
if ((instanceConfig.getInstanceType() & 1) == 1) { // BOSS
itemNum += extraAdd;
}
if (itemConfig.getCarrymax() > 0) {
int count = BagApiNew.getItemCount(bag, itemId) + StorageApi.getItemCount(rid, itemId);
if (count + itemNum >= itemConfig.getCarrymax()) {//
LOGGER.error("{}|{}|{}itemId:{},itemNum:{},oldNum:{}{}", rid, role.get("name"), instanceConfig.getMapid(), itemId, itemNum, count, itemConfig.getCarrymax());
itemNum = itemConfig.getCarrymax() - count;
}
}
/**
*
*
* @param rid rid
* author:
* date: 2017-05-04 10:08
*/
public void reqOpenPanel(int rid) {
// code
}
package rpg.system.task.constant;
public interface TaskType {
int JIFENGFUMO = 4;
int CAIJI = 5;
int XIANGYAOFUMO = 8;
int BIG_BOSS = 10; //
int QIYUXUNHUAN = 11;
int JINDU = 12;
int TIAOZHAN = 13;
int TREASURE_BOWL = 14;//
int QIYUSUIJI = 23;
int CANGYUE_ISLAND = 100;
}
uparm
constant
, XxxConst
,XxxField
uparm
UparmManager.java
bean
ComposeBean.java
XilianBean.java
constant
ArmFromConst.java
ArmField.java
handler
ReqAddQhFailNumHandler.java
ReqDecomposeHandler.java
ReqZyqhHandler.java
Field
:
public interface LimitTimeTaskField {
/**
*
*/
int TASK_ACCEPT_STATE = 1;
/**
*
*/
int TASK_COMPLETE_STATE = 2;
/**
*
*/
String LIMIT_TIME_TASK_INFO = "LIMIT_TIME_TASK_INFO";
/**
* id
*/
String LIMIT_TIME_TASK_GROUP_ID ="LIMIT_TIME_TASK_GROUP_ID";
}
flag,