Here you can find the source of classToInstance(String uriClass)
Parameter | Description |
---|---|
uriClass | URI of a class |
public static String classToInstance(String uriClass)
//package com.java2s; /**/*from w w w . jav a2 s . c o m*/ * Copyright 2015 Pozna? Supercomputing and Networking Center * * Licensed under the GNU General Public License, Version 3.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.gnu.org/licenses/gpl-3.0.txt * * 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. */ public class Main { /** * Constructs the URI for instance by the URI of class. * * @param uriClass * URI of a class * @return URI for an instance */ public static String classToInstance(String uriClass) { int sepidx = uriClass.indexOf('#'); if (sepidx == -1) { sepidx = uriClass.lastIndexOf('/'); } if (sepidx == -1) { sepidx = uriClass.lastIndexOf(':'); } if (sepidx == -1) { throw new IllegalArgumentException("No separator character founds in URI: " + uriClass); } sepidx++; String className = uriClass.substring(sepidx); if (className.length() > 0) { className = className.substring(0, 1).toLowerCase().concat(className.substring(1)); } return uriClass.substring(0, sepidx).concat(className).concat("Instance"); } }