package com.weikou.beibeivideo.util;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import com.weikou.beibeivideo.entity.VideoType;
|
|
public class VideoTypeUtil {
|
public static String getVideoTypeName(VideoType type) {
|
String result = "";
|
List<String> nameList = new ArrayList<String>();
|
nameList.add(type.getName());
|
while (type.getParent() != null) {
|
type = type.getParent();
|
nameList.add(type.getName());
|
}
|
for (int i = nameList.size() - 1; i >= 0; i--) {
|
result += nameList.get(i) + "-";
|
}
|
if (result.endsWith("-"))
|
result = result.substring(0, result.length() - 1);
|
return result;
|
}
|
|
public static String getVideoRootName(VideoType type) {
|
while (type.getParent() != null) {
|
type = type.getParent();
|
}
|
return type.getName();
|
}
|
|
}
|