Here you can find the source of parseVariableName(String variableName)
Parameter | Description |
---|---|
variableName | a variable name (not null) |
public static Map.Entry<String, String> parseVariableName(String variableName)
//package com.java2s; /**//from w w w . ja v a 2 s . c o m * Copyright 2014 Linagora, Universit? Joseph Fourier * * 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.AbstractMap; import java.util.Map; public class Main { /** * Parses a variable name (<facetOrComponentName>.<simpleName>). * <p> * All the variables (imported, or exported - after resolution) must be * prefixed by a component or facet name. * </p> * <p> * If the variable name was not prefixed by a component or a facet name, then * the couple ( "", < originalVariableName > ) is returned. * </p> * * @param variableName a variable name (not null) * @return a map entry (key = facet or component name, value = simple name) */ public static Map.Entry<String, String> parseVariableName(String variableName) { String componentOrFacetName = "", simpleName = variableName; int index = variableName.indexOf('.'); if (index >= 0) { componentOrFacetName = variableName.substring(0, index).trim(); simpleName = variableName.substring(index + 1).trim(); } return new AbstractMap.SimpleEntry<String, String>(componentOrFacetName, simpleName); } }