Package org.glassfish.hk2.utilities.binding

Examples of org.glassfish.hk2.utilities.binding.ScopedBindingBuilder


     *
     * @param name The name to look for
     * @return The indexed filter that can be used to calls to ServiceLocator methods
     */
    public static IndexedFilter createNameFilter(String name) {
        return new IndexedFilterImpl(null, name);
    }
View Full Code Here


     * @param contract The advertised contract to look for
     * @param name The name to look for
     * @return The indexed filter that can be used to calls to ServiceLocator methods
     */
    public static IndexedFilter createNameAndContractFilter(String contract, String name) {
        return new IndexedFilterImpl(contract, name);
    }
View Full Code Here

       
        if (descriptor.getLocatorId() == null) {
            throw new IllegalArgumentException("The descriptor must have a specific locator ID");
        }
       
        return new SpecificFilterImpl(contract, name,
                descriptor.getServiceId(),
                descriptor.getLocatorId());
       
    }
View Full Code Here

        injectionMgr.inject(result, injector);
        return result;
    }
   
    private void parseInHk2LocatorOrig(BufferedReader reader, Map<String, String> cliCommandNames) throws IOException {
        DescriptorImpl desc = new DescriptorImpl();
        while (desc.readObject(reader)) {
            if (StringUtils.ok(desc.getName()) && desc.getAdvertisedContracts().contains(CLICommand.class.getName())) {
                cliCommandNames.put(desc.getName(), desc.getImplementation());
            }
        }
    }
View Full Code Here

     */
    public static void bindProvider(
            final Class<?> providerClass, final ContractProvider model, final DynamicConfiguration dc) {

        for (final Class contract : model.getContracts()) {
            final ScopedBindingBuilder bindingBuilder = Injections.newBinder(providerClass)
                    .in(model.getScope())
                    .qualifiedBy(new CustomAnnotationImpl());

            //noinspection unchecked
            bindingBuilder.to(contract);

            final int priority = model.getPriority(contract);
            if (priority > ContractProvider.NO_PRIORITY) {
                bindingBuilder.ranked(priority);
            }

            Injections.addBinding(bindingBuilder, dc);
        }
    }
View Full Code Here

     */
    public static void bindProvider(
            final Object providerInstance, final ContractProvider model, final DynamicConfiguration dc) {

        for (final Class contract : model.getContracts()) {
            final ScopedBindingBuilder bindingBuilder = Injections.
                    newBinder(providerInstance).
                    qualifiedBy(new CustomAnnotationImpl());

            //noinspection unchecked
            bindingBuilder.to(contract);

            final int priority = model.getPriority(contract);
            if (priority > ContractProvider.NO_PRIORITY) {
                bindingBuilder.ranked(priority);
            }

            Injections.addBinding(bindingBuilder, dc);
        }
    }
View Full Code Here

                                                methodsToSkip,
                                                fieldsToSkip) : defaultClassAnalyzer;

        DynamicConfiguration dc = Injections.getConfiguration(locator);

        final ScopedBindingBuilder bindingBuilder =
                Injections.newBinder(customizedClassAnalyzer);

        bindingBuilder.analyzeWith(ClassAnalyzer.DEFAULT_IMPLEMENTATION_NAME)
                .to(ClassAnalyzer.class)
                .named(CDI_CLASS_ANALYZER);

        Injections.addBinding(bindingBuilder, dc);
View Full Code Here

                ? new InjecteeSkippingAnalyzer(defaultClassAnalyzer, methodsToSkip, fieldsToSkip)
                : defaultClassAnalyzer;

        final DynamicConfiguration dc = Injections.getConfiguration(locator);

        final ScopedBindingBuilder bindingBuilder =
                Injections.newBinder(customizedClassAnalyzer);

        bindingBuilder.analyzeWith(ClassAnalyzer.DEFAULT_IMPLEMENTATION_NAME)
                .to(ClassAnalyzer.class)
                .named(CDI_CLASS_ANALYZER);

        Injections.addBinding(bindingBuilder, dc);
View Full Code Here

     */
    public static void bindProvider(
            final Class<?> providerClass, final ContractProvider model, final DynamicConfiguration dc) {

        for (Class contract : model.getContracts()) {
            final ScopedBindingBuilder bindingBuilder = Injections.newBinder(providerClass)
                    .in(model.getScope())
                    .qualifiedBy(new CustomAnnotationImpl());

            //noinspection unchecked
            bindingBuilder.to(contract);

            final int priority = model.getPriority(contract);
            if (priority > ContractProvider.NO_PRIORITY) {
                bindingBuilder.ranked(priority);
            }

            Injections.addBinding(bindingBuilder, dc);
        }
    }
View Full Code Here

     */
    public static void bindProvider(
            final Object providerInstance, final ContractProvider model, final DynamicConfiguration dc) {

        for (Class contract : model.getContracts()) {
            final ScopedBindingBuilder bindingBuilder = Injections.
                    newBinder(providerInstance).
                    qualifiedBy(new CustomAnnotationImpl());

            //noinspection unchecked
            bindingBuilder.to(contract);

            final int priority = model.getPriority(contract);
            if (priority > ContractProvider.NO_PRIORITY) {
                bindingBuilder.ranked(priority);
            }

            Injections.addBinding(bindingBuilder, dc);
        }
    }
View Full Code Here

TOP

Related Classes of org.glassfish.hk2.utilities.binding.ScopedBindingBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.