/** * Creates new instance of {@link ForeignAccess} that delegates to provided factory. * * @param factory the factory that handles access requests to {@link Message}s * @param languageCheck a {@link RootNode} that performs the language check on receiver objects, * can be <code>null</code>, but then the factory must also implement {@link Factory} * interface * @return new instance wrapping <code>factory</code> * @since 0.30 * @deprecated Use * {@link #createAccess(com.oracle.truffle.api.interop.ForeignAccess.StandardFactory, java.util.function.Supplier) * method */ @Deprecated public static ForeignAccess create(final StandardFactory factory, final RootNode languageCheck) { if (languageCheck == null) { Factory f = (Factory) factory; assert f != null; } return new ForeignAccess( languageCheck == null ? null : new RootNodeSupplier(languageCheck), new DelegatingFactory(null, factory)); }
/** * Creates new instance of {@link ForeignAccess} that delegates to provided factory. * * @param baseClass the super class of all {@link TruffleObject}s handled by this factory (if * <code>null</code> then the second interface must also implement {@link Factory}) * @param factory the factory that handles access requests to {@link Message}s * @return new instance wrapping <code>factory</code> * @since 0.30 */ public static ForeignAccess create(final Class<? extends TruffleObject> baseClass, final StandardFactory factory) { if (baseClass == null) { Factory f = (Factory) factory; assert f != null; } return new ForeignAccess(new DelegatingFactory(baseClass, factory)); }
/** * Creates new instance of {@link ForeignAccess} that delegates to provided factory. * * @param factory the factory that handles access requests to {@link Message}s * @param languageCheckSupplier a {@link Supplier} of {@link RootNode} that performs the * language check on receiver objects, can be <code>null</code>, but then the factory * must also implement {@link Factory} interface * @return new instance wrapping <code>factory</code> * @since 1.0 */ public static ForeignAccess createAccess(final StandardFactory factory, final Supplier<? extends RootNode> languageCheckSupplier) { if (languageCheckSupplier == null) { Factory f = (Factory) factory; assert f != null; } return new ForeignAccess(languageCheckSupplier, new DelegatingFactory(null, factory)); }
/** * Creates new instance of {@link ForeignAccess} that delegates to provided factory. * * @param baseClass the super class of all {@link TruffleObject}s handled by this factory (if * <code>null</code> then the second interface must also implement {@link Factory}) * @param factory the factory that handles access requests to {@link Message}s * @return new instance wrapping <code>factory</code> * @since 0.30 */ public static ForeignAccess create(final Class<? extends TruffleObject> baseClass, final StandardFactory factory) { if (baseClass == null) { Factory f = (Factory) factory; assert f != null; } return new ForeignAccess(new DelegatingFactory(baseClass, factory)); }
/** * Creates new instance of {@link ForeignAccess} that delegates to provided factory. * * @param factory the factory that handles access requests to {@link Message}s * @param languageCheck a {@link RootNode} that performs the language check on receiver objects, * can be <code>null</code>, but then the factory must also implement {@link Factory} * interface * @return new instance wrapping <code>factory</code> * @since 0.30 */ public static ForeignAccess create(final StandardFactory factory, final RootNode languageCheck) { if (languageCheck == null) { Factory f = (Factory) factory; assert f != null; } return new ForeignAccess(languageCheck, new DelegatingFactory(null, factory)); }
@Override public CallTarget accessMessage(Message msg) { return accessMessage(factory, msg); }
@Override public CallTarget accessMessage(Message msg) { return accessMessage(factory, msg); }