idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
150,200
void endIfStarted ( CodeAttribute b , ClassMethod method ) { b . aload ( getLocalVariableIndex ( 0 ) ) ; b . dup ( ) ; final BranchEnd ifnotnull = b . ifnull ( ) ; b . checkcast ( Stack . class ) ; b . invokevirtual ( Stack . class . getName ( ) , END_INTERCEPTOR_CONTEXT_METHOD_NAME , EMPTY_PARENTHESES + VOID_CLASS_DES...
Ends interception context if it was previously stated . This is indicated by a local variable with index 0 .
150,201
@ SuppressFBWarnings ( value = "UL_UNRELEASED_LOCK" , justification = "False positive from FindBugs" ) public < T > T get ( Contextual < T > contextual , CreationalContext < T > creationalContext ) { if ( ! isActive ( ) ) { throw new ContextNotActiveException ( ) ; } checkContextInitialized ( ) ; final BeanStore beanSt...
Get the bean if it exists in the contexts .
150,202
protected void destroy ( ) { ContextLogger . LOG . contextCleared ( this ) ; final BeanStore beanStore = getBeanStore ( ) ; if ( beanStore == null ) { throw ContextLogger . LOG . noBeanStoreAvailable ( this ) ; } for ( BeanIdentifier id : beanStore ) { destroyContextualInstance ( beanStore . get ( id ) ) ; } beanStore ...
Destroys the context
150,203
public static < T > boolean addAll ( Collection < T > target , Iterable < ? extends T > iterable ) { if ( iterable instanceof Collection ) { return target . addAll ( ( Collection < ? extends T > ) iterable ) ; } return Iterators . addAll ( target , iterable . iterator ( ) ) ; }
Add all elements in the iterable to the collection .
150,204
public < T > Producer < T > createProducer ( final Bean < X > declaringBean , final Bean < T > bean , DisposalMethod < X , T > disposalMethod ) { EnhancedAnnotatedField < T , X > enhancedField = getManager ( ) . getServices ( ) . get ( MemberTransformer . class ) . loadEnhancedMember ( field , getManager ( ) . getId ( ...
Producers returned from this method are not validated . Internal use only .
150,205
protected WeldBeanDeploymentArchive createAdditionalBeanDeploymentArchive ( ) { WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive ( ADDITIONAL_BDA_ID , Collections . synchronizedSet ( new HashSet < String > ( ) ) , null ) ; additionalBda . getServices ( ) . addAll ( getServices ( ) . entrySet ( ) ...
Additional bean deployment archives are used for extentions synthetic annotated types and beans which do not come from a bean archive .
150,206
protected void setBeanDeploymentArchivesAccessibility ( ) { for ( WeldBeanDeploymentArchive beanDeploymentArchive : beanDeploymentArchives ) { Set < WeldBeanDeploymentArchive > accessibleArchives = new HashSet < > ( ) ; for ( WeldBeanDeploymentArchive candidate : beanDeploymentArchives ) { if ( candidate . equals ( bea...
By default all bean archives see each other .
150,207
static Type parseType ( String value , ResourceLoader resourceLoader ) { value = value . trim ( ) ; if ( value . equals ( WILDCARD ) ) { return WildcardTypeImpl . defaultInstance ( ) ; } if ( value . startsWith ( WILDCARD_EXTENDS ) ) { Type upperBound = parseType ( value . substring ( WILDCARD_EXTENDS . length ( ) , va...
Type variables are not supported .
150,208
public static boolean isPortletEnvSupported ( ) { if ( enabled == null ) { synchronized ( PortletSupport . class ) { if ( enabled == null ) { try { PortletSupport . class . getClassLoader ( ) . loadClass ( "javax.portlet.PortletContext" ) ; enabled = true ; } catch ( Throwable ignored ) { enabled = false ; } } } } retu...
Is portlet env supported .
150,209
public static BeanManager getBeanManager ( Object ctx ) { return ( BeanManager ) javax . portlet . PortletContext . class . cast ( ctx ) . getAttribute ( WeldServletLifecycle . BEAN_MANAGER_ATTRIBUTE_NAME ) ; }
Get bean manager from portlet context .
150,210
private < T > List < Class < ? > > filter ( List < Class < ? > > enabledClasses , List < Class < ? > > globallyEnabledClasses , LogMessageCallback logMessageCallback , BeanDeployment deployment ) { for ( Iterator < Class < ? > > iterator = enabledClasses . iterator ( ) ; iterator . hasNext ( ) ; ) { Class < ? > enabled...
Filter out interceptors and decorators which are also enabled globally .
150,211
public F resolve ( R resolvable , boolean cache ) { R wrappedResolvable = wrap ( resolvable ) ; if ( cache ) { return resolved . getValue ( wrappedResolvable ) ; } else { return resolverFunction . apply ( wrappedResolvable ) ; } }
Get the possible beans for the given element
150,212
private Set < T > findMatching ( R resolvable ) { Set < T > result = new HashSet < T > ( ) ; for ( T bean : getAllBeans ( resolvable ) ) { if ( matches ( resolvable , bean ) ) { result . add ( bean ) ; } } return result ; }
Gets the matching beans for binding criteria from a list of beans
150,213
public < X > Set < DisposalMethod < X , ? > > resolveDisposalBeans ( Set < Type > types , Set < Annotation > qualifiers , AbstractClassBean < X > declaringBean ) { Set < DisposalMethod < X , ? > > beans = cast ( disposalMethodResolver . resolve ( new ResolvableBuilder ( manager ) . addTypes ( types ) . addQualifiers ( ...
Resolve the disposal method for the given producer method . Any resolved beans will be marked as such for the purpose of validating that all disposal methods are used . For internal use .
150,214
private static < T > Set < Type > getSessionBeanTypes ( EnhancedAnnotated < T , ? > annotated , EjbDescriptor < T > ejbDescriptor ) { ImmutableSet . Builder < Type > types = ImmutableSet . builder ( ) ; Map < Class < ? > , Type > typeMap = new LinkedHashMap < Class < ? > , Type > ( ) ; HierarchyDiscovery beanClassDisco...
Bean types of a session bean .
150,215
public static < T > SessionBean < T > of ( BeanAttributes < T > attributes , InternalEjbDescriptor < T > ejbDescriptor , BeanManagerImpl beanManager , EnhancedAnnotatedType < T > type ) { return new SessionBeanImpl < T > ( attributes , type , ejbDescriptor , new StringBeanIdentifier ( SessionBeans . createIdentifier ( ...
Creates a simple annotation defined Enterprise Web Bean using the annotations specified on type
150,216
protected void checkConflictingRoles ( ) { if ( getType ( ) . isAnnotationPresent ( Interceptor . class ) ) { throw BeanLogger . LOG . ejbCannotBeInterceptor ( getType ( ) ) ; } if ( getType ( ) . isAnnotationPresent ( Decorator . class ) ) { throw BeanLogger . LOG . ejbCannotBeDecorator ( getType ( ) ) ; } }
Validates for non - conflicting roles
150,217
protected void checkScopeAllowed ( ) { if ( ejbDescriptor . isStateless ( ) && ! isDependent ( ) ) { throw BeanLogger . LOG . scopeNotAllowedOnStatelessSessionBean ( getScope ( ) , getType ( ) ) ; } if ( ejbDescriptor . isSingleton ( ) && ! ( isDependent ( ) || getScope ( ) . equals ( ApplicationScoped . class ) ) ) { ...
Check that the scope type is allowed by the stereotypes on the bean and the bean type
150,218
protected void checkObserverMethods ( ) { Collection < EnhancedAnnotatedMethod < ? , ? super T > > observerMethods = BeanMethods . getObserverMethods ( this . getEnhancedAnnotated ( ) ) ; Collection < EnhancedAnnotatedMethod < ? , ? super T > > asyncObserverMethods = BeanMethods . getAsyncObserverMethods ( this . getEn...
If there are any observer methods they must be static or business methods .
150,219
public static < T > NewManagedBean < T > of ( BeanAttributes < T > attributes , EnhancedAnnotatedType < T > clazz , BeanManagerImpl beanManager ) { return new NewManagedBean < T > ( attributes , clazz , new StringBeanIdentifier ( BeanIdentifiers . forNewManagedBean ( clazz ) ) , beanManager ) ; }
Creates an instance of a NewSimpleBean from an annotated class
150,220
public Object invoke ( Object self , Method method , Method proceed , Object [ ] args ) throws Throwable { if ( "destroy" . equals ( method . getName ( ) ) && Marker . isMarker ( 0 , method , args ) ) { if ( bean . getEjbDescriptor ( ) . isStateful ( ) ) { if ( ! reference . isRemoved ( ) ) { reference . remove ( ) ; }...
Looks up the EJB in the container and executes the method on it
150,221
private < T > void deferNotification ( T event , final EventMetadata metadata , final ObserverMethod < ? super T > observer , final List < DeferredEventNotification < ? > > notifications ) { TransactionPhase transactionPhase = observer . getTransactionPhase ( ) ; boolean before = transactionPhase . equals ( Transaction...
Defers an event for processing in a later phase of the current transaction .
150,222
public void build ( Set < Bean < ? > > beans ) { if ( isBuilt ( ) ) { throw new IllegalStateException ( "BeanIdentifier index is already built!" ) ; } if ( beans . isEmpty ( ) ) { index = new BeanIdentifier [ 0 ] ; reverseIndex = Collections . emptyMap ( ) ; indexHash = 0 ; indexBuilt . set ( true ) ; return ; } List <...
Note that the index can only be built once .
150,223
public static < T > FastEvent < T > of ( Class < T > type , BeanManagerImpl manager , ObserverNotifier notifier , Annotation ... qualifiers ) { ResolvedObservers < T > resolvedObserverMethods = notifier . < T > resolveObserverMethods ( type , qualifiers ) ; if ( resolvedObserverMethods . isMetadataRequired ( ) ) { Even...
Constructs a new FastEvent instance
150,224
public static < T > List < T > copyOf ( T [ ] elements ) { Preconditions . checkNotNull ( elements ) ; return ofInternal ( elements . clone ( ) ) ; }
Creates an immutable list that consists of the elements in the given array . A copy of the given array is used which means that any modifications to the given array will not affect the immutable list .
150,225
public static < T > List < T > copyOf ( Collection < T > source ) { Preconditions . checkNotNull ( source ) ; if ( source instanceof ImmutableList < ? > ) { return ( ImmutableList < T > ) source ; } if ( source . isEmpty ( ) ) { return Collections . emptyList ( ) ; } return ofInternal ( source . toArray ( ) ) ; }
Creates an immutable list that consists of the elements in the given collection . If the given collection is already an immutable list it is returned directly .
150,226
public static Set < Annotation > filterInterceptorBindings ( BeanManagerImpl beanManager , Collection < Annotation > annotations ) { Set < Annotation > interceptorBindings = new InterceptorBindingSet ( beanManager ) ; for ( Annotation annotation : annotations ) { if ( beanManager . isInterceptorBinding ( annotation . a...
Extracts a set of interceptor bindings from a collection of annotations .
150,227
public static Set < Annotation > flattenInterceptorBindings ( EnhancedAnnotatedType < ? > clazz , BeanManagerImpl beanManager , Collection < Annotation > annotations , boolean addTopLevelInterceptorBindings , boolean addInheritedInterceptorBindings ) { Set < Annotation > flattenInterceptorBindings = new InterceptorBind...
Extracts a flat set of interception bindings from a given set of interceptor bindings .
150,228
protected void validateRIBean ( CommonBean < ? > bean , BeanManagerImpl beanManager , Collection < CommonBean < ? > > specializedBeans ) { validateGeneralBean ( bean , beanManager ) ; if ( bean instanceof NewBean ) { return ; } if ( bean instanceof DecorableBean ) { validateDecorators ( beanManager , ( DecorableBean < ...
Validate an RIBean . This includes validating whether two beans specialize the same bean
150,229
public void validateInjectionPoint ( InjectionPoint ij , BeanManagerImpl beanManager ) { validateInjectionPointForDefinitionErrors ( ij , ij . getBean ( ) , beanManager ) ; validateMetadataInjectionPoint ( ij , ij . getBean ( ) , ValidatorLogger . INJECTION_INTO_NON_BEAN ) ; validateEventMetadataInjectionPoint ( ij ) ;...
Validate an injection point
150,230
private static void validatePseudoScopedBean ( Bean < ? > bean , BeanManagerImpl beanManager ) { if ( bean . getInjectionPoints ( ) . isEmpty ( ) ) { return ; } reallyValidatePseudoScopedBean ( bean , beanManager , new LinkedHashSet < Object > ( ) , new HashSet < Bean < ? > > ( ) ) ; }
Checks to make sure that pseudo scoped beans ( i . e .
150,231
private static void reallyValidatePseudoScopedBean ( Bean < ? > bean , BeanManagerImpl beanManager , Set < Object > dependencyPath , Set < Bean < ? > > validatedBeans ) { if ( dependencyPath . contains ( bean ) ) { List < Object > realDependencyPath = new ArrayList < Object > ( dependencyPath ) ; realDependencyPath . a...
checks if a bean has been seen before in the dependencyPath . If not it resolves the InjectionPoints and adds the resolved beans to the set of beans to be validated
150,232
public static InterceptionContext forConstructorInterception ( InterceptionModel interceptionModel , CreationalContext < ? > ctx , BeanManagerImpl manager , SlimAnnotatedType < ? > type ) { return of ( interceptionModel , ctx , manager , null , type ) ; }
The context returned by this method may be later reused for other interception types .
150,233
private Set < QualifierInstance > getRequiredQualifiers ( EnhancedAnnotatedParameter < ? , ? super X > enhancedDisposedParameter ) { Set < Annotation > disposedParameterQualifiers = enhancedDisposedParameter . getMetaAnnotations ( Qualifier . class ) ; if ( disposedParameterQualifiers . isEmpty ( ) ) { disposedParamete...
A disposer method is bound to a producer if the producer is assignable to the disposed parameter .
150,234
public static Type [ ] getActualTypeArguments ( Class < ? > clazz ) { Type type = Types . getCanonicalType ( clazz ) ; if ( type instanceof ParameterizedType ) { return ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) ; } else { return EMPTY_TYPES ; } }
Gets the actual type arguments of a class
150,235
public static Type [ ] getActualTypeArguments ( Type type ) { Type resolvedType = Types . getCanonicalType ( type ) ; if ( resolvedType instanceof ParameterizedType ) { return ( ( ParameterizedType ) resolvedType ) . getActualTypeArguments ( ) ; } else { return EMPTY_TYPES ; } }
Gets the actual type arguments of a Type
150,236
public static < T > Class < T > loadClass ( String className , ResourceLoader resourceLoader ) { try { return cast ( resourceLoader . classForName ( className ) ) ; } catch ( ResourceLoadingException e ) { return null ; } catch ( SecurityException e ) { return null ; } }
Tries to load a class using the specified ResourceLoader . Returns null if the class is not found .
150,237
public static Method findDeclaredMethodByName ( Class < ? > clazz , String methodName ) { for ( Method method : AccessController . doPrivileged ( new GetDeclaredMethodsAction ( clazz ) ) ) { if ( methodName . equals ( method . getName ( ) ) ) { return method ; } } return null ; }
Searches for a declared method with a given name . If the class declares multiple methods with the given name there is no guarantee as of which methods is returned . Null is returned if the class does not declare a method with the given name .
150,238
public static void main ( String [ ] args ) { try { new StartMain ( args ) . go ( ) ; } catch ( Throwable t ) { WeldSELogger . LOG . error ( "Application exited with an exception" , t ) ; System . exit ( 1 ) ; } }
The main method called from the command line .
150,239
public void release ( Contextual < T > contextual , T instance ) { synchronized ( dependentInstances ) { for ( ContextualInstance < ? > dependentInstance : dependentInstances ) { if ( contextual == null || ! ( dependentInstance . getContextual ( ) . equals ( contextual ) ) ) { destroy ( dependentInstance ) ; } } } if (...
should not be public
150,240
public boolean destroyDependentInstance ( T instance ) { synchronized ( dependentInstances ) { for ( Iterator < ContextualInstance < ? > > iterator = dependentInstances . iterator ( ) ; iterator . hasNext ( ) ; ) { ContextualInstance < ? > contextualInstance = iterator . next ( ) ; if ( contextualInstance . getInstance...
Destroys dependent instance
150,241
protected T checkReturnValue ( T instance ) { if ( instance == null && ! isDependent ( ) ) { throw BeanLogger . LOG . nullNotAllowedFromProducer ( getProducer ( ) , Formats . formatAsStackTraceElement ( getAnnotated ( ) . getJavaMember ( ) ) ) ; } if ( instance == null ) { InjectionPoint injectionPoint = beanManager . ...
Validates the return value
150,242
public static < K , V > Map < K , V > copyOf ( Map < K , V > map ) { Preconditions . checkNotNull ( map ) ; return ImmutableMap . < K , V > builder ( ) . putAll ( map ) . build ( ) ; }
Creates an immutable map . A copy of the given map is used . As a result it is safe to modify the source map afterwards .
150,243
public static < K , V > Map < K , V > of ( K key , V value ) { return new ImmutableMapEntry < K , V > ( key , value ) ; }
Creates an immutable singleton instance .
150,244
public static String formatAsStackTraceElement ( InjectionPoint ij ) { Member member ; if ( ij . getAnnotated ( ) instanceof AnnotatedField ) { AnnotatedField < ? > annotatedField = ( AnnotatedField < ? > ) ij . getAnnotated ( ) ; member = annotatedField . getJavaMember ( ) ; } else if ( ij . getAnnotated ( ) instanceo...
See also WELD - 1454 .
150,245
public static int getLineNumber ( Member member ) { if ( ! ( member instanceof Method || member instanceof Constructor ) ) { return 0 ; } if ( ! Reflections . isClassLoadable ( BCEL_CLASS , WeldClassLoaderResourceLoader . INSTANCE ) ) { return 0 ; } String classFile = member . getDeclaringClass ( ) . getName ( ) . repl...
Try to get the line number associated with the given member .
150,246
private static List < String > parseModifiers ( int modifiers ) { List < String > result = new ArrayList < String > ( ) ; if ( Modifier . isPrivate ( modifiers ) ) { result . add ( "private" ) ; } if ( Modifier . isProtected ( modifiers ) ) { result . add ( "protected" ) ; } if ( Modifier . isPublic ( modifiers ) ) { r...
Parses a reflection modifier to a list of string
150,247
private boolean initCheckTypeModifiers ( ) { Class < ? > classInfoclass = Reflections . loadClass ( CLASSINFO_CLASS_NAME , new ClassLoaderResourceLoader ( classFileServices . getClass ( ) . getClassLoader ( ) ) ) ; if ( classInfoclass != null ) { try { Method setFlags = AccessController . doPrivileged ( GetDeclaredMeth...
checking availability of ClassInfo . setFlags method is just workaround for JANDEX - 37
150,248
public static < X , T > ProducerMethod < X , T > of ( BeanAttributes < T > attributes , EnhancedAnnotatedMethod < T , ? super X > method , AbstractClassBean < X > declaringBean , DisposalMethod < X , ? > disposalMethod , BeanManagerImpl beanManager , ServiceRegistry services ) { return new ProducerMethod < X , T > ( cr...
Creates a producer method Web Bean
150,249
public static void addLoadInstruction ( CodeAttribute code , String type , int variable ) { char tp = type . charAt ( 0 ) ; if ( tp != 'L' && tp != '[' ) { switch ( tp ) { case 'J' : code . lload ( variable ) ; break ; case 'D' : code . dload ( variable ) ; break ; case 'F' : code . fload ( variable ) ; break ; default...
Adds the correct load instruction based on the type descriptor
150,250
public static void pushClassType ( CodeAttribute b , String classType ) { if ( classType . length ( ) != 1 ) { if ( classType . startsWith ( "L" ) && classType . endsWith ( ";" ) ) { classType = classType . substring ( 1 , classType . length ( ) - 1 ) ; } b . loadClass ( classType ) ; } else { char type = classType . c...
Pushes a class type onto the stack from the string representation This can also handle primitives
150,251
private void checkBindings ( EnhancedAnnotation < T > annotatedAnnotation ) { Set < Annotation > bindings = annotatedAnnotation . getMetaAnnotations ( Qualifier . class ) ; if ( bindings . size ( ) > 0 ) { for ( Annotation annotation : bindings ) { if ( ! annotation . annotationType ( ) . equals ( Named . class ) ) { t...
Validates the binding types
150,252
private void initBeanNameDefaulted ( EnhancedAnnotation < T > annotatedAnnotation ) { if ( annotatedAnnotation . isAnnotationPresent ( Named . class ) ) { if ( ! "" . equals ( annotatedAnnotation . getAnnotation ( Named . class ) . value ( ) ) ) { throw MetadataLogger . LOG . valueOnNamedStereotype ( annotatedAnnotatio...
Initializes the bean name defaulted
150,253
private void initDefaultScopeType ( EnhancedAnnotation < T > annotatedAnnotation ) { Set < Annotation > scopeTypes = new HashSet < Annotation > ( ) ; scopeTypes . addAll ( annotatedAnnotation . getMetaAnnotations ( Scope . class ) ) ; scopeTypes . addAll ( annotatedAnnotation . getMetaAnnotations ( NormalScope . class ...
Initializes the default scope type
150,254
public static Type boxedType ( Type type ) { if ( type instanceof Class < ? > ) { return boxedClass ( ( Class < ? > ) type ) ; } else { return type ; } }
Gets the boxed type of a class
150,255
public static Type getCanonicalType ( Class < ? > clazz ) { if ( clazz . isArray ( ) ) { Class < ? > componentType = clazz . getComponentType ( ) ; Type resolvedComponentType = getCanonicalType ( componentType ) ; if ( componentType != resolvedComponentType ) { return new GenericArrayTypeImpl ( resolvedComponentType ) ...
Returns a canonical type for a given class .
150,256
public static boolean isArray ( Type type ) { return ( type instanceof GenericArrayType ) || ( type instanceof Class < ? > && ( ( Class < ? > ) type ) . isArray ( ) ) ; }
Determines whether the given type is an array type .
150,257
public static Type getArrayComponentType ( Type type ) { if ( type instanceof GenericArrayType ) { return GenericArrayType . class . cast ( type ) . getGenericComponentType ( ) ; } if ( type instanceof Class < ? > ) { Class < ? > clazz = ( Class < ? > ) type ; if ( clazz . isArray ( ) ) { return clazz . getComponentTyp...
Determines the component type for a given array type .
150,258
public static boolean isArrayOfUnboundedTypeVariablesOrObjects ( Type [ ] types ) { for ( Type type : types ) { if ( Object . class . equals ( type ) ) { continue ; } if ( type instanceof TypeVariable < ? > ) { Type [ ] bounds = ( ( TypeVariable < ? > ) type ) . getBounds ( ) ; if ( bounds == null || bounds . length ==...
Determines whether the given array only contains unbounded type variables or Object . class .
150,259
public < T > T get ( Contextual < T > contextual , CreationalContext < T > creationalContext ) { if ( ! isActive ( ) ) { throw new ContextNotActiveException ( ) ; } if ( creationalContext != null ) { T instance = contextual . create ( creationalContext ) ; if ( creationalContext instanceof WeldCreationalContext < ? > )...
Overridden method always creating a new instance
150,260
public void createEnablement ( ) { GlobalEnablementBuilder builder = beanManager . getServices ( ) . get ( GlobalEnablementBuilder . class ) ; ModuleEnablement enablement = builder . createModuleEnablement ( this ) ; beanManager . setEnabled ( enablement ) ; if ( BootstrapLogger . LOG . isDebugEnabled ( ) ) { Bootstrap...
Initializes module enablement .
150,261
public static < T > DecoratorImpl < T > of ( BeanAttributes < T > attributes , EnhancedAnnotatedType < T > clazz , BeanManagerImpl beanManager ) { return new DecoratorImpl < T > ( attributes , clazz , beanManager ) ; }
Creates a decorator bean
150,262
protected void merge ( Set < Annotation > stereotypeAnnotations ) { final MetaAnnotationStore store = manager . getServices ( ) . get ( MetaAnnotationStore . class ) ; for ( Annotation stereotypeAnnotation : stereotypeAnnotations ) { StereotypeModel < ? > stereotype = store . getStereotype ( stereotypeAnnotation . anno...
Perform the merge
150,263
public void run ( ) { try { threadContext . activate ( ) ; runnable . run ( ) ; } finally { threadContext . invalidate ( ) ; threadContext . deactivate ( ) ; } }
Set up the ThreadContext and delegate .
150,264
protected AbstractBeanDeployer < E > deploySpecialized ( ) { for ( DecoratorImpl < ? > bean : getEnvironment ( ) . getDecorators ( ) ) { bean . initialize ( getEnvironment ( ) ) ; containerLifecycleEvents . fireProcessBean ( getManager ( ) , bean ) ; manager . addDecorator ( bean ) ; BootstrapLogger . LOG . foundDecora...
interceptors decorators and observers go first
150,265
public static void validateObserverMethod ( ObserverMethod < ? > observerMethod , BeanManager beanManager , ObserverMethod < ? > originalObserverMethod ) { Set < Annotation > qualifiers = observerMethod . getObservedQualifiers ( ) ; if ( observerMethod . getBeanClass ( ) == null ) { throw EventLogger . LOG . observerMe...
Validates given external observer method .
150,266
private static boolean isAssignableFrom ( WildcardType type1 , Type type2 ) { if ( ! isAssignableFrom ( type1 . getUpperBounds ( ) [ 0 ] , type2 ) ) { return false ; } if ( type1 . getLowerBounds ( ) . length > 0 && ! isAssignableFrom ( type2 , type1 . getLowerBounds ( ) [ 0 ] ) ) { return false ; } return true ; }
This logic is shared for all actual types i . e . raw types parameterized types and generic array types .
150,267
public static CombinedInterceptorAndDecoratorStackMethodHandler peekIfNotEmpty ( ) { Stack stack = interceptionContexts . get ( ) ; if ( stack == null ) { return null ; } return stack . peek ( ) ; }
Peeks the current top of the stack or returns null if the stack is empty
150,268
public static Stack getStack ( ) { Stack stack = interceptionContexts . get ( ) ; if ( stack == null ) { stack = new Stack ( interceptionContexts ) ; interceptionContexts . set ( stack ) ; } return stack ; }
Gets the current Stack . If the stack is not set a new empty instance is created and set .
150,269
public static boolean isTypesProxyable ( Iterable < ? extends Type > types , ServiceRegistry services ) { return getUnproxyableTypesException ( types , services ) == null ; }
Indicates if a set of types are all proxyable
150,270
public static < T > boolean addAll ( Collection < T > target , Iterator < ? extends T > iterator ) { Preconditions . checkArgumentNotNull ( target , "target" ) ; boolean modified = false ; while ( iterator . hasNext ( ) ) { modified |= target . add ( iterator . next ( ) ) ; } return modified ; }
Add all elements in the iterator to the collection .
150,271
public static < T > Iterator < T > concat ( Iterator < ? extends Iterator < ? extends T > > iterators ) { Preconditions . checkArgumentNotNull ( iterators , "iterators" ) ; return new CombinedIterator < T > ( iterators ) ; }
Combine the iterators into a single one .
150,272
HtmlTag attr ( String name , String value ) { if ( attrs == null ) { attrs = new HashMap < > ( ) ; } attrs . put ( name , value ) ; return this ; }
Attribute name and value are not escaped or modified in any way .
150,273
public void clearAnnotationData ( Class < ? extends Annotation > annotationClass ) { stereotypes . invalidate ( annotationClass ) ; scopes . invalidate ( annotationClass ) ; qualifiers . invalidate ( annotationClass ) ; interceptorBindings . invalidate ( annotationClass ) ; }
removes all data for an annotation class . This should be called after an annotation has been modified through the SPI
150,274
public static < K , V > Map < K , V > immutableMapView ( Map < K , V > map ) { if ( map instanceof ImmutableMap < ? , ? > ) { return map ; } return Collections . unmodifiableMap ( map ) ; }
Returns an immutable view of a given map .
150,275
protected void checkProducerMethod ( EnhancedAnnotatedMethod < T , ? super X > method ) { if ( method . getEnhancedParameters ( Observes . class ) . size ( ) > 0 ) { throw BeanLogger . LOG . inconsistentAnnotationsOnMethod ( PRODUCER_ANNOTATION , "@Observes" , this . method , Formats . formatAsStackTraceElement ( metho...
Validates the producer method
150,276
ProtectionDomain getProtectionDomainForProxy ( ProtectionDomain domain ) { if ( domain . getCodeSource ( ) == null ) { return create ( domain ) ; } ProtectionDomain proxyProtectionDomain = proxyProtectionDomains . get ( domain . getCodeSource ( ) ) ; if ( proxyProtectionDomain == null ) { proxyProtectionDomain = create...
Gets an enhanced protection domain for a proxy based on the given protection domain .
150,277
public static < A extends Annotation > EnhancedAnnotation < A > create ( SlimAnnotatedType < A > annotatedType , ClassTransformer classTransformer ) { Class < A > annotationType = annotatedType . getJavaClass ( ) ; Map < Class < ? extends Annotation > , Annotation > annotationMap = new HashMap < Class < ? extends Annot...
we can t call this method of cause it won t compile on JDK7
150,278
protected void init ( EnhancedAnnotation < T > annotatedAnnotation ) { initType ( annotatedAnnotation ) ; initValid ( annotatedAnnotation ) ; check ( annotatedAnnotation ) ; }
Initializes the type and validates it
150,279
protected void initValid ( EnhancedAnnotation < T > annotatedAnnotation ) { this . valid = false ; for ( Class < ? extends Annotation > annotationType : getMetaAnnotationTypes ( ) ) { if ( annotatedAnnotation . isAnnotationPresent ( annotationType ) ) { this . valid = true ; } } }
Validates the data for correct annotation
150,280
private void installFastProcessAnnotatedTypeResolver ( ServiceRegistry services ) { ClassFileServices classFileServices = services . get ( ClassFileServices . class ) ; if ( classFileServices != null ) { final GlobalObserverNotifierService observers = services . get ( GlobalObserverNotifierService . class ) ; try { fin...
needs to be resolved once extension beans are deployed
150,281
public String load ( ) { this . paginator = new Paginator ( ) ; this . codes = null ; this . codes = codeFragmentManager . searchCodeFragments ( this . codeFragmentPrototype , this . page , this . paginator ) ; return "history" ; }
Do the search called as a page action
150,282
public < T > InternalEjbDescriptor < T > get ( String beanName ) { return cast ( ejbByName . get ( beanName ) ) ; }
Gets an iterator to the EJB descriptors for an EJB implementation class
150,283
private < T > void add ( EjbDescriptor < T > ejbDescriptor ) { InternalEjbDescriptor < T > internalEjbDescriptor = InternalEjbDescriptor . of ( ejbDescriptor ) ; ejbByName . put ( ejbDescriptor . getEjbName ( ) , internalEjbDescriptor ) ; ejbByClass . put ( ejbDescriptor . getBeanClass ( ) , internalEjbDescriptor . get...
Adds an EJB descriptor to the maps
150,284
private void fireEventForNonWebModules ( Type eventType , Object event , Annotation ... qualifiers ) { try { BeanDeploymentModules modules = deploymentManager . getServices ( ) . get ( BeanDeploymentModules . class ) ; if ( modules != null ) { for ( BeanDeploymentModule module : modules ) { if ( ! module . isWebModule ...
Fires given event for non - web modules . Used for
150,285
public static void initialize ( BeanManagerImpl deploymentManager , ServiceRegistry deploymentServices ) { Container instance = new Container ( RegistrySingletonProvider . STATIC_INSTANCE , deploymentManager , deploymentServices ) ; Container . instance . set ( RegistrySingletonProvider . STATIC_INSTANCE , instance ) ;...
Initialize the container for the current application deployment
150,286
public void cleanup ( ) { managers . clear ( ) ; for ( BeanManagerImpl beanManager : beanDeploymentArchives . values ( ) ) { beanManager . cleanup ( ) ; } beanDeploymentArchives . clear ( ) ; deploymentServices . cleanup ( ) ; deploymentManager . cleanup ( ) ; instance . clear ( contextId ) ; }
Cause the container to be cleaned up including all registered bean managers and all deployment services
150,287
public void putBeanDeployments ( BeanDeploymentArchiveMapping bdaMapping ) { for ( Entry < BeanDeploymentArchive , BeanManagerImpl > entry : bdaMapping . getBdaToBeanManagerMap ( ) . entrySet ( ) ) { beanDeploymentArchives . put ( entry . getKey ( ) , entry . getValue ( ) ) ; addBeanManager ( entry . getValue ( ) ) ; }...
Add sub - deployment units to the container
150,288
private < Y > void checkObserverMethod ( EnhancedAnnotatedMethod < T , Y > annotated ) { List < EnhancedAnnotatedParameter < ? , Y > > eventObjects = annotated . getEnhancedParameters ( Observes . class ) ; eventObjects . addAll ( annotated . getEnhancedParameters ( ObservesAsync . class ) ) ; if ( this . reception . e...
Performs validation of the observer method for compliance with the specifications .
150,289
protected void sendEvent ( final T event ) { if ( isStatic ) { sendEvent ( event , null , null ) ; } else { CreationalContext < X > creationalContext = null ; try { Object receiver = getReceiverIfExists ( null ) ; if ( receiver == null && reception != Reception . IF_EXISTS ) { creationalContext = beanManager . createCr...
Invokes the observer method immediately passing the event .
150,290
public static void endRequest ( ) { final List < RequestScopedItem > result = CACHE . get ( ) ; if ( result != null ) { CACHE . remove ( ) ; for ( final RequestScopedItem item : result ) { item . invalidate ( ) ; } } }
ends the request and clears the cache . This can be called before the request is over in which case the cache will be unavailable for the rest of the request .
150,291
public < X > X invokeOnInstance ( Object instance , Object ... parameters ) throws IllegalArgumentException , SecurityException , IllegalAccessException , InvocationTargetException , NoSuchMethodException { final Map < Class < ? > , Method > methods = this . methods ; Method method = methods . get ( instance . getClass...
Invokes the method on the class of the passed instance not the declaring class . Useful with proxies
150,292
@ SuppressWarnings ( "unchecked" ) protected Class < ? extends Annotation > annotationTypeForName ( String name ) { try { return ( Class < ? extends Annotation > ) resourceLoader . classForName ( name ) ; } catch ( ResourceLoadingException cnfe ) { return DUMMY_ANNOTATION ; } }
Initializes an annotation class
150,293
protected Class < ? > classForName ( String name ) { try { return resourceLoader . classForName ( name ) ; } catch ( ResourceLoadingException cnfe ) { return DUMMY_CLASS ; } }
Initializes a type
150,294
public void addInterface ( Class < ? > newInterface ) { if ( ! newInterface . isInterface ( ) ) { throw new IllegalArgumentException ( newInterface + " is not an interface" ) ; } additionalInterfaces . add ( newInterface ) ; }
Adds an additional interface that the proxy should implement . The default implementation will be to forward invocations to the bean instance .
150,295
public T create ( BeanInstance beanInstance ) { final T proxy = ( System . getSecurityManager ( ) == null ) ? run ( ) : AccessController . doPrivileged ( this ) ; ( ( ProxyObject ) proxy ) . weld_setHandler ( new ProxyMethodHandler ( contextId , beanInstance , bean ) ) ; return proxy ; }
Method to create a new proxy that wraps the bean instance .
150,296
public Class < T > getProxyClass ( ) { String suffix = "_$$_Weld" + getProxyNameSuffix ( ) ; String proxyClassName = getBaseProxyName ( ) ; if ( ! proxyClassName . endsWith ( suffix ) ) { proxyClassName = proxyClassName + suffix ; } if ( proxyClassName . startsWith ( JAVA ) ) { proxyClassName = proxyClassName . replace...
Produces or returns the existing proxy class . The operation is thread - safe .
150,297
public static < T > void setBeanInstance ( String contextId , T proxy , BeanInstance beanInstance , Bean < ? > bean ) { if ( proxy instanceof ProxyObject ) { ProxyObject proxyView = ( ProxyObject ) proxy ; proxyView . weld_setHandler ( new ProxyMethodHandler ( contextId , beanInstance , bean ) ) ; } }
Convenience method to set the underlying bean instance for a proxy .
150,298
protected void addConstructors ( ClassFile proxyClassType , List < DeferredBytecode > initialValueBytecode ) { try { if ( getBeanType ( ) . isInterface ( ) ) { ConstructorUtils . addDefaultConstructor ( proxyClassType , initialValueBytecode , ! useConstructedFlag ( ) ) ; } else { boolean constructorFound = false ; for ...
Adds a constructor for the proxy for each constructor declared by the base bean type .
150,299
public static ClassLoader resolveClassLoaderForBeanProxy ( String contextId , Class < ? > proxiedType , TypeInfo typeInfo , ProxyServices proxyServices ) { Class < ? > superClass = typeInfo . getSuperClass ( ) ; if ( superClass . getName ( ) . startsWith ( JAVA ) ) { ClassLoader cl = proxyServices . getClassLoader ( pr...
Figures out the correct class loader to use for a proxy for a given bean