Here you can find the source of toString(Class>[] modelPath)
Parameter | Description |
---|---|
modelPath | the subject model path |
public static String toString(Class<?>[] modelPath)
//package com.java2s; /*/*from w w w. j av a2 s. c o m*/ * File created on Mar 12, 2016 * * Copyright (c) 2016 Carl Harris, Jr * and others as noted * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.Arrays; import java.util.List; public class Main { /** * Converts a model path to a string representation. * @param modelPath the subject model path * @return model path string */ public static String toString(Class<?>[] modelPath) { return toString(Arrays.asList(modelPath)); } /** * Converts a model path to a string representation. * @param modelPath the subject model path * @return model path string */ public static String toString(List<Class<?>> modelPath) { if (modelPath.size() == 1) { return modelPath.get(0).getSimpleName(); } final StringBuilder sb = new StringBuilder(); int i = 0; sb.append("["); for (Class<?> modelClass : modelPath) { sb.append(modelClass.getSimpleName()); if (++i < modelPath.size()) { sb.append(", "); } } sb.append("]"); return sb.toString(); } }