Returns a {@link NameID} that its name format equals to the specified {@code expectedFormat},
from the {@link Response}.
2821
public static Optional<NameID> getNameId(Response response, SamlNameIdFormat expectedFormat) {
        return getNameId(response, nameId -> nameId.getFormat().equals(expectedFormat.urn()));
    }
1089577
public static String formatNameForClassLoading(String name) {
        if (name == null) {
            return "java.lang.Object;";
        }

        if (TypeUtil.isPrimitiveType(name)) {
            return name;
        }

        if (name.startsWith("[")) {
            return name.replace('/', '.');
        }

        if (name.startsWith("L")) {
            name = name.substring(1);
            if (name.endsWith(";")) {
                name = name.substring(0, name.length() - 1);
            }
            return name.replace('/', '.');
        }

        String prefix = "";
        if (name.endsWith("[]")) { // todo need process multi
            prefix = "[";
            name = name.substring(0, name.length() - 2);

            return prefix + TypeUtil.getDescriptionByName(name);
        }

        return name.replace('/', '.');
    }
123839
private boolean containsFormatName(String format) {
        return name.equalsIgnoreCase(format) || synonyms.contains(format.toLowerCase());

    }
146530
private static String utf8Name(final String name) {
    final Matcher matcher = pattern.matcher(name);
    if (!matcher.matches())
      return name;
    if (matcher.group(2).isEmpty())
      return matcher.group(1);
    return matcher.group(1) + getSubscript(matcher.group(2));
  }
1104131
public String getFormatCode(long id)
    {
        if(numFmts == null)
            cacheFormatCodes();
        return (String)numFmts.get(new Long(id));
    }
398955
@Override
    protected String getInstanceIdName(int id)
    {
        switch (id - super.getMaxInstanceId()) {
          case Id_ignoreComments:               return "ignoreComments";
          case Id_ignoreProcessingInstructions: return "ignoreProcessingInstructions";
          case Id_ignoreWhitespace:             return "ignoreWhitespace";
          case Id_prettyIndent:                 return "prettyIndent";
          case Id_prettyPrinting:               return "prettyPrinting";
        }
        return super.getInstanceIdName(id);
    }
953841
public static String convertUnderscoreNameToClassName(String name) {
        StringBuffer result = new StringBuffer();
        boolean nextIsUpper = false;

        if (name != null) {
            int len = name.length();

            if (len > 0) {
                String s = String.valueOf(name.charAt(0));

                result.append(s.toUpperCase());

                for (int i = 1; i < len; i++) {
                    s = String.valueOf(name.charAt(i));

                    if ("_".equals(s)) {
                        nextIsUpper = true;
                    } else {
                        if (nextIsUpper) {
                            result.append(s.toUpperCase());
                            nextIsUpper = false;
                        } else {
                            result.append(s.toLowerCase());
                        }
                    }
                }
            }
        }

        return result.toString();
    }
513369
public JsonReader beginArray(String expectedName) throws IOException {
      String name = beginArray();
      if (!StringUtils.isNullOrBlank(expectedName) && (name == null || !name.equals(expectedName))) {
         throw new IOException("Expected " + expectedName);
      }
      return this;
   }
1141850
public String getName(String name) {
        StringBuilder sb = new StringBuilder();
        char ch;
        /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions
         * that the name/id should begin with a letter followed by other valid characters.
         * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction
         * is that it should be at least one character long and should not contain spaces.
         * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute.
         *
         * For HTML 4, we need to check for non-characters at the beginning of the name and
         * substitute it accordingly, "_" and "$" can appear at the beginning of a member name.
         * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z".
         */
        for (int i = 0; i < name.length(); i++) {
            ch = name.charAt(i);
            switch (ch) {
                case '(':
                case ')':
                case '<':
                case '>':
                case ',':
                    sb.append('-');
                    break;
                case ' ':
                case '[':
                    break;
                case ']':
                    sb.append(":A");
                    break;
                // Any appearance of $ needs to be substituted with ":D" and not with hyphen
                // since a field name "P$$ and a method P(), both valid member names, can end
                // up as "P--". A member name beginning with $ needs to be substituted with
                // "Z:Z:D".
                case '$':
                    if (i == 0)
                        sb.append("Z:Z");
                    sb.append(":D");
                    break;
                // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor
                // names can only begin with a letter.
                case '_':
                    if (i == 0)
                        sb.append("Z:Z");
                    sb.append(ch);
                    break;
                default:
                    sb.append(ch);
            }
        }
        return sb.toString();
    }
756152
def get_nameid_format(request, key=None):
        
        name_id_format = None
        name_id_data = OneLogin_Saml2_Logout_Request.get_nameid_data(request, key)
        if name_id_data and 'Format' in name_id_data.keys():
            name_id_format = name_id_data['Format']
        return name_id_format
1075279
public String getNameId() throws Exception {
		NodeList nodes = xmlDoc.getElementsByTagNameNS("urn:oasis:names:tc:SAML:2.0:assertion", "NameID");

		if (nodes.getLength() == 0) {
			throw new Exception("No name id found in document");
		}

		return nodes.item(0).getTextContent();
	}
924608
public String generateName(String name) {
    checkName(name);
    names.add(name);
    int count = names.count(name);
    if (count == 1) {
      return name;
    }
    return name + collisionSeparator + (count - 1);
  }
512858
protected static String getRequiredNameIdFormatIfAny(final RequestAbstractType authnRequest) {
        val nameIDPolicy = getNameIDPolicy(authnRequest);
        val requiredNameFormat = nameIDPolicy != null ? nameIDPolicy.getFormat() : null;
        LOGGER.debug("AuthN request indicates [{}] is the required NameID format", requiredNameFormat);
        return requiredNameFormat;
    }
867421
public String getShortName(Locale locale, String id, String nameKey, boolean standardTime) {
        String[] nameSet = getNameSet(locale, id, nameKey, standardTime);
        return nameSet == null ? null : nameSet[0];
    }
382371
public static TypeSignature ofNamed(String name, Object namedTypeDescriptor) {
        return new TypeSignature(requireNonNull(name, "name"),
                                 requireNonNull(namedTypeDescriptor, "namedTypeDescriptor"));
    }
815579
@Override
    public TZID getID() {

        if (this.id == null) {
            String zoneID = java.util.TimeZone.getDefault().getID();
            return new NamedID(zoneID);
        } else {
            return this.id;
        }

    }
1116548
public String checkName(String name) throws Failure {
        if(name==null)
            throw new Failure("Query parameter 'name' is required");

        name = name.trim();
        Jenkins.checkGoodName(name);

        if(Jenkins.getInstance().getNode(name)!=null)
            throw new Failure(Messages.ComputerSet_SlaveAlreadyExists(name));

        // looks good
        return name;
    }