Validate the given application name.

@param name The application name
@param typeDescription The detailed information about name
767100
protected void validateName(String name, String typeDescription) {
        if (!APPLICATION_NAME_PATTERN.matcher(name).matches()) {
            throw new DiscoveryException(typeDescription + " [" + name + "] must start with a letter, end with a letter or digit and contain only letters, digits or hyphens. Example: foo-bar");
        }
    }
1044787
public static ErrorCode isNameValid(String name) {
        if (!isMustFieldValid(name, nameRegEx)) {
            return ErrorCode.SERVICE_INSTANCE_NAME_FORMAT_ERROR;
        }
        return ErrorCode.OK;
    }
1093523
protected static String qualifiedNameFromIdAndContext(String name, String context) {
        if (!name.contains(".")) {
            return context + "." + name;
        }
        return name;
    }
777714
@Override
	public void require(int type, String namespace, String name) throws KriptonRuntimeException, IOException {
		if (type != this.type || (namespace != null && !namespace.equals(getNamespace())) || (name != null && !name.equals(getName()))) {
			throw new KriptonRuntimeException("expected: " + TYPES[type] + " {" + namespace + "}" + name, true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
		}
	}
357827
public void eInit(SarlScript script, String name, IJvmTypeProvider context) {
		setTypeResolutionContext(context);
		if (this.sarlAnnotationType == null) {
			this.container = script;
			this.sarlAnnotationType = SarlFactory.eINSTANCE.createSarlAnnotationType();
			script.getXtendTypes().add(this.sarlAnnotationType);
			this.sarlAnnotationType.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration());
			if (!Strings.isEmpty(name)) {
				this.sarlAnnotationType.setName(name);
			}
		}
	}
290255
@Override
	public final boolean propertyExists(String name)
    {
        if (name == null || name.length() == 0)
            throw new IllegalArgumentException("Empty property name");
        
        assertDeserializationLevel(MessageSerializationLevel.ALL_HEADERS);
        return propertyMap != null ? propertyMap.containsKey(name) : false;
    }
1294227
def register_type(cls, name):
    """"""
    x = TypeDefinition(name, (cls,), ())
    Validator.types_mapping[name] = x
948224
private void requiredParameter(String value, String name, String description)
    throws WebApplicationException
  {
    if (value == null)
    {
      throw new WebApplicationException(
        Response.status(Response.Status.BAD_REQUEST).type(
        MediaType.TEXT_PLAIN).entity(
        "missing required parameter '" + name + "' (" + description + ")").
        build());
    }
  }
175598
private static void checkForKeyword(String name) {
    if (KEYWORDS.contains(name) || KEYWORDS.contains(name.toUpperCase())) {
      throw new MolgenisDataException(
          "Name [" + name + "] is not allowed because it is a reserved keyword.");
    }
  }
643189
private ApplicationDefinition checkApplicationKey(ApplicationDefinition appDef) {
        Tenant tenant = Tenant.getTenant(appDef);
        ApplicationDefinition currAppDef = getApplication(tenant, appDef.getAppName());
        if (currAppDef == null) {
            m_logger.info("Defining application: {}", appDef.getAppName());
        } else {
            m_logger.info("Updating application: {}", appDef.getAppName());
            String appKey = currAppDef.getKey();
            Utils.require(Utils.isEmpty(appKey) || appKey.equals(appDef.getKey()),
                          "Application key cannot be changed: %s", appDef.getKey());
        }
        return currAppDef;
    }
729804
public static String getDescription(TypeDeclaration type) {
		if (type == null || type.description() == null) {
			return null;
		} else {
			return type.description().value();
		}
	}
108602
static void checkInternalName(final String name, final String msg) {
        if (name == null || name.length() == 0) {
            throw new IllegalArgumentException("Invalid " + msg
                    + " (must not be null or empty)");
        }
        if (name.charAt(0) == '[') {
            checkDesc(name, false);
        } else {
            checkInternalName(name, 0, -1, msg);
        }
    }
608252
public boolean shouldShowType(String contextKey, String typeName) {

        Map<String, CmsDefaultSet<String>> allowedContextMap = safeGetAllowedContextMap();
        CmsDefaultSet<String> allowedContexts = allowedContextMap.get(typeName);
        if (allowedContexts == null) {
            return true;
        }
        return allowedContexts.contains(contextKey);
    }
282217
private void checkStringIsValidName(final String s) throws PackageNameException {
        final boolean packageContainsJavaKeyword = javaKeywords.stream().anyMatch(s::equals);
        if (packageContainsJavaKeyword || s.matches("\\d.*")) {
            throw new PackageNameException("string is not valid");
        }
    }
566346
public static boolean isJavaBasicType(@Nullable String name) {
        if (StringUtils.isEmpty(name)) {
            return false;
        }
        return isJavaLangType(name) || BASIC_TYPE_MAP.containsKey(name);
    }
321067
public void validateTrue(boolean value, String name) {
        validateTrue(value, name, messages.get(Validation.TRUE_KEY.name(), name));
    }
838209
@Override
    public void validateUpdate(IDataType newType) throws TypeUpdateException {
        if (!getName().equals(newType.getName()) || !getClass().getName().equals(newType.getClass().getName())) {
            throw new TypeUpdateException(newType);
        }
    }