Created
July 16, 2019 18:23
-
-
Save mttjj/ad733b7b8394e45889d38d173c8c04b0 to your computer and use it in GitHub Desktop.
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
public class Snippet | |
{ | |
public static void main(String[] args) | |
{ | |
Project p = getById(Project.class, 0); | |
System.out.println(p); | |
System.out.println(getById(Project.class, 1)); | |
} | |
private static <T extends Insertable> T getById(Class type, int id) | |
{ | |
return (T) new Project(); | |
} | |
private static class Project implements Insertable | |
{ | |
@Override | |
public String toString() | |
{ | |
StringBuilder result = new StringBuilder(); | |
result.append("Hello"); | |
return result.toString(); | |
} | |
} | |
interface Insertable | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment