Java Code Examples for

Following code examples demonstrate how to use from java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use and various code implementation of this class.
Example 1
Project : java Source File : View Source Code on GitHub

    public static void loadService() {
        ServiceLoader<ContentHandler> loader = ServiceLoader.load(ContentHandler.class);
        StringBuilder packages = new StringBuilder(System.getProperty("java.content.handler.pkgs", ""));
System.err.println("java.content.handler.pkgs: before: " + packages);
        for (ContentHandler handler : loader) {
            String packageName = handler.getClass().getPackage().getName();
            String superPackageName = packageName.substring(0, packageName.lastIndexOf('.'));
            if (packages.indexOf(superPackageName) < 0) {
                if (packages.length() != 0) {
System.err.println("java.content.handler.pkgs: after: " + packages);
        System.setProperty("java.content.handler.pkgs", packages.toString());
Example 2
Project : java Source File : View Source Code on GitHub

    public default void verifyGenericType()
    throws Exception {
        final Class<SUT> sut = createNewSUT();
        assertTrue("This j8unit test interface is used with a generic type that is illegaly not assignable to ContentHandler.class!",