Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix REST plugin generation on non-standard @Entities
- Loading branch information
1 parent
8c1c1da
commit 8964ab1
Showing
6 changed files
with
337 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
javaee-impl/src/test/resources/org/jboss/forge/spec/plugin/User.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import javax.persistence.Entity; | ||
import java.io.Serializable; | ||
import javax.persistence.Id; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Column; | ||
import javax.persistence.Version; | ||
import java.lang.Override; | ||
|
||
@Entity | ||
public class User implements Serializable | ||
{ | ||
|
||
@Id | ||
private @GeneratedValue(strategy = GenerationType.AUTO) | ||
@Column(name = "id", updatable = false, nullable = false) | ||
Long objectId = null; | ||
@Version | ||
private @Column(name = "version") | ||
int version = 0; | ||
|
||
public Long getObjectId() | ||
{ | ||
return this.objectId; | ||
} | ||
|
||
public void setObjectId(final Long id) | ||
{ | ||
this.objectId = id; | ||
} | ||
|
||
public int getVersion() | ||
{ | ||
return this.version; | ||
} | ||
|
||
public void setVersion(final int version) | ||
{ | ||
this.version = version; | ||
} | ||
|
||
public String toString() | ||
{ | ||
String result = ""; | ||
if (objectId != null) | ||
result += objectId; | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object that) | ||
{ | ||
if (this == that) | ||
{ | ||
return true; | ||
} | ||
if (that == null) | ||
{ | ||
return false; | ||
} | ||
if (getClass() != that.getClass()) | ||
{ | ||
return false; | ||
} | ||
if (objectId != null) | ||
{ | ||
return objectId.equals(((User) that).objectId); | ||
} | ||
return super.equals(that); | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
if (objectId != null) | ||
{ | ||
return objectId.hashCode(); | ||
} | ||
return super.hashCode(); | ||
} | ||
} |
Oops, something went wrong.