org.glassfish.hk2.internal
Class ActiveDescriptorBuilderImpl

java.lang.Object
  extended by org.glassfish.hk2.internal.ActiveDescriptorBuilderImpl
All Implemented Interfaces:
ActiveDescriptorBuilder

public class ActiveDescriptorBuilderImpl
extends Object
implements ActiveDescriptorBuilder

Author:
jwells

Constructor Summary
ActiveDescriptorBuilderImpl(Class<?> implementation)
           
 
Method Summary
 ActiveDescriptorBuilder andLoadWith(HK2Loader loader)
          Call this if this descriptor should be loaded with the given HK2Loader
 AbstractActiveDescriptor<?> build()
          Generates a descriptor that can be used in binding operations
 AbstractActiveDescriptor<?> buildFactory()
          Generates a descriptor that can be used in binding operations that describes a factory
 ActiveDescriptorBuilder has(String key, List<String> values)
          An instance of data to be associated with this descriptor
 ActiveDescriptorBuilder has(String key, String value)
          An instance of data to be associated with this descriptor
 ActiveDescriptorBuilder in(Class<? extends Annotation> scope)
          A scope to be associated with this descriptor object.
 ActiveDescriptorBuilder named(String name)
          The name for this descriptor object.
 ActiveDescriptorBuilder ofRank(int rank)
          The rank to be associated with this descriptor.
 ActiveDescriptorBuilder qualifiedBy(Annotation annotation)
          A qualifier to be associated with this descriptor object
 ActiveDescriptorBuilder to(Type contract)
          A contract to be associated with this descriptor object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveDescriptorBuilderImpl

public ActiveDescriptorBuilderImpl(Class<?> implementation)
Method Detail

named

public ActiveDescriptorBuilder named(String name)
                              throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
The name for this descriptor object. Note that at the current time a descriptor can only have one name, hence this method will throw an IllegalArgumentException if named is called more than once.

Specified by:
named in interface ActiveDescriptorBuilder
Parameters:
name - The name to be associated with this Descriptor
Returns:
A DescriptorBuilder with the given name
Throws:
IllegalArgumentException - if there is more than one name on the predicate

to

public ActiveDescriptorBuilder to(Type contract)
                           throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
A contract to be associated with this descriptor object.

Specified by:
to in interface ActiveDescriptorBuilder
Parameters:
contract - A class that is annotated with Contract to be associated with this Descriptor
Returns:
A DescriptorBuilder with the given name
Throws:
IllegalArgumentException - on failures

in

public ActiveDescriptorBuilder in(Class<? extends Annotation> scope)
                           throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
A scope to be associated with this descriptor object. Note that at the current time a descriptor can only have one scope, hence this method will throw an IllegalArgumentException if in is called more than once.

Specified by:
in in interface ActiveDescriptorBuilder
Parameters:
scope - The class of the scope this descriptor is to have.
Returns:
A DescriptorBuilder with the given scope
Throws:
IllegalArgumentException - If in is called more than once

qualifiedBy

public ActiveDescriptorBuilder qualifiedBy(Annotation annotation)
                                    throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
A qualifier to be associated with this descriptor object

Specified by:
qualifiedBy in interface ActiveDescriptorBuilder
Parameters:
annotation - The annotation to be associated with this descriptor
Returns:
A DescriptorBuilder with the given annotation
Throws:
IllegalArgumentException - on failures

has

public ActiveDescriptorBuilder has(String key,
                                   String value)
                            throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
An instance of data to be associated with this descriptor

Specified by:
has in interface ActiveDescriptorBuilder
Parameters:
key - The key for the data to be associated with this descriptor
value - The value this key should take (single value metadata)
Returns:
A DescriptorBuilder with the given metadata
Throws:
IllegalArgumentException

has

public ActiveDescriptorBuilder has(String key,
                                   List<String> values)
                            throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
An instance of data to be associated with this descriptor

Specified by:
has in interface ActiveDescriptorBuilder
Parameters:
key - The key for the data to be associated with this descriptor
values - The values this key should take (single value metadata)
Returns:
A DescriptorBuilder with the given metadata
Throws:
IllegalArgumentException

ofRank

public ActiveDescriptorBuilder ofRank(int rank)
Description copied from interface: ActiveDescriptorBuilder
The rank to be associated with this descriptor. The last rank bound wins

Specified by:
ofRank in interface ActiveDescriptorBuilder
Parameters:
rank - The rank to be associated with this descriptor.
Returns:
A DescriptorBuilder with the given rank

andLoadWith

public ActiveDescriptorBuilder andLoadWith(HK2Loader loader)
                                    throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
Call this if this descriptor should be loaded with the given HK2Loader

Specified by:
andLoadWith in interface ActiveDescriptorBuilder
Parameters:
loader - The loader to use with this descriptor
Returns:
A DescriptorBuilder with the given HK2Loader
Throws:
IllegalArgumentException - if the HK2Loader is set non-null more than once

build

public AbstractActiveDescriptor<?> build()
                                  throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
Generates a descriptor that can be used in binding operations

Specified by:
build in interface ActiveDescriptorBuilder
Returns:
The descriptor that has been built up
Throws:
IllegalArgumentException - if the built descriptor is invalid

buildFactory

public AbstractActiveDescriptor<?> buildFactory()
                                         throws IllegalArgumentException
Description copied from interface: ActiveDescriptorBuilder
Generates a descriptor that can be used in binding operations that describes a factory

Specified by:
buildFactory in interface ActiveDescriptorBuilder
Returns:
The descriptor that has been built up, of type FACTORY
Throws:
IllegalArgumentException - if the built descriptor is invalid


Copyright © 2013 Oracle Corporation. All Rights Reserved.