Skip to content

Instantly share code, notes, and snippets.

@sebersole
Created June 20, 2011 16:08
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 sebersole/1035899 to your computer and use it in GitHub Desktop.
Save sebersole/1035899 to your computer and use it in GitHub Desktop.
EntityClassName
public class EntityClassName {
private final String entityName;
private final String entityClassName;
private final InitializeOnceField<Class> entityClassReference;
public EntityClassName(String entityName, String entityClassName) {
entityClassReference = new InitializeOnceField<Class>(
new InitializeOnceField.Initializer<Class>() {
public Class initialize() {
Class entityClass = getConfiguredClass().getClassReference( entityClassName );
if ( entityClass == null ) {
entityClassReference = getClassLoadingService().classForName( entityClassName );
}
}
}
);
}
...
public Class getEntityClassReference() {
return entityClassReference.getValue();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment