public static void generateImmutableCollectionIfPossible(ModelClass<?> entity, Builder methodBuilder, String name,
			TypeName typeName) {
		if (TypeUtility.isList(typeName)
				&& ((ParameterizedTypeName) typeName).rawType.equals(ClassName.get(List.class))) {
			methodBuilder.addCode("($L==null ? null : $T.unmodifiableList($L))", name, Collections.class, name);
		} else if (TypeUtility.isSet(typeName)
				&& ((ParameterizedTypeName) typeName).rawType.equals(ClassName.get(SortedSet.class))) {
			methodBuilder.addCode("($L==null ? null : $T.unmodifiableSortedSet($L))", name, Collections.class, name);
		} else if (TypeUtility.isSet(typeName)
				&& ((ParameterizedTypeName) typeName).rawType.equals(ClassName.get(Set.class))) {
			methodBuilder.addCode("($L==null ? null : $T.unmodifiableSet($L))", name, Collections.class, name);
		} else if (TypeUtility.isMap(typeName)
				&& ((ParameterizedTypeName) typeName).rawType.equals(ClassName.get(SortedMap.class))) {
			methodBuilder.addCode("($L==null ? null : $T.unmodifiableSortedMap($L))", name, Collections.class, name);
		} else if (TypeUtility.isMap(typeName)
				&& ((ParameterizedTypeName) typeName).rawType.equals(ClassName.get(Map.class))) {
			methodBuilder.addCode("($L==null ? null : $T.unmodifiableMap($L))", name, Collections.class, name);
		} else {
			methodBuilder.addCode(name);
		}
	}
public static void generateImmutableCollectionIfPossible ( ModelClass < ? > entity , Builder methodBuilder , String name , TypeName typeName ) { if ( TypeUtility . isList ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( List . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableList($L))" , name , Collections . class , name ) ; } else if ( TypeUtility . isSet ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( SortedSet . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableSortedSet($L))" , name , Collections . class , name ) ; } else if ( TypeUtility . isSet ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( Set . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableSet($L))" , name , Collections . class , name ) ; } else if ( TypeUtility . isMap ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( SortedMap . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableSortedMap($L))" , name , Collections . class , name ) ; } else if ( TypeUtility . isMap ( typeName ) && ( ( ParameterizedTypeName ) typeName ) . rawType . equals ( ClassName . get ( Map . class ) ) ) { methodBuilder . addCode ( "($L==null ? null : $T.unmodifiableMap($L))" , name , Collections . class , name ) ; } else { methodBuilder . addCode ( name ) ; } }
used for example for dao select result

@param entity
@param methodBuilder
@param name
@param typeName