Created
June 20, 2011 16:08
-
-
Save sebersole/1035899 to your computer and use it in GitHub Desktop.
EntityClassName
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 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