[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/lomislu/JavaCodingStandards/master/README.md [Back]  [Original]

# 
- ,issue/PR
- ,issue/PR
- ``,
- project,

# 
1. IDE(IDEA/eclipse or other)
2. mysql (5.6+)
3. mysql client(navicat/mysql workbeach)
4. xshell and xftp
5. jdk1.7
6. emeditor
7. apache ant
8. apache maven
9. tortoise svn 64


# .
#### 1. 
[](https://translate.google.co.jp/)    
 `DaZhePromotion [] / getPingfenByName() [] / int  = 3`   
 `alibaba / taobao / youku / hangzhou`      

---
#### 2.  UpperCamelCase 
`MarcoPolo / UserDO / XmlService / TcpUdpDeal / TaPromotion `  
`macroPolo / UserDo / XMLService / TCPUDPDeal / TAPromotion `  

---
#### 3.  lowerCamelCase 
 `localValue / getHttpMessage() / inputUserId`

---
#### 4. 
 `MAX_STOCK_COUNT`    
 `MAX_COUNT`    

---
#### 5. 
  com.java.open.util MessageUtilsspring 

---
#### 6. 
 `AbstractClass` `AbsClass``condition` `condi`

---
#### 7. 



```
	public class OrderFactory;
	public class LoginProxy;
	public class ResourceObserver;
```
---
#### 8.  Enum 
   
`DealStatusEnum``SUCCESS / UNKOWN_REASON`   

---
#### 9.     
` _name / __name / $Object / name_ / name$ / Object$`

---
#### 10. public  Javadoc 

#### 11. Java .javaUTF-8

#### 12. UpperCamelCaselowerCamelCase
static final int CONNECTION_TIMEOUT = 10000

---
# .
#### 1. 
 

```
String key = "Id#taobao_"+tradeId
cache.put(key, value);
```

---

#### 2. long  Long  L l1 
Long a = 2l;  21 Long  2?

---
#### 3. 
CacheConsts ConfigConsts    
   

---
#### 4. 

```
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     
```

---
#### 5.



```
public Enum { 
   MONDAY(1),
   TUESDAY(2),
   WEDNESDAY(3),
   THURSDAY(4), 
   FRIDAY(5), 
   SATURDAY(6),
   SUNDAY(7);
   }
```

# . 

#### 1.  4  tab 
 tab  1  tab  4 IDEA  tab  4  `Use tab character` eclipse  `insert spaces for tabs`tab,html

---
#### 2.  120 

#### 3. Javadoc
Javadoc

```
/**
 * Javadoc
 * 
 * @param 
 * @return 
 * @throws 
 * @version 
 * @author 
 * @see  
 * @deprecated 
 */
```


---

# . OOP
#### 1. @Deprecated 

---
#### 2.  DO/DTO/VO  POJO 
POJO  gmtCreate  new Date(); , 

#### 3.   init 

---
#### 4. POJO  toString  IDE source> generate toString POJO  super.toString
 POJO  toString()

---
#### 5. 

---
#### 6.  >  > getter/setter
    
    
    
 Service  DAO  getter/setter   

---
#### 7.  setter this. = getter/setter 


```
public Integer getData() {
if (true) {
return data + 100;
} else {
return data - 100;
	}
}   
```

---
#### 8.  final 
1    
2  final   
3   

---
#### 9. 
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 

---
# . 
#### 1.  foreach  remove/add remove  Iterator Iterator 


```
List a = new ArrayList();
a.add("1");
a.add("2");
for (String temp : a) {
	if ("1".equals(temp)) {
		a.remove(temp);
		}
	}
```



```
Iterator it = a.iterator();
while (it.hasNext()) {
	String temp = it.next();
	if () {
	it.remove();
		}
	} 
```

--- 
# .
#### 1. null null  null  NPE 

--- 
#### 2.  try-catchcatch  catch 

--- 
#### 3. 

--- 
# . 
#### 1. return,return

---
#### 2.  throws 
logger.error( toString + "_" + e.getMessage(), e);

---
#### 3.  warn error  error 


---
: 

---
# 7. 

#### 1. ,,

```
    //  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;
        }
    }
```

---
#### 2. 

---
#### 3. bugbug,100%

---
#### 4. BUG


```
    /**
     * 
     *
     * @param rid rid
     * author: 
     * date: 2017-05-04 10:08
     */
    public void reqOpenPanel(int rid) {
    	// code
    }
```

--- 
#### 5. (0)3-3

```
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;
}

```

--- 
#### 6. Mapkey

`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";
    }
```

#### 7. (),,BUG
flag,  

# 
- [Javav1.2.0-1.pdf](https://github.com/xiaomoinfo/JavaCodingStandards/blob/master/%E9%98%BF%E9%87%8C%E5%B7%B4%E5%B7%B4Java%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8Cv1.2.0-1.pdf)
- [java2017.pdf](https://github.com/xiaomoinfo/JavaCodingStandards/blob/master/%E9%98%BF%E9%87%8C%E5%B7%B4%E5%B7%B4java%E7%BC%96%E7%A8%8B%E8%A7%84%E8%8C%832017%E7%89%88.pdf)
- [Android & Java ](https://juejin.im/post/5971d6436fb9a06bad65659a?utm_source=gold_browser_extension)

Web Proxy Viewer  |  New URL  |  Original Page