@EqualsAndHashCode(exclude="color")
private String name;
private @Getter(AccessLevel.PACKAGE) int size;
private String color;
private String style;
private boolean active;
@Synchronized
public void operate(String[] args) throws IOException {
@Cleanup InputStream in = new FileInputStream(args[0]);
//write file code goes here
}
}
Compiled from "Lure.java"
public class Lure extends java.lang.Object{
public void operate(java.lang.String[]) throws java.io.IOException;
public java.lang.String toString();
public boolean equals(java.lang.Object);
public int hashCode();
public spike.lombok.Lure();
public java.lang.String getName();
public void setName(java.lang.String);
public void setSize(int);
public java.lang.String getColor();
public void setColor(java.lang.String);
public java.lang.String getStyle();
public void setStyle(java.lang.String);
public boolean isActive();
public void setActive(boolean);
int getSize();
}
private String name;
private int size;
private String color;
private String style;
private boolean active;
private final Object $lock; //因为@Synchronized注释
public Lure() {
this.$lock = new Object[0];//因为@Synchronized注释
}
public void operate(String[] args) throws IOException {
synchronized (this.$lock) {//因为@Synchronized注释
InputStream in = new FileInputStream(args[0]);
try {//因为 @Cleanup注释
OutputStream out = new FileOutputStream(args[1]);
out.close();
} finally {
in.close();//因为 @Cleanup注释
}
}
}
int getSize() { return this.size; }//包可见访问限制, @Getter(AccessLevel.PACKAGE)注释
public String toString() {//因为 @ToString(exclude="color")注释,见不到处理 color属性
return "Lure(name=" + this.name + ", size=" + this.size + ", style="
+ this.style + ", active=" + this.active + ")";
}
/*
* 因为@EqualsAndHashCode(exclude="color")注释,见不到处理 color属性
* 此方法包含反编译生成代码时的错误,如break label64,与Lombok编织代码无关
*/
public boolean equals(Object o) {
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != super.getClass()) return false;
Lure other = (Lure) o;
if (this.name == null)
if (other.name == null) break label64;
else if (this.name.equals(other.name)) break label64;
return false;
if (this.size != other.size) label64: return false;
if (this.style == null)
if (other.style == null) break label110;
else if (this.style.equals(other.style)) break label110;
return false;
label110: return this.active == other.active;
}
/*
* 因为@EqualsAndHashCode(exclude="color")注释,见不到处理 color属性
* 存在反编译生成代码的情况,如 有 PRIME 的表达式,直接是 31, 与Lombok编织代码无关
*/
public int hashCode() {
int PRIME = 31;
int result = 1;
result = result * 31 + ((this.name == null) ? 0 : this.name.hashCode());
result = result * 31 + this.size;
result = result * 31 + ((this.style == null) ? 0 : this.style.hashCode());
return result * 31 + ((this.active) ? 1231 : 1237);
}
/*
* 因为 @Data注释,生成了随后的方法
*/
public String getName() { return this.name; }
public void setName(String name) { this.name = name; }
public void setSize(int size) { this.size = size; }
public String getColor() { return this.color; }
public void setColor(String color) { this.color = color; }
public String getStyle() { return this.style; }
public void setStyle(String style) { this.style = style; }
public boolean isActive() { return this.active; }
public void setActive(boolean active) { this.active = active; }
}