Java AbstractMap Usage parseVariableName(String variableName)

Here you can find the source of parseVariableName(String variableName)

Description

Parses a variable name (<facetOrComponentName>.<simpleName>).

License

Apache License

Parameter

Parameter Description
variableName a variable name (not null)

Return

a map entry (key = facet or component name, value = simple name)

Declaration

public static Map.Entry<String, String> parseVariableName(String variableName) 

Method Source Code

//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 (&lt;facetOrComponentName&gt;.&lt;simpleName&gt;).
     * <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 ( "", &lt; originalVariableName &gt; ) 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);
    }
}

Related

  1. getClassType(Object obj)
  2. getSymmetricPropertyValueDifference( Properties propertyFileOne, Properties propertyFileTwo)
  3. parseEntityURI(final String uri)
  4. parseExportedVariable(String exportedVariable)
  5. parseSocketAddress(String address)
  6. splitByQualifier(String str)
  7. splitIntSuffix(String string)
  8. splitQueryParam( String param)