Skip to content

Commit

Permalink
Avoid creating a HashSet on each call to HollowObjectMapper.addObject()
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoszewnik committed Jan 5, 2017
1 parent 63c76b9 commit 51a5cf6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ public void initializeTypeState(Class<?> clazz) {
}

HollowTypeMapper getTypeMapper(Type type, String declaredName, String[] hashKeyFieldPaths) {
return getTypeMapper(type, declaredName, hashKeyFieldPaths, new HashSet<Type>());
return getTypeMapper(type, declaredName, hashKeyFieldPaths, null);
}

HollowTypeMapper getTypeMapper(Type type, String declaredName, String[] hashKeyFieldPaths, Set<Type> visited) {
String typeName = declaredName != null ? declaredName : HollowObjectTypeMapper.getDefaultTypeName(type);

HollowTypeMapper typeMapper = typeMappers.get(typeName);

if(typeMapper == null) {

if(visited == null)
visited = new HashSet<Type>();

if(type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType)type;
Expand Down

0 comments on commit 51a5cf6

Please sign in to comment.