Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    private static final String TYPE_URL_PREFIX = "type.googleapis.com/";

    /**
     * @throws IllegalArgumentException if {@code typeUrl} is in invalid format.
     */
    public static void validate(String typeUrl) throws IllegalArgumentException {
        if (!typeUrl.startsWith(TYPE_URL_PREFIX)) {
            throw new IllegalArgumentException(String
                    .format("Error: type URL %s is invalid; it must start with %s\n", typeUrl, TYPE_URL_PREFIX));
        }
    }
}