Skip to content

Instantly share code, notes, and snippets.

@JensRantil
Created February 8, 2014 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JensRantil/8879987 to your computer and use it in GitHub Desktop.
Save JensRantil/8879987 to your computer and use it in GitHub Desktop.
As close as one can get to a Java typedef. That is, wrapping a type. Lots of boilerplate code for something that could be so short and concise.
/**
* A first name.
* <p>
* In other programming languages, you would be able to write something like
* <code>
* typedef FirstName String;
* </code>
*/
public class FirstName {
private String firstName;
public FirstName(String firstName) {
this.firstName = firstName;
}
public String value() {
return firstName;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment