public List convert()

in hugegraph-tools/src/main/java/org/apache/hugegraph/cmd/SubCommands.java [1080:1110]


        public List<HugeType> convert(String value) {
            E.checkArgument(value != null && !value.isEmpty(),
                            "HugeType can't be null or empty");
            String[] types = value.split(",");
            if (types.length == 1 && types[0].equalsIgnoreCase("all")) {
                return AUTH_ALL_TYPES;
            }
            List<String> typeList = Arrays.asList(types);
            E.checkArgument(!typeList.contains(HugeType.BELONG.toString().toLowerCase()) ||
                            (typeList.contains(HugeType.USER.toString().toLowerCase()) &&
                             typeList.contains(HugeType.GROUP.toString().toLowerCase())),
                            "Invalid --type '%s', if type contains 'belong'" +
                            " then 'user' and 'group' are required.", value);
            E.checkArgument(!typeList.contains(HugeType.ACCESS.toString().toLowerCase()) ||
                            (typeList.contains(HugeType.GROUP.toString().toLowerCase()) &&
                             typeList.contains(HugeType.TARGET.toString().toLowerCase())),
                            "Invalid --type '%s', if type contains 'access'" +
                            " then 'group' and 'target' are required.", value);
            List<HugeType> hugeTypes = new ArrayList<>();
            for (String type : types) {
                try {
                    hugeTypes.add(HugeType.valueOf(type.toUpperCase()));
                } catch (IllegalArgumentException e) {
                    throw new IllegalArgumentException(String.format(
                              "Invalid --type '%s', valid value is 'all' or " +
                              "combination of [user,group,target," +
                              "belong,access]", type));
                }
            }
            return hugeTypes;
        }