Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.graalvm.nativeimage;
import java.lang.reflect.Field;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* Features allow clients to intercept the native image generation and run custom initialization
* code at various stages. All code within feature classes is executed during native image
* generation, and never at run time.
*
* Features have several advantages over static class initializers (which also run during native
* image generation):
*
*
The different feature methods are called at different stages during native image generation,
* which gives clients control over when code is executed.
*
Feature methods have an {@code access} parameter that allows callbacks into the native image
* generator.
*
Feature methods run when the {@link ImageSingletons} is already set up, which allows features
* to prepare data structures that are then used at run time by querying the {@link ImageSingletons}
* .
*
*
* Implementation classes must have a no-argument constructor, which is used to instantiate a
* singleton instance for each feature using reflection. The following features are included during
* native image generation:
*
*
Features explicitly specified on the command line.
*
Features referenced as {@link #getRequiredFeatures() required} by another included feature.
* Required features are added transitively, and initialization methods of required features are
* called after invoking the constructor and {@link #isInConfiguration} of the requiring features
* (unless the feature dependencies are cyclic).
*
*/
@Platforms(Platform.HOSTED_ONLY.class)
public interface Feature {
/**
* Access methods that are available for all feature methods.
*/
@Platforms(Platform.HOSTED_ONLY.class)
interface FeatureAccess {
/**
* Returns a class if it is present on the classpath.
*/
Class> findClassByName(String className);
}
/**
* Access methods available for {@link Feature#isInConfiguration}.
*/
@Platforms(Platform.HOSTED_ONLY.class)
interface IsInConfigurationAccess extends FeatureAccess {
}
/**
* Access methods available for {@link Feature#afterRegistration}.
*/
@Platforms(Platform.HOSTED_ONLY.class)
interface AfterRegistrationAccess extends FeatureAccess {
}
/**
* Access methods available for {@link Feature#duringSetup}.
*/
@Platforms(Platform.HOSTED_ONLY.class)
interface DuringSetupAccess extends FeatureAccess {
/**
* Registers the provided function to replace objects.
*
* The function checks if an object should be replaced. In such a case, the function creates
* the new object and returns it. The function must return the original object if the object
* should not be replaced.
*/
void registerObjectReplacer(Function