repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/RunWithinInterceptionDecorationContextGenerator.java
RunWithinInterceptionDecorationContextGenerator.endIfStarted
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_DESCRIPTOR); BranchEnd ifnull = b.gotoInstruction(); b.branchEnd(ifnotnull); b.pop(); // remove null Stack b.branchEnd(ifnull); }
java
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_DESCRIPTOR); BranchEnd ifnull = b.gotoInstruction(); b.branchEnd(ifnotnull); b.pop(); // remove null Stack b.branchEnd(ifnull); }
[ "void", "endIfStarted", "(", "CodeAttribute", "b", ",", "ClassMethod", "method", ")", "{", "b", ".", "aload", "(", "getLocalVariableIndex", "(", "0", ")", ")", ";", "b", ".", "dup", "(", ")", ";", "final", "BranchEnd", "ifnotnull", "=", "b", ".", "ifnu...
Ends interception context if it was previously stated. This is indicated by a local variable with index 0.
[ "Ends", "interception", "context", "if", "it", "was", "previously", "stated", ".", "This", "is", "indicated", "by", "a", "local", "variable", "with", "index", "0", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/RunWithinInterceptionDecorationContextGenerator.java#L117-L127
train
weld/core
impl/src/main/java/org/jboss/weld/contexts/AbstractContext.java
AbstractContext.get
@Override @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 beanStore = getBeanStore(); if (beanStore == null) { return null; } if (contextual == null) { throw ContextLogger.LOG.contextualIsNull(); } BeanIdentifier id = getId(contextual); ContextualInstance<T> beanInstance = beanStore.get(id); if (beanInstance != null) { return beanInstance.getInstance(); } else if (creationalContext != null) { LockedBean lock = null; try { if (multithreaded) { lock = beanStore.lock(id); beanInstance = beanStore.get(id); if (beanInstance != null) { return beanInstance.getInstance(); } } T instance = contextual.create(creationalContext); if (instance != null) { beanInstance = new SerializableContextualInstanceImpl<Contextual<T>, T>(contextual, instance, creationalContext, serviceRegistry.get(ContextualStore.class)); beanStore.put(id, beanInstance); } return instance; } finally { if (lock != null) { lock.unlock(); } } } else { return null; } }
java
@Override @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 beanStore = getBeanStore(); if (beanStore == null) { return null; } if (contextual == null) { throw ContextLogger.LOG.contextualIsNull(); } BeanIdentifier id = getId(contextual); ContextualInstance<T> beanInstance = beanStore.get(id); if (beanInstance != null) { return beanInstance.getInstance(); } else if (creationalContext != null) { LockedBean lock = null; try { if (multithreaded) { lock = beanStore.lock(id); beanInstance = beanStore.get(id); if (beanInstance != null) { return beanInstance.getInstance(); } } T instance = contextual.create(creationalContext); if (instance != null) { beanInstance = new SerializableContextualInstanceImpl<Contextual<T>, T>(contextual, instance, creationalContext, serviceRegistry.get(ContextualStore.class)); beanStore.put(id, beanInstance); } return instance; } finally { if (lock != null) { lock.unlock(); } } } else { return null; } }
[ "@", "Override", "@", "SuppressFBWarnings", "(", "value", "=", "\"UL_UNRELEASED_LOCK\"", ",", "justification", "=", "\"False positive from FindBugs\"", ")", "public", "<", "T", ">", "T", "get", "(", "Contextual", "<", "T", ">", "contextual", ",", "CreationalContex...
Get the bean if it exists in the contexts. @return An instance of the bean @throws ContextNotActiveException if the context is not active @see javax.enterprise.context.spi.Context#get(BaseBean, boolean)
[ "Get", "the", "bean", "if", "it", "exists", "in", "the", "contexts", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/AbstractContext.java#L68-L110
train
weld/core
impl/src/main/java/org/jboss/weld/contexts/AbstractContext.java
AbstractContext.destroy
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.clear(); }
java
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.clear(); }
[ "protected", "void", "destroy", "(", ")", "{", "ContextLogger", ".", "LOG", ".", "contextCleared", "(", "this", ")", ";", "final", "BeanStore", "beanStore", "=", "getBeanStore", "(", ")", ";", "if", "(", "beanStore", "==", "null", ")", "{", "throw", "Con...
Destroys the context
[ "Destroys", "the", "context" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/AbstractContext.java#L146-L156
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/Iterables.java
Iterables.addAll
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()); }
java
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()); }
[ "public", "static", "<", "T", ">", "boolean", "addAll", "(", "Collection", "<", "T", ">", "target", ",", "Iterable", "<", "?", "extends", "T", ">", "iterable", ")", "{", "if", "(", "iterable", "instanceof", "Collection", ")", "{", "return", "target", "...
Add all elements in the iterable to the collection. @param target @param iterable @return true if the target was modified, false otherwise
[ "Add", "all", "elements", "in", "the", "iterable", "to", "the", "collection", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/Iterables.java#L41-L46
train
weld/core
impl/src/main/java/org/jboss/weld/manager/FieldProducerFactory.java
FieldProducerFactory.createProducer
@Override 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()); return new ProducerFieldProducer<X, T>(enhancedField, disposalMethod) { @Override public AnnotatedField<X> getAnnotated() { return field; } @Override public BeanManagerImpl getBeanManager() { return getManager(); } @Override public Bean<X> getDeclaringBean() { return declaringBean; } @Override public Bean<T> getBean() { return bean; } }; }
java
@Override 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()); return new ProducerFieldProducer<X, T>(enhancedField, disposalMethod) { @Override public AnnotatedField<X> getAnnotated() { return field; } @Override public BeanManagerImpl getBeanManager() { return getManager(); } @Override public Bean<X> getDeclaringBean() { return declaringBean; } @Override public Bean<T> getBean() { return bean; } }; }
[ "@", "Override", "public", "<", "T", ">", "Producer", "<", "T", ">", "createProducer", "(", "final", "Bean", "<", "X", ">", "declaringBean", ",", "final", "Bean", "<", "T", ">", "bean", ",", "DisposalMethod", "<", "X", ",", "T", ">", "disposalMethod", ...
Producers returned from this method are not validated. Internal use only.
[ "Producers", "returned", "from", "this", "method", "are", "not", "validated", ".", "Internal", "use", "only", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/manager/FieldProducerFactory.java#L43-L68
train
weld/core
environments/common/src/main/java/org/jboss/weld/environment/deployment/WeldDeployment.java
WeldDeployment.createAdditionalBeanDeploymentArchive
protected WeldBeanDeploymentArchive createAdditionalBeanDeploymentArchive() { WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(ADDITIONAL_BDA_ID, Collections.synchronizedSet(new HashSet<String>()), null); additionalBda.getServices().addAll(getServices().entrySet()); beanDeploymentArchives.add(additionalBda); setBeanDeploymentArchivesAccessibility(); return additionalBda; }
java
protected WeldBeanDeploymentArchive createAdditionalBeanDeploymentArchive() { WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(ADDITIONAL_BDA_ID, Collections.synchronizedSet(new HashSet<String>()), null); additionalBda.getServices().addAll(getServices().entrySet()); beanDeploymentArchives.add(additionalBda); setBeanDeploymentArchivesAccessibility(); return additionalBda; }
[ "protected", "WeldBeanDeploymentArchive", "createAdditionalBeanDeploymentArchive", "(", ")", "{", "WeldBeanDeploymentArchive", "additionalBda", "=", "new", "WeldBeanDeploymentArchive", "(", "ADDITIONAL_BDA_ID", ",", "Collections", ".", "synchronizedSet", "(", "new", "HashSet", ...
Additional bean deployment archives are used for extentions, synthetic annotated types and beans which do not come from a bean archive. @param beanClass @return the additional bean deployment archive
[ "Additional", "bean", "deployment", "archives", "are", "used", "for", "extentions", "synthetic", "annotated", "types", "and", "beans", "which", "do", "not", "come", "from", "a", "bean", "archive", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/common/src/main/java/org/jboss/weld/environment/deployment/WeldDeployment.java#L104-L110
train
weld/core
environments/common/src/main/java/org/jboss/weld/environment/deployment/WeldDeployment.java
WeldDeployment.setBeanDeploymentArchivesAccessibility
protected void setBeanDeploymentArchivesAccessibility() { for (WeldBeanDeploymentArchive beanDeploymentArchive : beanDeploymentArchives) { Set<WeldBeanDeploymentArchive> accessibleArchives = new HashSet<>(); for (WeldBeanDeploymentArchive candidate : beanDeploymentArchives) { if (candidate.equals(beanDeploymentArchive)) { continue; } accessibleArchives.add(candidate); } beanDeploymentArchive.setAccessibleBeanDeploymentArchives(accessibleArchives); } }
java
protected void setBeanDeploymentArchivesAccessibility() { for (WeldBeanDeploymentArchive beanDeploymentArchive : beanDeploymentArchives) { Set<WeldBeanDeploymentArchive> accessibleArchives = new HashSet<>(); for (WeldBeanDeploymentArchive candidate : beanDeploymentArchives) { if (candidate.equals(beanDeploymentArchive)) { continue; } accessibleArchives.add(candidate); } beanDeploymentArchive.setAccessibleBeanDeploymentArchives(accessibleArchives); } }
[ "protected", "void", "setBeanDeploymentArchivesAccessibility", "(", ")", "{", "for", "(", "WeldBeanDeploymentArchive", "beanDeploymentArchive", ":", "beanDeploymentArchives", ")", "{", "Set", "<", "WeldBeanDeploymentArchive", ">", "accessibleArchives", "=", "new", "HashSet"...
By default all bean archives see each other.
[ "By", "default", "all", "bean", "archives", "see", "each", "other", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/common/src/main/java/org/jboss/weld/environment/deployment/WeldDeployment.java#L115-L126
train
weld/core
probe/core/src/main/java/org/jboss/weld/probe/Parsers.java
Parsers.parseType
static Type parseType(String value, ResourceLoader resourceLoader) { value = value.trim(); // Wildcards if (value.equals(WILDCARD)) { return WildcardTypeImpl.defaultInstance(); } if (value.startsWith(WILDCARD_EXTENDS)) { Type upperBound = parseType(value.substring(WILDCARD_EXTENDS.length(), value.length()), resourceLoader); if (upperBound == null) { return null; } return WildcardTypeImpl.withUpperBound(upperBound); } if (value.startsWith(WILDCARD_SUPER)) { Type lowerBound = parseType(value.substring(WILDCARD_SUPER.length(), value.length()), resourceLoader); if (lowerBound == null) { return null; } return WildcardTypeImpl.withLowerBound(lowerBound); } // Array if (value.contains(ARRAY)) { Type componentType = parseType(value.substring(0, value.indexOf(ARRAY)), resourceLoader); if (componentType == null) { return null; } return new GenericArrayTypeImpl(componentType); } int chevLeft = value.indexOf(CHEVRONS_LEFT); String rawValue = chevLeft < 0 ? value : value.substring(0, chevLeft); Class<?> rawRequiredType = tryLoadClass(rawValue, resourceLoader); if (rawRequiredType == null) { return null; } if (rawRequiredType.getTypeParameters().length == 0) { return rawRequiredType; } // Parameterized type int chevRight = value.lastIndexOf(CHEVRONS_RIGHT); if (chevRight < 0) { return null; } List<String> parts = split(value.substring(chevLeft + 1, chevRight), ',', CHEVRONS_LEFT.charAt(0), CHEVRONS_RIGHT.charAt(0)); Type[] typeParameters = new Type[parts.size()]; for (int i = 0; i < typeParameters.length; i++) { Type typeParam = parseType(parts.get(i), resourceLoader); if (typeParam == null) { return null; } typeParameters[i] = typeParam; } return new ParameterizedTypeImpl(rawRequiredType, typeParameters); }
java
static Type parseType(String value, ResourceLoader resourceLoader) { value = value.trim(); // Wildcards if (value.equals(WILDCARD)) { return WildcardTypeImpl.defaultInstance(); } if (value.startsWith(WILDCARD_EXTENDS)) { Type upperBound = parseType(value.substring(WILDCARD_EXTENDS.length(), value.length()), resourceLoader); if (upperBound == null) { return null; } return WildcardTypeImpl.withUpperBound(upperBound); } if (value.startsWith(WILDCARD_SUPER)) { Type lowerBound = parseType(value.substring(WILDCARD_SUPER.length(), value.length()), resourceLoader); if (lowerBound == null) { return null; } return WildcardTypeImpl.withLowerBound(lowerBound); } // Array if (value.contains(ARRAY)) { Type componentType = parseType(value.substring(0, value.indexOf(ARRAY)), resourceLoader); if (componentType == null) { return null; } return new GenericArrayTypeImpl(componentType); } int chevLeft = value.indexOf(CHEVRONS_LEFT); String rawValue = chevLeft < 0 ? value : value.substring(0, chevLeft); Class<?> rawRequiredType = tryLoadClass(rawValue, resourceLoader); if (rawRequiredType == null) { return null; } if (rawRequiredType.getTypeParameters().length == 0) { return rawRequiredType; } // Parameterized type int chevRight = value.lastIndexOf(CHEVRONS_RIGHT); if (chevRight < 0) { return null; } List<String> parts = split(value.substring(chevLeft + 1, chevRight), ',', CHEVRONS_LEFT.charAt(0), CHEVRONS_RIGHT.charAt(0)); Type[] typeParameters = new Type[parts.size()]; for (int i = 0; i < typeParameters.length; i++) { Type typeParam = parseType(parts.get(i), resourceLoader); if (typeParam == null) { return null; } typeParameters[i] = typeParam; } return new ParameterizedTypeImpl(rawRequiredType, typeParameters); }
[ "static", "Type", "parseType", "(", "String", "value", ",", "ResourceLoader", "resourceLoader", ")", "{", "value", "=", "value", ".", "trim", "(", ")", ";", "// Wildcards", "if", "(", "value", ".", "equals", "(", "WILDCARD", ")", ")", "{", "return", "Wil...
Type variables are not supported. @param value @return the type
[ "Type", "variables", "are", "not", "supported", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/probe/core/src/main/java/org/jboss/weld/probe/Parsers.java#L70-L122
train
weld/core
environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/portlet/PortletSupport.java
PortletSupport.isPortletEnvSupported
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; } } } } return enabled; }
java
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; } } } } return enabled; }
[ "public", "static", "boolean", "isPortletEnvSupported", "(", ")", "{", "if", "(", "enabled", "==", "null", ")", "{", "synchronized", "(", "PortletSupport", ".", "class", ")", "{", "if", "(", "enabled", "==", "null", ")", "{", "try", "{", "PortletSupport", ...
Is portlet env supported. @return true if portlet env is supported, false otherwise
[ "Is", "portlet", "env", "supported", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/portlet/PortletSupport.java#L40-L54
train
weld/core
environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/portlet/PortletSupport.java
PortletSupport.getBeanManager
public static BeanManager getBeanManager(Object ctx) { return (BeanManager) javax.portlet.PortletContext.class.cast(ctx).getAttribute(WeldServletLifecycle.BEAN_MANAGER_ATTRIBUTE_NAME); }
java
public static BeanManager getBeanManager(Object ctx) { return (BeanManager) javax.portlet.PortletContext.class.cast(ctx).getAttribute(WeldServletLifecycle.BEAN_MANAGER_ATTRIBUTE_NAME); }
[ "public", "static", "BeanManager", "getBeanManager", "(", "Object", "ctx", ")", "{", "return", "(", "BeanManager", ")", "javax", ".", "portlet", ".", "PortletContext", ".", "class", ".", "cast", "(", "ctx", ")", ".", "getAttribute", "(", "WeldServletLifecycle"...
Get bean manager from portlet context. @param ctx the portlet context @return bean manager if found
[ "Get", "bean", "manager", "from", "portlet", "context", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/portlet/PortletSupport.java#L72-L74
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/enablement/GlobalEnablementBuilder.java
GlobalEnablementBuilder.filter
private <T> List<Class<?>> filter(List<Class<?>> enabledClasses, List<Class<?>> globallyEnabledClasses, LogMessageCallback logMessageCallback, BeanDeployment deployment) { for (Iterator<Class<?>> iterator = enabledClasses.iterator(); iterator.hasNext(); ) { Class<?> enabledClass = iterator.next(); if (globallyEnabledClasses.contains(enabledClass)) { logMessageCallback.log(enabledClass, deployment.getBeanDeploymentArchive().getId()); iterator.remove(); } } return enabledClasses; }
java
private <T> List<Class<?>> filter(List<Class<?>> enabledClasses, List<Class<?>> globallyEnabledClasses, LogMessageCallback logMessageCallback, BeanDeployment deployment) { for (Iterator<Class<?>> iterator = enabledClasses.iterator(); iterator.hasNext(); ) { Class<?> enabledClass = iterator.next(); if (globallyEnabledClasses.contains(enabledClass)) { logMessageCallback.log(enabledClass, deployment.getBeanDeploymentArchive().getId()); iterator.remove(); } } return enabledClasses; }
[ "private", "<", "T", ">", "List", "<", "Class", "<", "?", ">", ">", "filter", "(", "List", "<", "Class", "<", "?", ">", ">", "enabledClasses", ",", "List", "<", "Class", "<", "?", ">", ">", "globallyEnabledClasses", ",", "LogMessageCallback", "logMessa...
Filter out interceptors and decorators which are also enabled globally. @param enabledClasses @param globallyEnabledClasses @param logMessageCallback @param deployment @return the filtered list
[ "Filter", "out", "interceptors", "and", "decorators", "which", "are", "also", "enabled", "globally", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/enablement/GlobalEnablementBuilder.java#L270-L280
train
weld/core
impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java
TypeSafeResolver.resolve
public F resolve(R resolvable, boolean cache) { R wrappedResolvable = wrap(resolvable); if (cache) { return resolved.getValue(wrappedResolvable); } else { return resolverFunction.apply(wrappedResolvable); } }
java
public F resolve(R resolvable, boolean cache) { R wrappedResolvable = wrap(resolvable); if (cache) { return resolved.getValue(wrappedResolvable); } else { return resolverFunction.apply(wrappedResolvable); } }
[ "public", "F", "resolve", "(", "R", "resolvable", ",", "boolean", "cache", ")", "{", "R", "wrappedResolvable", "=", "wrap", "(", "resolvable", ")", ";", "if", "(", "cache", ")", "{", "return", "resolved", ".", "getValue", "(", "wrappedResolvable", ")", "...
Get the possible beans for the given element @param resolvable The resolving criteria @return An unmodifiable set of matching beans
[ "Get", "the", "possible", "beans", "for", "the", "given", "element" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java#L85-L92
train
weld/core
impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java
TypeSafeResolver.findMatching
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; }
java
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; }
[ "private", "Set", "<", "T", ">", "findMatching", "(", "R", "resolvable", ")", "{", "Set", "<", "T", ">", "result", "=", "new", "HashSet", "<", "T", ">", "(", ")", ";", "for", "(", "T", "bean", ":", "getAllBeans", "(", "resolvable", ")", ")", "{",...
Gets the matching beans for binding criteria from a list of beans @param resolvable the resolvable @return A set of filtered beans
[ "Gets", "the", "matching", "beans", "for", "binding", "criteria", "from", "a", "list", "of", "beans" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java#L100-L108
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java
BeanDeployerEnvironment.resolveDisposalBeans
public <X> Set<DisposalMethod<X, ?>> resolveDisposalBeans(Set<Type> types, Set<Annotation> qualifiers, AbstractClassBean<X> declaringBean) { // We can always cache as this is only ever called by Weld where we avoid non-static inner classes for annotation literals Set<DisposalMethod<X, ?>> beans = cast(disposalMethodResolver.resolve(new ResolvableBuilder(manager).addTypes(types).addQualifiers(qualifiers).setDeclaringBean(declaringBean).create(), true)); resolvedDisposalBeans.addAll(beans); return Collections.unmodifiableSet(beans); }
java
public <X> Set<DisposalMethod<X, ?>> resolveDisposalBeans(Set<Type> types, Set<Annotation> qualifiers, AbstractClassBean<X> declaringBean) { // We can always cache as this is only ever called by Weld where we avoid non-static inner classes for annotation literals Set<DisposalMethod<X, ?>> beans = cast(disposalMethodResolver.resolve(new ResolvableBuilder(manager).addTypes(types).addQualifiers(qualifiers).setDeclaringBean(declaringBean).create(), true)); resolvedDisposalBeans.addAll(beans); return Collections.unmodifiableSet(beans); }
[ "public", "<", "X", ">", "Set", "<", "DisposalMethod", "<", "X", ",", "?", ">", ">", "resolveDisposalBeans", "(", "Set", "<", "Type", ">", "types", ",", "Set", "<", "Annotation", ">", "qualifiers", ",", "AbstractClassBean", "<", "X", ">", "declaringBean"...
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. @param types the types @param qualifiers The binding types to match @param declaringBean declaring bean @return The set of matching disposal methods
[ "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", ".",...
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java#L297-L302
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeans.java
SessionBeans.getSessionBeanTypes
private static <T> Set<Type> getSessionBeanTypes(EnhancedAnnotated<T, ?> annotated, EjbDescriptor<T> ejbDescriptor) { ImmutableSet.Builder<Type> types = ImmutableSet.builder(); // session beans Map<Class<?>, Type> typeMap = new LinkedHashMap<Class<?>, Type>(); HierarchyDiscovery beanClassDiscovery = HierarchyDiscovery.forNormalizedType(ejbDescriptor.getBeanClass()); for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces()) { // first we need to resolve the local interface Type resolvedLocalInterface = beanClassDiscovery.resolveType(Types.getCanonicalType(businessInterfaceDescriptor.getInterface())); SessionBeanHierarchyDiscovery interfaceDiscovery = new SessionBeanHierarchyDiscovery(resolvedLocalInterface); if (beanClassDiscovery.getTypeMap().containsKey(businessInterfaceDescriptor.getInterface())) { // WELD-1675 Only add types also included in Annotated.getTypeClosure() for (Entry<Class<?>, Type> entry : interfaceDiscovery.getTypeMap().entrySet()) { if (annotated.getTypeClosure().contains(entry.getValue())) { typeMap.put(entry.getKey(), entry.getValue()); } } } else { // Session bean class does not implement the business interface and @javax.ejb.Local applied to the session bean class typeMap.putAll(interfaceDiscovery.getTypeMap()); } } if (annotated.isAnnotationPresent(Typed.class)) { types.addAll(Beans.getTypedTypes(typeMap, annotated.getJavaClass(), annotated.getAnnotation(Typed.class))); } else { typeMap.put(Object.class, Object.class); types.addAll(typeMap.values()); } return Beans.getLegalBeanTypes(types.build(), annotated); }
java
private static <T> Set<Type> getSessionBeanTypes(EnhancedAnnotated<T, ?> annotated, EjbDescriptor<T> ejbDescriptor) { ImmutableSet.Builder<Type> types = ImmutableSet.builder(); // session beans Map<Class<?>, Type> typeMap = new LinkedHashMap<Class<?>, Type>(); HierarchyDiscovery beanClassDiscovery = HierarchyDiscovery.forNormalizedType(ejbDescriptor.getBeanClass()); for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces()) { // first we need to resolve the local interface Type resolvedLocalInterface = beanClassDiscovery.resolveType(Types.getCanonicalType(businessInterfaceDescriptor.getInterface())); SessionBeanHierarchyDiscovery interfaceDiscovery = new SessionBeanHierarchyDiscovery(resolvedLocalInterface); if (beanClassDiscovery.getTypeMap().containsKey(businessInterfaceDescriptor.getInterface())) { // WELD-1675 Only add types also included in Annotated.getTypeClosure() for (Entry<Class<?>, Type> entry : interfaceDiscovery.getTypeMap().entrySet()) { if (annotated.getTypeClosure().contains(entry.getValue())) { typeMap.put(entry.getKey(), entry.getValue()); } } } else { // Session bean class does not implement the business interface and @javax.ejb.Local applied to the session bean class typeMap.putAll(interfaceDiscovery.getTypeMap()); } } if (annotated.isAnnotationPresent(Typed.class)) { types.addAll(Beans.getTypedTypes(typeMap, annotated.getJavaClass(), annotated.getAnnotation(Typed.class))); } else { typeMap.put(Object.class, Object.class); types.addAll(typeMap.values()); } return Beans.getLegalBeanTypes(types.build(), annotated); }
[ "private", "static", "<", "T", ">", "Set", "<", "Type", ">", "getSessionBeanTypes", "(", "EnhancedAnnotated", "<", "T", ",", "?", ">", "annotated", ",", "EjbDescriptor", "<", "T", ">", "ejbDescriptor", ")", "{", "ImmutableSet", ".", "Builder", "<", "Type",...
Bean types of a session bean.
[ "Bean", "types", "of", "a", "session", "bean", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeans.java#L125-L153
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java
SessionBeanImpl.of
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(type, ejbDescriptor)), beanManager); }
java
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(type, ejbDescriptor)), beanManager); }
[ "public", "static", "<", "T", ">", "SessionBean", "<", "T", ">", "of", "(", "BeanAttributes", "<", "T", ">", "attributes", ",", "InternalEjbDescriptor", "<", "T", ">", "ejbDescriptor", ",", "BeanManagerImpl", "beanManager", ",", "EnhancedAnnotatedType", "<", "...
Creates a simple, annotation defined Enterprise Web Bean using the annotations specified on type @param <T> The type @param beanManager the current manager @param type the AnnotatedType to use @return An Enterprise Web Bean
[ "Creates", "a", "simple", "annotation", "defined", "Enterprise", "Web", "Bean", "using", "the", "annotations", "specified", "on", "type" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java#L76-L78
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java
SessionBeanImpl.checkConflictingRoles
protected void checkConflictingRoles() { if (getType().isAnnotationPresent(Interceptor.class)) { throw BeanLogger.LOG.ejbCannotBeInterceptor(getType()); } if (getType().isAnnotationPresent(Decorator.class)) { throw BeanLogger.LOG.ejbCannotBeDecorator(getType()); } }
java
protected void checkConflictingRoles() { if (getType().isAnnotationPresent(Interceptor.class)) { throw BeanLogger.LOG.ejbCannotBeInterceptor(getType()); } if (getType().isAnnotationPresent(Decorator.class)) { throw BeanLogger.LOG.ejbCannotBeDecorator(getType()); } }
[ "protected", "void", "checkConflictingRoles", "(", ")", "{", "if", "(", "getType", "(", ")", ".", "isAnnotationPresent", "(", "Interceptor", ".", "class", ")", ")", "{", "throw", "BeanLogger", ".", "LOG", ".", "ejbCannotBeInterceptor", "(", "getType", "(", "...
Validates for non-conflicting roles
[ "Validates", "for", "non", "-", "conflicting", "roles" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java#L107-L114
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java
SessionBeanImpl.checkScopeAllowed
protected void checkScopeAllowed() { if (ejbDescriptor.isStateless() && !isDependent()) { throw BeanLogger.LOG.scopeNotAllowedOnStatelessSessionBean(getScope(), getType()); } if (ejbDescriptor.isSingleton() && !(isDependent() || getScope().equals(ApplicationScoped.class))) { throw BeanLogger.LOG.scopeNotAllowedOnSingletonBean(getScope(), getType()); } }
java
protected void checkScopeAllowed() { if (ejbDescriptor.isStateless() && !isDependent()) { throw BeanLogger.LOG.scopeNotAllowedOnStatelessSessionBean(getScope(), getType()); } if (ejbDescriptor.isSingleton() && !(isDependent() || getScope().equals(ApplicationScoped.class))) { throw BeanLogger.LOG.scopeNotAllowedOnSingletonBean(getScope(), getType()); } }
[ "protected", "void", "checkScopeAllowed", "(", ")", "{", "if", "(", "ejbDescriptor", ".", "isStateless", "(", ")", "&&", "!", "isDependent", "(", ")", ")", "{", "throw", "BeanLogger", ".", "LOG", ".", "scopeNotAllowedOnStatelessSessionBean", "(", "getScope", "...
Check that the scope type is allowed by the stereotypes on the bean and the bean type
[ "Check", "that", "the", "scope", "type", "is", "allowed", "by", "the", "stereotypes", "on", "the", "bean", "and", "the", "bean", "type" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java#L120-L127
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java
SessionBeanImpl.checkObserverMethods
protected void checkObserverMethods() { Collection<EnhancedAnnotatedMethod<?, ? super T>> observerMethods = BeanMethods.getObserverMethods(this.getEnhancedAnnotated()); Collection<EnhancedAnnotatedMethod<?, ? super T>> asyncObserverMethods = BeanMethods.getAsyncObserverMethods(this.getEnhancedAnnotated()); checkObserverMethods(observerMethods); checkObserverMethods(asyncObserverMethods); }
java
protected void checkObserverMethods() { Collection<EnhancedAnnotatedMethod<?, ? super T>> observerMethods = BeanMethods.getObserverMethods(this.getEnhancedAnnotated()); Collection<EnhancedAnnotatedMethod<?, ? super T>> asyncObserverMethods = BeanMethods.getAsyncObserverMethods(this.getEnhancedAnnotated()); checkObserverMethods(observerMethods); checkObserverMethods(asyncObserverMethods); }
[ "protected", "void", "checkObserverMethods", "(", ")", "{", "Collection", "<", "EnhancedAnnotatedMethod", "<", "?", ",", "?", "super", "T", ">", ">", "observerMethods", "=", "BeanMethods", ".", "getObserverMethods", "(", "this", ".", "getEnhancedAnnotated", "(", ...
If there are any observer methods, they must be static or business methods.
[ "If", "there", "are", "any", "observer", "methods", "they", "must", "be", "static", "or", "business", "methods", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/SessionBeanImpl.java#L203-L208
train
weld/core
impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java
NewManagedBean.of
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); }
java
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); }
[ "public", "static", "<", "T", ">", "NewManagedBean", "<", "T", ">", "of", "(", "BeanAttributes", "<", "T", ">", "attributes", ",", "EnhancedAnnotatedType", "<", "T", ">", "clazz", ",", "BeanManagerImpl", "beanManager", ")", "{", "return", "new", "NewManagedB...
Creates an instance of a NewSimpleBean from an annotated class @param clazz The annotated class @param beanManager The Bean manager @return a new NewSimpleBean instance
[ "Creates", "an", "instance", "of", "a", "NewSimpleBean", "from", "an", "annotated", "class" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/NewManagedBean.java#L39-L41
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/EnterpriseBeanProxyMethodHandler.java
EnterpriseBeanProxyMethodHandler.invoke
@Override 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(); } } return null; } if (!bean.isClientCanCallRemoveMethods() && isRemoveMethod(method)) { throw BeanLogger.LOG.invalidRemoveMethodInvocation(method); } Class<?> businessInterface = getBusinessInterface(method); if (reference.isRemoved() && isToStringMethod(method)) { return businessInterface.getName() + " [REMOVED]"; } Object proxiedInstance = reference.getBusinessObject(businessInterface); if (!Modifier.isPublic(method.getModifiers())) { throw new EJBException("Not a business method " + method.toString() +". Do not call non-public methods on EJB's."); } Object returnValue = Reflections.invokeAndUnwrap(proxiedInstance, method, args); BeanLogger.LOG.callProxiedMethod(method, proxiedInstance, args, returnValue); return returnValue; }
java
@Override 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(); } } return null; } if (!bean.isClientCanCallRemoveMethods() && isRemoveMethod(method)) { throw BeanLogger.LOG.invalidRemoveMethodInvocation(method); } Class<?> businessInterface = getBusinessInterface(method); if (reference.isRemoved() && isToStringMethod(method)) { return businessInterface.getName() + " [REMOVED]"; } Object proxiedInstance = reference.getBusinessObject(businessInterface); if (!Modifier.isPublic(method.getModifiers())) { throw new EJBException("Not a business method " + method.toString() +". Do not call non-public methods on EJB's."); } Object returnValue = Reflections.invokeAndUnwrap(proxiedInstance, method, args); BeanLogger.LOG.callProxiedMethod(method, proxiedInstance, args, returnValue); return returnValue; }
[ "@", "Override", "public", "Object", "invoke", "(", "Object", "self", ",", "Method", "method", ",", "Method", "proceed", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "if", "(", "\"destroy\"", ".", "equals", "(", "method", ".", "getNa...
Looks up the EJB in the container and executes the method on it @param self the proxy instance. @param method the overridden method declared in the super class or interface. @param proceed the forwarder method for invoking the overridden method. It is null if the overridden method is abstract or declared in the interface. @param args an array of objects containing the values of the arguments passed in the method invocation on the proxy instance. If a parameter type is a primitive type, the type of the array element is a wrapper class. @return the resulting value of the method invocation. @throws Throwable if the method invocation fails.
[ "Looks", "up", "the", "EJB", "in", "the", "container", "and", "executes", "the", "method", "on", "it" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/EnterpriseBeanProxyMethodHandler.java#L111-L137
train
weld/core
modules/jta/src/main/java/org/jboss/weld/module/jta/TransactionalObserverNotifier.java
TransactionalObserverNotifier.deferNotification
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(TransactionPhase.BEFORE_COMPLETION); Status status = Status.valueOf(transactionPhase); notifications.add(new DeferredEventNotification<T>(contextId, event, metadata, observer, currentEventMetadata, status, before)); }
java
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(TransactionPhase.BEFORE_COMPLETION); Status status = Status.valueOf(transactionPhase); notifications.add(new DeferredEventNotification<T>(contextId, event, metadata, observer, currentEventMetadata, status, before)); }
[ "private", "<", "T", ">", "void", "deferNotification", "(", "T", "event", ",", "final", "EventMetadata", "metadata", ",", "final", "ObserverMethod", "<", "?", "super", "T", ">", "observer", ",", "final", "List", "<", "DeferredEventNotification", "<", "?", ">...
Defers an event for processing in a later phase of the current transaction. @param metadata The event object
[ "Defers", "an", "event", "for", "processing", "in", "a", "later", "phase", "of", "the", "current", "transaction", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/jta/src/main/java/org/jboss/weld/module/jta/TransactionalObserverNotifier.java#L63-L69
train
weld/core
impl/src/main/java/org/jboss/weld/serialization/BeanIdentifierIndex.java
BeanIdentifierIndex.build
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<BeanIdentifier> tempIndex = new ArrayList<BeanIdentifier>(beans.size()); for (Bean<?> bean : beans) { if (bean instanceof CommonBean<?>) { tempIndex.add(((CommonBean<?>) bean).getIdentifier()); } else if (bean instanceof PassivationCapable) { tempIndex.add(new StringBeanIdentifier(((PassivationCapable) bean).getId())); } } Collections.sort(tempIndex, new Comparator<BeanIdentifier>() { @Override public int compare(BeanIdentifier o1, BeanIdentifier o2) { return o1.asString().compareTo(o2.asString()); } }); index = tempIndex.toArray(new BeanIdentifier[tempIndex.size()]); ImmutableMap.Builder<BeanIdentifier, Integer> builder = ImmutableMap.builder(); for (int i = 0; i < index.length; i++) { builder.put(index[i], i); } reverseIndex = builder.build(); indexHash = Arrays.hashCode(index); if(BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.beanIdentifierIndexBuilt(getDebugInfo()); } indexBuilt.set(true); }
java
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<BeanIdentifier> tempIndex = new ArrayList<BeanIdentifier>(beans.size()); for (Bean<?> bean : beans) { if (bean instanceof CommonBean<?>) { tempIndex.add(((CommonBean<?>) bean).getIdentifier()); } else if (bean instanceof PassivationCapable) { tempIndex.add(new StringBeanIdentifier(((PassivationCapable) bean).getId())); } } Collections.sort(tempIndex, new Comparator<BeanIdentifier>() { @Override public int compare(BeanIdentifier o1, BeanIdentifier o2) { return o1.asString().compareTo(o2.asString()); } }); index = tempIndex.toArray(new BeanIdentifier[tempIndex.size()]); ImmutableMap.Builder<BeanIdentifier, Integer> builder = ImmutableMap.builder(); for (int i = 0; i < index.length; i++) { builder.put(index[i], i); } reverseIndex = builder.build(); indexHash = Arrays.hashCode(index); if(BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.beanIdentifierIndexBuilt(getDebugInfo()); } indexBuilt.set(true); }
[ "public", "void", "build", "(", "Set", "<", "Bean", "<", "?", ">", ">", "beans", ")", "{", "if", "(", "isBuilt", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"BeanIdentifier index is already built!\"", ")", ";", "}", "if", "(", "be...
Note that the index can only be built once. @param beans The set of beans the index should be built from, only instances of {@link CommonBean} and implementations of {@link PassivationCapable} are included @throws IllegalStateException If the index is built already
[ "Note", "that", "the", "index", "can", "only", "be", "built", "once", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/serialization/BeanIdentifierIndex.java#L100-L145
train
weld/core
impl/src/main/java/org/jboss/weld/event/FastEvent.java
FastEvent.of
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()) { EventMetadata metadata = new EventMetadataImpl(type, null, qualifiers); CurrentEventMetadata metadataService = manager.getServices().get(CurrentEventMetadata.class); return new FastEventWithMetadataPropagation<T>(resolvedObserverMethods, metadata, metadataService); } else { return new FastEvent<T>(resolvedObserverMethods); } }
java
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()) { EventMetadata metadata = new EventMetadataImpl(type, null, qualifiers); CurrentEventMetadata metadataService = manager.getServices().get(CurrentEventMetadata.class); return new FastEventWithMetadataPropagation<T>(resolvedObserverMethods, metadata, metadataService); } else { return new FastEvent<T>(resolvedObserverMethods); } }
[ "public", "static", "<", "T", ">", "FastEvent", "<", "T", ">", "of", "(", "Class", "<", "T", ">", "type", ",", "BeanManagerImpl", "manager", ",", "ObserverNotifier", "notifier", ",", "Annotation", "...", "qualifiers", ")", "{", "ResolvedObservers", "<", "T...
Constructs a new FastEvent instance @param type the event type @param manager the bean manager @param notifier the notifier to be used for observer method resolution @param qualifiers the event qualifiers @return
[ "Constructs", "a", "new", "FastEvent", "instance" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/FastEvent.java#L75-L84
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/ImmutableList.java
ImmutableList.copyOf
public static <T> List<T> copyOf(T[] elements) { Preconditions.checkNotNull(elements); return ofInternal(elements.clone()); }
java
public static <T> List<T> copyOf(T[] elements) { Preconditions.checkNotNull(elements); return ofInternal(elements.clone()); }
[ "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. @param elements the given array of elements @return an immutable list
[ "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"...
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/ImmutableList.java#L66-L69
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/ImmutableList.java
ImmutableList.copyOf
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()); }
java
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()); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "copyOf", "(", "Collection", "<", "T", ">", "source", ")", "{", "Preconditions", ".", "checkNotNull", "(", "source", ")", ";", "if", "(", "source", "instanceof", "ImmutableList", "<", "?", ">", ...
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. @param source the given collection @return an immutable list
[ "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", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/ImmutableList.java#L78-L87
train
weld/core
impl/src/main/java/org/jboss/weld/util/Interceptors.java
Interceptors.filterInterceptorBindings
public static Set<Annotation> filterInterceptorBindings(BeanManagerImpl beanManager, Collection<Annotation> annotations) { Set<Annotation> interceptorBindings = new InterceptorBindingSet(beanManager); for (Annotation annotation : annotations) { if (beanManager.isInterceptorBinding(annotation.annotationType())) { interceptorBindings.add(annotation); } } return interceptorBindings; }
java
public static Set<Annotation> filterInterceptorBindings(BeanManagerImpl beanManager, Collection<Annotation> annotations) { Set<Annotation> interceptorBindings = new InterceptorBindingSet(beanManager); for (Annotation annotation : annotations) { if (beanManager.isInterceptorBinding(annotation.annotationType())) { interceptorBindings.add(annotation); } } return interceptorBindings; }
[ "public", "static", "Set", "<", "Annotation", ">", "filterInterceptorBindings", "(", "BeanManagerImpl", "beanManager", ",", "Collection", "<", "Annotation", ">", "annotations", ")", "{", "Set", "<", "Annotation", ">", "interceptorBindings", "=", "new", "InterceptorB...
Extracts a set of interceptor bindings from a collection of annotations. @param beanManager @param annotations @return
[ "Extracts", "a", "set", "of", "interceptor", "bindings", "from", "a", "collection", "of", "annotations", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Interceptors.java#L54-L62
train
weld/core
impl/src/main/java/org/jboss/weld/util/Interceptors.java
Interceptors.flattenInterceptorBindings
public static Set<Annotation> flattenInterceptorBindings(EnhancedAnnotatedType<?> clazz, BeanManagerImpl beanManager, Collection<Annotation> annotations, boolean addTopLevelInterceptorBindings, boolean addInheritedInterceptorBindings) { Set<Annotation> flattenInterceptorBindings = new InterceptorBindingSet(beanManager); MetaAnnotationStore metaAnnotationStore = beanManager.getServices().get(MetaAnnotationStore.class); if (addTopLevelInterceptorBindings) { addInterceptorBindings(clazz, annotations, flattenInterceptorBindings, metaAnnotationStore); } if (addInheritedInterceptorBindings) { for (Annotation annotation : annotations) { addInheritedInterceptorBindings(clazz, annotation.annotationType(), metaAnnotationStore, flattenInterceptorBindings); } } return flattenInterceptorBindings; }
java
public static Set<Annotation> flattenInterceptorBindings(EnhancedAnnotatedType<?> clazz, BeanManagerImpl beanManager, Collection<Annotation> annotations, boolean addTopLevelInterceptorBindings, boolean addInheritedInterceptorBindings) { Set<Annotation> flattenInterceptorBindings = new InterceptorBindingSet(beanManager); MetaAnnotationStore metaAnnotationStore = beanManager.getServices().get(MetaAnnotationStore.class); if (addTopLevelInterceptorBindings) { addInterceptorBindings(clazz, annotations, flattenInterceptorBindings, metaAnnotationStore); } if (addInheritedInterceptorBindings) { for (Annotation annotation : annotations) { addInheritedInterceptorBindings(clazz, annotation.annotationType(), metaAnnotationStore, flattenInterceptorBindings); } } return flattenInterceptorBindings; }
[ "public", "static", "Set", "<", "Annotation", ">", "flattenInterceptorBindings", "(", "EnhancedAnnotatedType", "<", "?", ">", "clazz", ",", "BeanManagerImpl", "beanManager", ",", "Collection", "<", "Annotation", ">", "annotations", ",", "boolean", "addTopLevelIntercep...
Extracts a flat set of interception bindings from a given set of interceptor bindings. @param addTopLevelInterceptorBindings add top level interceptor bindings to the result set. @param addInheritedInterceptorBindings add inherited level interceptor bindings to the result set. @return
[ "Extracts", "a", "flat", "set", "of", "interception", "bindings", "from", "a", "given", "set", "of", "interceptor", "bindings", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Interceptors.java#L71-L85
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
Validator.validateRIBean
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<?>) bean); } if ((bean instanceof AbstractClassBean<?>)) { AbstractClassBean<?> classBean = (AbstractClassBean<?>) bean; // validate CDI-defined interceptors if (classBean.hasInterceptors()) { validateInterceptors(beanManager, classBean); } } // for each producer bean validate its disposer method if (bean instanceof AbstractProducerBean<?, ?, ?>) { AbstractProducerBean<?, ?, ?> producerBean = Reflections.<AbstractProducerBean<?, ?, ?>> cast(bean); if (producerBean.getProducer() instanceof AbstractMemberProducer<?, ?>) { AbstractMemberProducer<?, ?> producer = Reflections.<AbstractMemberProducer<?, ?>> cast(producerBean .getProducer()); if (producer.getDisposalMethod() != null) { for (InjectionPoint ip : producer.getDisposalMethod().getInjectionPoints()) { // pass the producer bean instead of the disposal method bean validateInjectionPointForDefinitionErrors(ip, null, beanManager); validateMetadataInjectionPoint(ip, null, ValidatorLogger.INJECTION_INTO_DISPOSER_METHOD); validateEventMetadataInjectionPoint(ip); validateInjectionPointForDeploymentProblems(ip, null, beanManager); } } } } }
java
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<?>) bean); } if ((bean instanceof AbstractClassBean<?>)) { AbstractClassBean<?> classBean = (AbstractClassBean<?>) bean; // validate CDI-defined interceptors if (classBean.hasInterceptors()) { validateInterceptors(beanManager, classBean); } } // for each producer bean validate its disposer method if (bean instanceof AbstractProducerBean<?, ?, ?>) { AbstractProducerBean<?, ?, ?> producerBean = Reflections.<AbstractProducerBean<?, ?, ?>> cast(bean); if (producerBean.getProducer() instanceof AbstractMemberProducer<?, ?>) { AbstractMemberProducer<?, ?> producer = Reflections.<AbstractMemberProducer<?, ?>> cast(producerBean .getProducer()); if (producer.getDisposalMethod() != null) { for (InjectionPoint ip : producer.getDisposalMethod().getInjectionPoints()) { // pass the producer bean instead of the disposal method bean validateInjectionPointForDefinitionErrors(ip, null, beanManager); validateMetadataInjectionPoint(ip, null, ValidatorLogger.INJECTION_INTO_DISPOSER_METHOD); validateEventMetadataInjectionPoint(ip); validateInjectionPointForDeploymentProblems(ip, null, beanManager); } } } } }
[ "protected", "void", "validateRIBean", "(", "CommonBean", "<", "?", ">", "bean", ",", "BeanManagerImpl", "beanManager", ",", "Collection", "<", "CommonBean", "<", "?", ">", ">", "specializedBeans", ")", "{", "validateGeneralBean", "(", "bean", ",", "beanManager"...
Validate an RIBean. This includes validating whether two beans specialize the same bean @param bean the bean to validate @param beanManager the current manager @param specializedBeans the existing specialized beans
[ "Validate", "an", "RIBean", ".", "This", "includes", "validating", "whether", "two", "beans", "specialize", "the", "same", "bean" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java#L163-L195
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
Validator.validateInjectionPoint
public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager) { validateInjectionPointForDefinitionErrors(ij, ij.getBean(), beanManager); validateMetadataInjectionPoint(ij, ij.getBean(), ValidatorLogger.INJECTION_INTO_NON_BEAN); validateEventMetadataInjectionPoint(ij); validateInjectionPointForDeploymentProblems(ij, ij.getBean(), beanManager); }
java
public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager) { validateInjectionPointForDefinitionErrors(ij, ij.getBean(), beanManager); validateMetadataInjectionPoint(ij, ij.getBean(), ValidatorLogger.INJECTION_INTO_NON_BEAN); validateEventMetadataInjectionPoint(ij); validateInjectionPointForDeploymentProblems(ij, ij.getBean(), beanManager); }
[ "public", "void", "validateInjectionPoint", "(", "InjectionPoint", "ij", ",", "BeanManagerImpl", "beanManager", ")", "{", "validateInjectionPointForDefinitionErrors", "(", "ij", ",", "ij", ".", "getBean", "(", ")", ",", "beanManager", ")", ";", "validateMetadataInject...
Validate an injection point @param ij the injection point to validate @param beanManager the bean manager
[ "Validate", "an", "injection", "point" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java#L286-L291
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
Validator.validatePseudoScopedBean
private static void validatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager) { if (bean.getInjectionPoints().isEmpty()) { // Skip validation if there are no injection points (e.g. for classes which are not intended to be used as beans) return; } reallyValidatePseudoScopedBean(bean, beanManager, new LinkedHashSet<Object>(), new HashSet<Bean<?>>()); }
java
private static void validatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager) { if (bean.getInjectionPoints().isEmpty()) { // Skip validation if there are no injection points (e.g. for classes which are not intended to be used as beans) return; } reallyValidatePseudoScopedBean(bean, beanManager, new LinkedHashSet<Object>(), new HashSet<Bean<?>>()); }
[ "private", "static", "void", "validatePseudoScopedBean", "(", "Bean", "<", "?", ">", "bean", ",", "BeanManagerImpl", "beanManager", ")", "{", "if", "(", "bean", ".", "getInjectionPoints", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "// Skip validation if the...
Checks to make sure that pseudo scoped beans (i.e. @Dependent scoped beans) have no circular dependencies.
[ "Checks", "to", "make", "sure", "that", "pseudo", "scoped", "beans", "(", "i", ".", "e", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java#L923-L929
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
Validator.reallyValidatePseudoScopedBean
private static void reallyValidatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager, Set<Object> dependencyPath, Set<Bean<?>> validatedBeans) { // see if we have already seen this bean in the dependency path if (dependencyPath.contains(bean)) { // create a list that shows the path to the bean List<Object> realDependencyPath = new ArrayList<Object>(dependencyPath); realDependencyPath.add(bean); throw ValidatorLogger.LOG.pseudoScopedBeanHasCircularReferences(WeldCollections.toMultiRowString(realDependencyPath)); } if (validatedBeans.contains(bean)) { return; } dependencyPath.add(bean); for (InjectionPoint injectionPoint : bean.getInjectionPoints()) { if (!injectionPoint.isDelegate()) { dependencyPath.add(injectionPoint); validatePseudoScopedInjectionPoint(injectionPoint, beanManager, dependencyPath, validatedBeans); dependencyPath.remove(injectionPoint); } } if (bean instanceof DecorableBean<?>) { final List<Decorator<?>> decorators = Reflections.<DecorableBean<?>>cast(bean).getDecorators(); if (!decorators.isEmpty()) { for (final Decorator<?> decorator : decorators) { reallyValidatePseudoScopedBean(decorator, beanManager, dependencyPath, validatedBeans); } } } if (bean instanceof AbstractProducerBean<?, ?, ?> && !(bean instanceof EEResourceProducerField<?, ?>)) { AbstractProducerBean<?, ?, ?> producer = (AbstractProducerBean<?, ?, ?>) bean; if (!beanManager.isNormalScope(producer.getDeclaringBean().getScope()) && !producer.getAnnotated().isStatic()) { reallyValidatePseudoScopedBean(producer.getDeclaringBean(), beanManager, dependencyPath, validatedBeans); } } validatedBeans.add(bean); dependencyPath.remove(bean); }
java
private static void reallyValidatePseudoScopedBean(Bean<?> bean, BeanManagerImpl beanManager, Set<Object> dependencyPath, Set<Bean<?>> validatedBeans) { // see if we have already seen this bean in the dependency path if (dependencyPath.contains(bean)) { // create a list that shows the path to the bean List<Object> realDependencyPath = new ArrayList<Object>(dependencyPath); realDependencyPath.add(bean); throw ValidatorLogger.LOG.pseudoScopedBeanHasCircularReferences(WeldCollections.toMultiRowString(realDependencyPath)); } if (validatedBeans.contains(bean)) { return; } dependencyPath.add(bean); for (InjectionPoint injectionPoint : bean.getInjectionPoints()) { if (!injectionPoint.isDelegate()) { dependencyPath.add(injectionPoint); validatePseudoScopedInjectionPoint(injectionPoint, beanManager, dependencyPath, validatedBeans); dependencyPath.remove(injectionPoint); } } if (bean instanceof DecorableBean<?>) { final List<Decorator<?>> decorators = Reflections.<DecorableBean<?>>cast(bean).getDecorators(); if (!decorators.isEmpty()) { for (final Decorator<?> decorator : decorators) { reallyValidatePseudoScopedBean(decorator, beanManager, dependencyPath, validatedBeans); } } } if (bean instanceof AbstractProducerBean<?, ?, ?> && !(bean instanceof EEResourceProducerField<?, ?>)) { AbstractProducerBean<?, ?, ?> producer = (AbstractProducerBean<?, ?, ?>) bean; if (!beanManager.isNormalScope(producer.getDeclaringBean().getScope()) && !producer.getAnnotated().isStatic()) { reallyValidatePseudoScopedBean(producer.getDeclaringBean(), beanManager, dependencyPath, validatedBeans); } } validatedBeans.add(bean); dependencyPath.remove(bean); }
[ "private", "static", "void", "reallyValidatePseudoScopedBean", "(", "Bean", "<", "?", ">", "bean", ",", "BeanManagerImpl", "beanManager", ",", "Set", "<", "Object", ">", "dependencyPath", ",", "Set", "<", "Bean", "<", "?", ">", ">", "validatedBeans", ")", "{...
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
[ "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"...
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java#L936-L971
train
weld/core
impl/src/main/java/org/jboss/weld/interceptor/proxy/InterceptionContext.java
InterceptionContext.forConstructorInterception
public static InterceptionContext forConstructorInterception(InterceptionModel interceptionModel, CreationalContext<?> ctx, BeanManagerImpl manager, SlimAnnotatedType<?> type) { return of(interceptionModel, ctx, manager, null, type); }
java
public static InterceptionContext forConstructorInterception(InterceptionModel interceptionModel, CreationalContext<?> ctx, BeanManagerImpl manager, SlimAnnotatedType<?> type) { return of(interceptionModel, ctx, manager, null, type); }
[ "public", "static", "InterceptionContext", "forConstructorInterception", "(", "InterceptionModel", "interceptionModel", ",", "CreationalContext", "<", "?", ">", "ctx", ",", "BeanManagerImpl", "manager", ",", "SlimAnnotatedType", "<", "?", ">", "type", ")", "{", "retur...
The context returned by this method may be later reused for other interception types. @param interceptionModel @param ctx @param manager @param type @return the interception context to be used for the AroundConstruct chain
[ "The", "context", "returned", "by", "this", "method", "may", "be", "later", "reused", "for", "other", "interception", "types", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/interceptor/proxy/InterceptionContext.java#L68-L70
train
weld/core
impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java
DisposalMethod.getRequiredQualifiers
private Set<QualifierInstance> getRequiredQualifiers(EnhancedAnnotatedParameter<?, ? super X> enhancedDisposedParameter) { Set<Annotation> disposedParameterQualifiers = enhancedDisposedParameter.getMetaAnnotations(Qualifier.class); if (disposedParameterQualifiers.isEmpty()) { disposedParameterQualifiers = Collections.<Annotation> singleton(Default.Literal.INSTANCE); } return beanManager.getServices().get(MetaAnnotationStore.class).getQualifierInstances(disposedParameterQualifiers); }
java
private Set<QualifierInstance> getRequiredQualifiers(EnhancedAnnotatedParameter<?, ? super X> enhancedDisposedParameter) { Set<Annotation> disposedParameterQualifiers = enhancedDisposedParameter.getMetaAnnotations(Qualifier.class); if (disposedParameterQualifiers.isEmpty()) { disposedParameterQualifiers = Collections.<Annotation> singleton(Default.Literal.INSTANCE); } return beanManager.getServices().get(MetaAnnotationStore.class).getQualifierInstances(disposedParameterQualifiers); }
[ "private", "Set", "<", "QualifierInstance", ">", "getRequiredQualifiers", "(", "EnhancedAnnotatedParameter", "<", "?", ",", "?", "super", "X", ">", "enhancedDisposedParameter", ")", "{", "Set", "<", "Annotation", ">", "disposedParameterQualifiers", "=", "enhancedDispo...
A disposer method is bound to a producer if the producer is assignable to the disposed parameter. @param enhancedDisposedParameter @return the set of required qualifiers for the given disposed parameter
[ "A", "disposer", "method", "is", "bound", "to", "a", "producer", "if", "the", "producer", "is", "assignable", "to", "the", "disposed", "parameter", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java#L169-L175
train
weld/core
impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java
Reflections.getActualTypeArguments
public static Type[] getActualTypeArguments(Class<?> clazz) { Type type = Types.getCanonicalType(clazz); if (type instanceof ParameterizedType) { return ((ParameterizedType) type).getActualTypeArguments(); } else { return EMPTY_TYPES; } }
java
public static Type[] getActualTypeArguments(Class<?> clazz) { Type type = Types.getCanonicalType(clazz); if (type instanceof ParameterizedType) { return ((ParameterizedType) type).getActualTypeArguments(); } else { return EMPTY_TYPES; } }
[ "public", "static", "Type", "[", "]", "getActualTypeArguments", "(", "Class", "<", "?", ">", "clazz", ")", "{", "Type", "type", "=", "Types", ".", "getCanonicalType", "(", "clazz", ")", ";", "if", "(", "type", "instanceof", "ParameterizedType", ")", "{", ...
Gets the actual type arguments of a class @param clazz The class to examine @return The type arguments
[ "Gets", "the", "actual", "type", "arguments", "of", "a", "class" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java#L229-L236
train
weld/core
impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java
Reflections.getActualTypeArguments
public static Type[] getActualTypeArguments(Type type) { Type resolvedType = Types.getCanonicalType(type); if (resolvedType instanceof ParameterizedType) { return ((ParameterizedType) resolvedType).getActualTypeArguments(); } else { return EMPTY_TYPES; } }
java
public static Type[] getActualTypeArguments(Type type) { Type resolvedType = Types.getCanonicalType(type); if (resolvedType instanceof ParameterizedType) { return ((ParameterizedType) resolvedType).getActualTypeArguments(); } else { return EMPTY_TYPES; } }
[ "public", "static", "Type", "[", "]", "getActualTypeArguments", "(", "Type", "type", ")", "{", "Type", "resolvedType", "=", "Types", ".", "getCanonicalType", "(", "type", ")", ";", "if", "(", "resolvedType", "instanceof", "ParameterizedType", ")", "{", "return...
Gets the actual type arguments of a Type @param type The type to examine @return The type arguments
[ "Gets", "the", "actual", "type", "arguments", "of", "a", "Type" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java#L244-L251
train
weld/core
impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java
Reflections.loadClass
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; } }
java
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; } }
[ "public", "static", "<", "T", ">", "Class", "<", "T", ">", "loadClass", "(", "String", "className", ",", "ResourceLoader", "resourceLoader", ")", "{", "try", "{", "return", "cast", "(", "resourceLoader", ".", "classForName", "(", "className", ")", ")", ";"...
Tries to load a class using the specified ResourceLoader. Returns null if the class is not found. @param className @param resourceLoader @return the loaded class or null if the given class cannot be loaded
[ "Tries", "to", "load", "a", "class", "using", "the", "specified", "ResourceLoader", ".", "Returns", "null", "if", "the", "class", "is", "not", "found", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java#L343-L351
train
weld/core
impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java
Reflections.findDeclaredMethodByName
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; }
java
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; }
[ "public", "static", "Method", "findDeclaredMethodByName", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ")", "{", "for", "(", "Method", "method", ":", "AccessController", ".", "doPrivileged", "(", "new", "GetDeclaredMethodsAction", "(", "cla...
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. @param clazz the given class @param methodName the given method name @return method method with the given name declared by the given class or null if no such method exists
[ "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", "....
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java#L440-L447
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/StartMain.java
StartMain.main
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); } }
java
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); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "try", "{", "new", "StartMain", "(", "args", ")", ".", "go", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "WeldSELogger", ".", "LOG", ".", "error", "(...
The main method called from the command line. @param args the command line arguments
[ "The", "main", "method", "called", "from", "the", "command", "line", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/StartMain.java#L55-L62
train
weld/core
impl/src/main/java/org/jboss/weld/contexts/CreationalContextImpl.java
CreationalContextImpl.release
public void release(Contextual<T> contextual, T instance) { synchronized (dependentInstances) { for (ContextualInstance<?> dependentInstance : dependentInstances) { // do not destroy contextual again, since it's just being destroyed if (contextual == null || !(dependentInstance.getContextual().equals(contextual))) { destroy(dependentInstance); } } } if (resourceReferences != null) { for (ResourceReference<?> reference : resourceReferences) { reference.release(); } } }
java
public void release(Contextual<T> contextual, T instance) { synchronized (dependentInstances) { for (ContextualInstance<?> dependentInstance : dependentInstances) { // do not destroy contextual again, since it's just being destroyed if (contextual == null || !(dependentInstance.getContextual().equals(contextual))) { destroy(dependentInstance); } } } if (resourceReferences != null) { for (ResourceReference<?> reference : resourceReferences) { reference.release(); } } }
[ "public", "void", "release", "(", "Contextual", "<", "T", ">", "contextual", ",", "T", "instance", ")", "{", "synchronized", "(", "dependentInstances", ")", "{", "for", "(", "ContextualInstance", "<", "?", ">", "dependentInstance", ":", "dependentInstances", "...
should not be public
[ "should", "not", "be", "public" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/CreationalContextImpl.java#L126-L140
train
weld/core
impl/src/main/java/org/jboss/weld/contexts/CreationalContextImpl.java
CreationalContextImpl.destroyDependentInstance
public boolean destroyDependentInstance(T instance) { synchronized (dependentInstances) { for (Iterator<ContextualInstance<?>> iterator = dependentInstances.iterator(); iterator.hasNext();) { ContextualInstance<?> contextualInstance = iterator.next(); if (contextualInstance.getInstance() == instance) { iterator.remove(); destroy(contextualInstance); return true; } } } return false; }
java
public boolean destroyDependentInstance(T instance) { synchronized (dependentInstances) { for (Iterator<ContextualInstance<?>> iterator = dependentInstances.iterator(); iterator.hasNext();) { ContextualInstance<?> contextualInstance = iterator.next(); if (contextualInstance.getInstance() == instance) { iterator.remove(); destroy(contextualInstance); return true; } } } return false; }
[ "public", "boolean", "destroyDependentInstance", "(", "T", "instance", ")", "{", "synchronized", "(", "dependentInstances", ")", "{", "for", "(", "Iterator", "<", "ContextualInstance", "<", "?", ">", ">", "iterator", "=", "dependentInstances", ".", "iterator", "...
Destroys dependent instance @param instance @return true if the instance was destroyed, false otherwise
[ "Destroys", "dependent", "instance" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/CreationalContextImpl.java#L212-L224
train
weld/core
impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
AbstractProducerBean.checkReturnValue
protected T checkReturnValue(T instance) { if (instance == null && !isDependent()) { throw BeanLogger.LOG.nullNotAllowedFromProducer(getProducer(), Formats.formatAsStackTraceElement(getAnnotated().getJavaMember())); } if (instance == null) { InjectionPoint injectionPoint = beanManager.getServices().get(CurrentInjectionPoint.class).peek(); if (injectionPoint != null) { Class<?> injectionPointRawType = Reflections.getRawType(injectionPoint.getType()); if (injectionPointRawType.isPrimitive()) { return cast(Defaults.getJlsDefaultValue(injectionPointRawType)); } } } if (instance != null && !(instance instanceof Serializable)) { if (beanManager.isPassivatingScope(getScope())) { throw BeanLogger.LOG.nonSerializableProductError(getProducer(), Formats.formatAsStackTraceElement(getAnnotated().getJavaMember())); } InjectionPoint injectionPoint = beanManager.getServices().get(CurrentInjectionPoint.class).peek(); if (injectionPoint != null && injectionPoint.getBean() != null && Beans.isPassivatingScope(injectionPoint.getBean(), beanManager)) { // Transient field is passivation capable injection point if (!(injectionPoint.getMember() instanceof Field) || !injectionPoint.isTransient()) { throw BeanLogger.LOG.unserializableProductInjectionError(this, Formats.formatAsStackTraceElement(getAnnotated().getJavaMember()), injectionPoint, Formats.formatAsStackTraceElement(injectionPoint.getMember())); } } } return instance; }
java
protected T checkReturnValue(T instance) { if (instance == null && !isDependent()) { throw BeanLogger.LOG.nullNotAllowedFromProducer(getProducer(), Formats.formatAsStackTraceElement(getAnnotated().getJavaMember())); } if (instance == null) { InjectionPoint injectionPoint = beanManager.getServices().get(CurrentInjectionPoint.class).peek(); if (injectionPoint != null) { Class<?> injectionPointRawType = Reflections.getRawType(injectionPoint.getType()); if (injectionPointRawType.isPrimitive()) { return cast(Defaults.getJlsDefaultValue(injectionPointRawType)); } } } if (instance != null && !(instance instanceof Serializable)) { if (beanManager.isPassivatingScope(getScope())) { throw BeanLogger.LOG.nonSerializableProductError(getProducer(), Formats.formatAsStackTraceElement(getAnnotated().getJavaMember())); } InjectionPoint injectionPoint = beanManager.getServices().get(CurrentInjectionPoint.class).peek(); if (injectionPoint != null && injectionPoint.getBean() != null && Beans.isPassivatingScope(injectionPoint.getBean(), beanManager)) { // Transient field is passivation capable injection point if (!(injectionPoint.getMember() instanceof Field) || !injectionPoint.isTransient()) { throw BeanLogger.LOG.unserializableProductInjectionError(this, Formats.formatAsStackTraceElement(getAnnotated().getJavaMember()), injectionPoint, Formats.formatAsStackTraceElement(injectionPoint.getMember())); } } } return instance; }
[ "protected", "T", "checkReturnValue", "(", "T", "instance", ")", "{", "if", "(", "instance", "==", "null", "&&", "!", "isDependent", "(", ")", ")", "{", "throw", "BeanLogger", ".", "LOG", ".", "nullNotAllowedFromProducer", "(", "getProducer", "(", ")", ","...
Validates the return value @param instance The instance to validate
[ "Validates", "the", "return", "value" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java#L134-L161
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/ImmutableMap.java
ImmutableMap.copyOf
public static <K, V> Map<K, V> copyOf(Map<K, V> map) { Preconditions.checkNotNull(map); return ImmutableMap.<K, V> builder().putAll(map).build(); }
java
public static <K, V> Map<K, V> copyOf(Map<K, V> map) { Preconditions.checkNotNull(map); return ImmutableMap.<K, V> builder().putAll(map).build(); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "copyOf", "(", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "Preconditions", ".", "checkNotNull", "(", "map", ")", ";", "return", "ImmutableMap", ".", "<", "K", ",...
Creates an immutable map. A copy of the given map is used. As a result, it is safe to modify the source map afterwards. @param map the given map @return an immutable map
[ "Creates", "an", "immutable", "map", ".", "A", "copy", "of", "the", "given", "map", "is", "used", ".", "As", "a", "result", "it", "is", "safe", "to", "modify", "the", "source", "map", "afterwards", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/ImmutableMap.java#L48-L51
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/ImmutableMap.java
ImmutableMap.of
public static <K, V> Map<K, V> of(K key, V value) { return new ImmutableMapEntry<K, V>(key, value); }
java
public static <K, V> Map<K, V> of(K key, V value) { return new ImmutableMapEntry<K, V>(key, value); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "of", "(", "K", "key", ",", "V", "value", ")", "{", "return", "new", "ImmutableMapEntry", "<", "K", ",", "V", ">", "(", "key", ",", "value", ")", ";", "}" ]
Creates an immutable singleton instance. @param key @param value @return
[ "Creates", "an", "immutable", "singleton", "instance", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/ImmutableMap.java#L60-L62
train
weld/core
impl/src/main/java/org/jboss/weld/util/reflection/Formats.java
Formats.formatAsStackTraceElement
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() instanceof AnnotatedParameter<?>) { AnnotatedParameter<?> annotatedParameter = (AnnotatedParameter<?>) ij.getAnnotated(); member = annotatedParameter.getDeclaringCallable().getJavaMember(); } else { // Not throwing an exception, because this method is invoked when an exception is already being thrown. // Throwing an exception here would hide the original exception. return "-"; } return formatAsStackTraceElement(member); }
java
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() instanceof AnnotatedParameter<?>) { AnnotatedParameter<?> annotatedParameter = (AnnotatedParameter<?>) ij.getAnnotated(); member = annotatedParameter.getDeclaringCallable().getJavaMember(); } else { // Not throwing an exception, because this method is invoked when an exception is already being thrown. // Throwing an exception here would hide the original exception. return "-"; } return formatAsStackTraceElement(member); }
[ "public", "static", "String", "formatAsStackTraceElement", "(", "InjectionPoint", "ij", ")", "{", "Member", "member", ";", "if", "(", "ij", ".", "getAnnotated", "(", ")", "instanceof", "AnnotatedField", ")", "{", "AnnotatedField", "<", "?", ">", "annotatedField"...
See also WELD-1454. @param ij @return the formatted string
[ "See", "also", "WELD", "-", "1454", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/reflection/Formats.java#L93-L107
train
weld/core
impl/src/main/java/org/jboss/weld/util/reflection/Formats.java
Formats.getLineNumber
public static int getLineNumber(Member member) { if (!(member instanceof Method || member instanceof Constructor)) { // We are not able to get this info for fields return 0; } // BCEL is an optional dependency, if we cannot load it, simply return 0 if (!Reflections.isClassLoadable(BCEL_CLASS, WeldClassLoaderResourceLoader.INSTANCE)) { return 0; } String classFile = member.getDeclaringClass().getName().replace('.', '/'); ClassLoaderResourceLoader classFileResourceLoader = new ClassLoaderResourceLoader(member.getDeclaringClass().getClassLoader()); InputStream in = null; try { URL classFileUrl = classFileResourceLoader.getResource(classFile + ".class"); if (classFileUrl == null) { // The class file is not available return 0; } in = classFileUrl.openStream(); ClassParser cp = new ClassParser(in, classFile); JavaClass javaClass = cp.parse(); // First get all declared methods and constructors // Note that in bytecode constructor is translated into a method org.apache.bcel.classfile.Method[] methods = javaClass.getMethods(); org.apache.bcel.classfile.Method match = null; String signature; String name; if (member instanceof Method) { signature = DescriptorUtils.methodDescriptor((Method) member); name = member.getName(); } else if (member instanceof Constructor) { signature = DescriptorUtils.makeDescriptor((Constructor<?>) member); name = INIT_METHOD_NAME; } else { return 0; } for (org.apache.bcel.classfile.Method method : methods) { // Matching method must have the same name, modifiers and signature if (method.getName().equals(name) && member.getModifiers() == method.getModifiers() && method.getSignature().equals(signature)) { match = method; } } if (match != null) { // If a method is found, try to obtain the optional LineNumberTable attribute LineNumberTable lineNumberTable = match.getLineNumberTable(); if (lineNumberTable != null) { int line = lineNumberTable.getSourceLine(0); return line == -1 ? 0 : line; } } // No suitable method found return 0; } catch (Throwable t) { return 0; } finally { if (in != null) { try { in.close(); } catch (Exception e) { return 0; } } } }
java
public static int getLineNumber(Member member) { if (!(member instanceof Method || member instanceof Constructor)) { // We are not able to get this info for fields return 0; } // BCEL is an optional dependency, if we cannot load it, simply return 0 if (!Reflections.isClassLoadable(BCEL_CLASS, WeldClassLoaderResourceLoader.INSTANCE)) { return 0; } String classFile = member.getDeclaringClass().getName().replace('.', '/'); ClassLoaderResourceLoader classFileResourceLoader = new ClassLoaderResourceLoader(member.getDeclaringClass().getClassLoader()); InputStream in = null; try { URL classFileUrl = classFileResourceLoader.getResource(classFile + ".class"); if (classFileUrl == null) { // The class file is not available return 0; } in = classFileUrl.openStream(); ClassParser cp = new ClassParser(in, classFile); JavaClass javaClass = cp.parse(); // First get all declared methods and constructors // Note that in bytecode constructor is translated into a method org.apache.bcel.classfile.Method[] methods = javaClass.getMethods(); org.apache.bcel.classfile.Method match = null; String signature; String name; if (member instanceof Method) { signature = DescriptorUtils.methodDescriptor((Method) member); name = member.getName(); } else if (member instanceof Constructor) { signature = DescriptorUtils.makeDescriptor((Constructor<?>) member); name = INIT_METHOD_NAME; } else { return 0; } for (org.apache.bcel.classfile.Method method : methods) { // Matching method must have the same name, modifiers and signature if (method.getName().equals(name) && member.getModifiers() == method.getModifiers() && method.getSignature().equals(signature)) { match = method; } } if (match != null) { // If a method is found, try to obtain the optional LineNumberTable attribute LineNumberTable lineNumberTable = match.getLineNumberTable(); if (lineNumberTable != null) { int line = lineNumberTable.getSourceLine(0); return line == -1 ? 0 : line; } } // No suitable method found return 0; } catch (Throwable t) { return 0; } finally { if (in != null) { try { in.close(); } catch (Exception e) { return 0; } } } }
[ "public", "static", "int", "getLineNumber", "(", "Member", "member", ")", "{", "if", "(", "!", "(", "member", "instanceof", "Method", "||", "member", "instanceof", "Constructor", ")", ")", "{", "// We are not able to get this info for fields", "return", "0", ";", ...
Try to get the line number associated with the given member. The reflection API does not expose such an info and so we need to analyse the bytecode. Unfortunately, it seems there is no way to get this kind of information for fields. Moreover, the <code>LineNumberTable</code> attribute is just optional, i.e. the compiler is not required to store this information at all. See also <a href="http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.1">Java Virtual Machine Specification</a> Implementation note: it wouldn't be appropriate to add a bytecode scanning dependency just for this functionality, therefore Apache BCEL included in Oracle JDK 1.5+ and OpenJDK 1.6+ is used. Other JVMs should not crash as we only use it if it's on the classpath and by means of reflection calls. @param member @param resourceLoader @return the line number or 0 if it's not possible to find it
[ "Try", "to", "get", "the", "line", "number", "associated", "with", "the", "given", "member", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/reflection/Formats.java#L129-L204
train
weld/core
impl/src/main/java/org/jboss/weld/util/reflection/Formats.java
Formats.parseModifiers
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)) { result.add("public"); } if (Modifier.isAbstract(modifiers)) { result.add("abstract"); } if (Modifier.isFinal(modifiers)) { result.add("final"); } if (Modifier.isNative(modifiers)) { result.add("native"); } if (Modifier.isStatic(modifiers)) { result.add("static"); } if (Modifier.isStrict(modifiers)) { result.add("strict"); } if (Modifier.isSynchronized(modifiers)) { result.add("synchronized"); } if (Modifier.isTransient(modifiers)) { result.add("transient"); } if (Modifier.isVolatile(modifiers)) { result.add("volatile"); } if (Modifier.isInterface(modifiers)) { result.add("interface"); } return result; }
java
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)) { result.add("public"); } if (Modifier.isAbstract(modifiers)) { result.add("abstract"); } if (Modifier.isFinal(modifiers)) { result.add("final"); } if (Modifier.isNative(modifiers)) { result.add("native"); } if (Modifier.isStatic(modifiers)) { result.add("static"); } if (Modifier.isStrict(modifiers)) { result.add("strict"); } if (Modifier.isSynchronized(modifiers)) { result.add("synchronized"); } if (Modifier.isTransient(modifiers)) { result.add("transient"); } if (Modifier.isVolatile(modifiers)) { result.add("volatile"); } if (Modifier.isInterface(modifiers)) { result.add("interface"); } return result; }
[ "private", "static", "List", "<", "String", ">", "parseModifiers", "(", "int", "modifiers", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "Modifier", ".", "isPrivate", "(", "modif...
Parses a reflection modifier to a list of string @param modifiers The modifier to parse @return The resulting string list
[ "Parses", "a", "reflection", "modifier", "to", "a", "list", "of", "string" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/reflection/Formats.java#L406-L445
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/FastAnnotatedTypeLoader.java
FastAnnotatedTypeLoader.initCheckTypeModifiers
private boolean initCheckTypeModifiers() { Class<?> classInfoclass = Reflections.loadClass(CLASSINFO_CLASS_NAME, new ClassLoaderResourceLoader(classFileServices.getClass().getClassLoader())); if (classInfoclass != null) { try { Method setFlags = AccessController.doPrivileged(GetDeclaredMethodAction.of(classInfoclass, "setFlags", short.class)); return setFlags != null; } catch (Exception exceptionIgnored) { BootstrapLogger.LOG.usingOldJandexVersion(); return false; } } else { return true; } }
java
private boolean initCheckTypeModifiers() { Class<?> classInfoclass = Reflections.loadClass(CLASSINFO_CLASS_NAME, new ClassLoaderResourceLoader(classFileServices.getClass().getClassLoader())); if (classInfoclass != null) { try { Method setFlags = AccessController.doPrivileged(GetDeclaredMethodAction.of(classInfoclass, "setFlags", short.class)); return setFlags != null; } catch (Exception exceptionIgnored) { BootstrapLogger.LOG.usingOldJandexVersion(); return false; } } else { return true; } }
[ "private", "boolean", "initCheckTypeModifiers", "(", ")", "{", "Class", "<", "?", ">", "classInfoclass", "=", "Reflections", ".", "loadClass", "(", "CLASSINFO_CLASS_NAME", ",", "new", "ClassLoaderResourceLoader", "(", "classFileServices", ".", "getClass", "(", ")", ...
checking availability of ClassInfo.setFlags method is just workaround for JANDEX-37
[ "checking", "availability", "of", "ClassInfo", ".", "setFlags", "method", "is", "just", "workaround", "for", "JANDEX", "-", "37" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/FastAnnotatedTypeLoader.java#L132-L146
train
weld/core
impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java
ProducerMethod.of
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>(createId(attributes, method, declaringBean), attributes, method, declaringBean, disposalMethod, beanManager, services); }
java
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>(createId(attributes, method, declaringBean), attributes, method, declaringBean, disposalMethod, beanManager, services); }
[ "public", "static", "<", "X", ",", "T", ">", "ProducerMethod", "<", "X", ",", "T", ">", "of", "(", "BeanAttributes", "<", "T", ">", "attributes", ",", "EnhancedAnnotatedMethod", "<", "T", ",", "?", "super", "X", ">", "method", ",", "AbstractClassBean", ...
Creates a producer method Web Bean @param method The underlying method abstraction @param declaringBean The declaring bean abstraction @param beanManager the current manager @return A producer Web Bean
[ "Creates", "a", "producer", "method", "Web", "Bean" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java#L59-L61
train
weld/core
impl/src/main/java/org/jboss/weld/util/bytecode/BytecodeUtils.java
BytecodeUtils.addLoadInstruction
public static void addLoadInstruction(CodeAttribute code, String type, int variable) { char tp = type.charAt(0); if (tp != 'L' && tp != '[') { // we have a primitive type switch (tp) { case 'J': code.lload(variable); break; case 'D': code.dload(variable); break; case 'F': code.fload(variable); break; default: code.iload(variable); } } else { code.aload(variable); } }
java
public static void addLoadInstruction(CodeAttribute code, String type, int variable) { char tp = type.charAt(0); if (tp != 'L' && tp != '[') { // we have a primitive type switch (tp) { case 'J': code.lload(variable); break; case 'D': code.dload(variable); break; case 'F': code.fload(variable); break; default: code.iload(variable); } } else { code.aload(variable); } }
[ "public", "static", "void", "addLoadInstruction", "(", "CodeAttribute", "code", ",", "String", "type", ",", "int", "variable", ")", "{", "char", "tp", "=", "type", ".", "charAt", "(", "0", ")", ";", "if", "(", "tp", "!=", "'", "'", "&&", "tp", "!=", ...
Adds the correct load instruction based on the type descriptor @param code the bytecode to add the instruction to @param type the type of the variable @param variable the variable number
[ "Adds", "the", "correct", "load", "instruction", "based", "on", "the", "type", "descriptor" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/bytecode/BytecodeUtils.java#L54-L74
train
weld/core
impl/src/main/java/org/jboss/weld/util/bytecode/BytecodeUtils.java
BytecodeUtils.pushClassType
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.charAt(0); switch (type) { case 'I': b.getstatic(Integer.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'J': b.getstatic(Long.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'S': b.getstatic(Short.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'F': b.getstatic(Float.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'D': b.getstatic(Double.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'B': b.getstatic(Byte.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'C': b.getstatic(Character.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'Z': b.getstatic(Boolean.class.getName(), TYPE, LJAVA_LANG_CLASS); break; default: throw new RuntimeException("Cannot handle primitive type: " + type); } } }
java
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.charAt(0); switch (type) { case 'I': b.getstatic(Integer.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'J': b.getstatic(Long.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'S': b.getstatic(Short.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'F': b.getstatic(Float.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'D': b.getstatic(Double.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'B': b.getstatic(Byte.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'C': b.getstatic(Character.class.getName(), TYPE, LJAVA_LANG_CLASS); break; case 'Z': b.getstatic(Boolean.class.getName(), TYPE, LJAVA_LANG_CLASS); break; default: throw new RuntimeException("Cannot handle primitive type: " + type); } } }
[ "public", "static", "void", "pushClassType", "(", "CodeAttribute", "b", ",", "String", "classType", ")", "{", "if", "(", "classType", ".", "length", "(", ")", "!=", "1", ")", "{", "if", "(", "classType", ".", "startsWith", "(", "\"L\"", ")", "&&", "cla...
Pushes a class type onto the stack from the string representation This can also handle primitives @param b the bytecode @param classType the type descriptor for the class or primitive to push. This will accept both the java.lang.Object form and the Ljava/lang/Object; form
[ "Pushes", "a", "class", "type", "onto", "the", "stack", "from", "the", "string", "representation", "This", "can", "also", "handle", "primitives" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/bytecode/BytecodeUtils.java#L85-L122
train
weld/core
impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java
StereotypeModel.checkBindings
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)) { throw MetadataLogger.LOG.qualifierOnStereotype(annotatedAnnotation); } } } }
java
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)) { throw MetadataLogger.LOG.qualifierOnStereotype(annotatedAnnotation); } } } }
[ "private", "void", "checkBindings", "(", "EnhancedAnnotation", "<", "T", ">", "annotatedAnnotation", ")", "{", "Set", "<", "Annotation", ">", "bindings", "=", "annotatedAnnotation", ".", "getMetaAnnotations", "(", "Qualifier", ".", "class", ")", ";", "if", "(", ...
Validates the binding types
[ "Validates", "the", "binding", "types" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java#L89-L98
train
weld/core
impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java
StereotypeModel.initBeanNameDefaulted
private void initBeanNameDefaulted(EnhancedAnnotation<T> annotatedAnnotation) { if (annotatedAnnotation.isAnnotationPresent(Named.class)) { if (!"".equals(annotatedAnnotation.getAnnotation(Named.class).value())) { throw MetadataLogger.LOG.valueOnNamedStereotype(annotatedAnnotation); } beanNameDefaulted = true; } }
java
private void initBeanNameDefaulted(EnhancedAnnotation<T> annotatedAnnotation) { if (annotatedAnnotation.isAnnotationPresent(Named.class)) { if (!"".equals(annotatedAnnotation.getAnnotation(Named.class).value())) { throw MetadataLogger.LOG.valueOnNamedStereotype(annotatedAnnotation); } beanNameDefaulted = true; } }
[ "private", "void", "initBeanNameDefaulted", "(", "EnhancedAnnotation", "<", "T", ">", "annotatedAnnotation", ")", "{", "if", "(", "annotatedAnnotation", ".", "isAnnotationPresent", "(", "Named", ".", "class", ")", ")", "{", "if", "(", "!", "\"\"", ".", "equals...
Initializes the bean name defaulted
[ "Initializes", "the", "bean", "name", "defaulted" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java#L114-L121
train
weld/core
impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java
StereotypeModel.initDefaultScopeType
private void initDefaultScopeType(EnhancedAnnotation<T> annotatedAnnotation) { Set<Annotation> scopeTypes = new HashSet<Annotation>(); scopeTypes.addAll(annotatedAnnotation.getMetaAnnotations(Scope.class)); scopeTypes.addAll(annotatedAnnotation.getMetaAnnotations(NormalScope.class)); if (scopeTypes.size() > 1) { throw MetadataLogger.LOG.multipleScopes(annotatedAnnotation); } else if (scopeTypes.size() == 1) { this.defaultScopeType = scopeTypes.iterator().next(); } }
java
private void initDefaultScopeType(EnhancedAnnotation<T> annotatedAnnotation) { Set<Annotation> scopeTypes = new HashSet<Annotation>(); scopeTypes.addAll(annotatedAnnotation.getMetaAnnotations(Scope.class)); scopeTypes.addAll(annotatedAnnotation.getMetaAnnotations(NormalScope.class)); if (scopeTypes.size() > 1) { throw MetadataLogger.LOG.multipleScopes(annotatedAnnotation); } else if (scopeTypes.size() == 1) { this.defaultScopeType = scopeTypes.iterator().next(); } }
[ "private", "void", "initDefaultScopeType", "(", "EnhancedAnnotation", "<", "T", ">", "annotatedAnnotation", ")", "{", "Set", "<", "Annotation", ">", "scopeTypes", "=", "new", "HashSet", "<", "Annotation", ">", "(", ")", ";", "scopeTypes", ".", "addAll", "(", ...
Initializes the default scope type
[ "Initializes", "the", "default", "scope", "type" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/cache/StereotypeModel.java#L126-L135
train
weld/core
impl/src/main/java/org/jboss/weld/util/Types.java
Types.boxedType
public static Type boxedType(Type type) { if (type instanceof Class<?>) { return boxedClass((Class<?>) type); } else { return type; } }
java
public static Type boxedType(Type type) { if (type instanceof Class<?>) { return boxedClass((Class<?>) type); } else { return type; } }
[ "public", "static", "Type", "boxedType", "(", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "Class", "<", "?", ">", ")", "{", "return", "boxedClass", "(", "(", "Class", "<", "?", ">", ")", "type", ")", ";", "}", "else", "{", "return", ...
Gets the boxed type of a class @param type The type @return The boxed type
[ "Gets", "the", "boxed", "type", "of", "a", "class" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Types.java#L54-L60
train
weld/core
impl/src/main/java/org/jboss/weld/util/Types.java
Types.getCanonicalType
public static Type getCanonicalType(Class<?> clazz) { if (clazz.isArray()) { Class<?> componentType = clazz.getComponentType(); Type resolvedComponentType = getCanonicalType(componentType); if (componentType != resolvedComponentType) { // identity check intentional // a different identity means that we actually replaced the component Class with a ParameterizedType return new GenericArrayTypeImpl(resolvedComponentType); } } if (clazz.getTypeParameters().length > 0) { Type[] actualTypeParameters = clazz.getTypeParameters(); return new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass()); } return clazz; }
java
public static Type getCanonicalType(Class<?> clazz) { if (clazz.isArray()) { Class<?> componentType = clazz.getComponentType(); Type resolvedComponentType = getCanonicalType(componentType); if (componentType != resolvedComponentType) { // identity check intentional // a different identity means that we actually replaced the component Class with a ParameterizedType return new GenericArrayTypeImpl(resolvedComponentType); } } if (clazz.getTypeParameters().length > 0) { Type[] actualTypeParameters = clazz.getTypeParameters(); return new ParameterizedTypeImpl(clazz, actualTypeParameters, clazz.getDeclaringClass()); } return clazz; }
[ "public", "static", "Type", "getCanonicalType", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "isArray", "(", ")", ")", "{", "Class", "<", "?", ">", "componentType", "=", "clazz", ".", "getComponentType", "(", ")", ";", "Ty...
Returns a canonical type for a given class. If the class is a raw type of a parameterized class, the matching {@link ParameterizedType} (with unresolved type variables) is resolved. If the class is an array then the component type of the array is canonicalized Otherwise, the class is returned. @return
[ "Returns", "a", "canonical", "type", "for", "a", "given", "class", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Types.java#L127-L142
train
weld/core
impl/src/main/java/org/jboss/weld/util/Types.java
Types.isArray
public static boolean isArray(Type type) { return (type instanceof GenericArrayType) || (type instanceof Class<?> && ((Class<?>) type).isArray()); }
java
public static boolean isArray(Type type) { return (type instanceof GenericArrayType) || (type instanceof Class<?> && ((Class<?>) type).isArray()); }
[ "public", "static", "boolean", "isArray", "(", "Type", "type", ")", "{", "return", "(", "type", "instanceof", "GenericArrayType", ")", "||", "(", "type", "instanceof", "Class", "<", "?", ">", "&&", "(", "(", "Class", "<", "?", ">", ")", "type", ")", ...
Determines whether the given type is an array type. @param type the given type @return true if the given type is a subclass of java.lang.Class or implements GenericArrayType
[ "Determines", "whether", "the", "given", "type", "is", "an", "array", "type", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Types.java#L221-L223
train
weld/core
impl/src/main/java/org/jboss/weld/util/Types.java
Types.getArrayComponentType
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.getComponentType(); } } throw new IllegalArgumentException("Not an array type " + type); }
java
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.getComponentType(); } } throw new IllegalArgumentException("Not an array type " + type); }
[ "public", "static", "Type", "getArrayComponentType", "(", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "GenericArrayType", ")", "{", "return", "GenericArrayType", ".", "class", ".", "cast", "(", "type", ")", ".", "getGenericComponentType", "(", "...
Determines the component type for a given array type. @param type the given array type @return the component type of a given array type
[ "Determines", "the", "component", "type", "for", "a", "given", "array", "type", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Types.java#L231-L242
train
weld/core
impl/src/main/java/org/jboss/weld/util/Types.java
Types.isArrayOfUnboundedTypeVariablesOrObjects
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 == 0 || (bounds.length == 1 && Object.class.equals(bounds[0]))) { continue; } } return false; } return true; }
java
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 == 0 || (bounds.length == 1 && Object.class.equals(bounds[0]))) { continue; } } return false; } return true; }
[ "public", "static", "boolean", "isArrayOfUnboundedTypeVariablesOrObjects", "(", "Type", "[", "]", "types", ")", "{", "for", "(", "Type", "type", ":", "types", ")", "{", "if", "(", "Object", ".", "class", ".", "equals", "(", "type", ")", ")", "{", "contin...
Determines whether the given array only contains unbounded type variables or Object.class. @param types the given array of types @return true if and only if the given array only contains unbounded type variables or Object.class
[ "Determines", "whether", "the", "given", "array", "only", "contains", "unbounded", "type", "variables", "or", "Object", ".", "class", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Types.java#L250-L264
train
weld/core
impl/src/main/java/org/jboss/weld/contexts/unbound/DependentContextImpl.java
DependentContextImpl.get
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<?>) { addDependentInstance(instance, contextual, (WeldCreationalContext<T>) creationalContext); } return instance; } else { return null; } }
java
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<?>) { addDependentInstance(instance, contextual, (WeldCreationalContext<T>) creationalContext); } return instance; } else { return null; } }
[ "public", "<", "T", ">", "T", "get", "(", "Contextual", "<", "T", ">", "contextual", ",", "CreationalContext", "<", "T", ">", "creationalContext", ")", "{", "if", "(", "!", "isActive", "(", ")", ")", "{", "throw", "new", "ContextNotActiveException", "(",...
Overridden method always creating a new instance @param contextual The bean to create @param creationalContext The creation context
[ "Overridden", "method", "always", "creating", "a", "new", "instance" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/unbound/DependentContextImpl.java#L65-L78
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
BeanDeployment.createEnablement
public void createEnablement() { GlobalEnablementBuilder builder = beanManager.getServices().get(GlobalEnablementBuilder.class); ModuleEnablement enablement = builder.createModuleEnablement(this); beanManager.setEnabled(enablement); if (BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.enabledAlternatives(this.beanManager, WeldCollections.toMultiRowString(enablement.getAllAlternatives())); BootstrapLogger.LOG.enabledDecorators(this.beanManager, WeldCollections.toMultiRowString(enablement.getDecorators())); BootstrapLogger.LOG.enabledInterceptors(this.beanManager, WeldCollections.toMultiRowString(enablement.getInterceptors())); } }
java
public void createEnablement() { GlobalEnablementBuilder builder = beanManager.getServices().get(GlobalEnablementBuilder.class); ModuleEnablement enablement = builder.createModuleEnablement(this); beanManager.setEnabled(enablement); if (BootstrapLogger.LOG.isDebugEnabled()) { BootstrapLogger.LOG.enabledAlternatives(this.beanManager, WeldCollections.toMultiRowString(enablement.getAllAlternatives())); BootstrapLogger.LOG.enabledDecorators(this.beanManager, WeldCollections.toMultiRowString(enablement.getDecorators())); BootstrapLogger.LOG.enabledInterceptors(this.beanManager, WeldCollections.toMultiRowString(enablement.getInterceptors())); } }
[ "public", "void", "createEnablement", "(", ")", "{", "GlobalEnablementBuilder", "builder", "=", "beanManager", ".", "getServices", "(", ")", ".", "get", "(", "GlobalEnablementBuilder", ".", "class", ")", ";", "ModuleEnablement", "enablement", "=", "builder", ".", ...
Initializes module enablement. @see ModuleEnablement
[ "Initializes", "module", "enablement", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java#L206-L216
train
weld/core
impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java
DecoratorImpl.of
public static <T> DecoratorImpl<T> of(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> clazz, BeanManagerImpl beanManager) { return new DecoratorImpl<T>(attributes, clazz, beanManager); }
java
public static <T> DecoratorImpl<T> of(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> clazz, BeanManagerImpl beanManager) { return new DecoratorImpl<T>(attributes, clazz, beanManager); }
[ "public", "static", "<", "T", ">", "DecoratorImpl", "<", "T", ">", "of", "(", "BeanAttributes", "<", "T", ">", "attributes", ",", "EnhancedAnnotatedType", "<", "T", ">", "clazz", ",", "BeanManagerImpl", "beanManager", ")", "{", "return", "new", "DecoratorImp...
Creates a decorator bean @param <T> The type @param clazz The class @param beanManager the current manager @return a Bean
[ "Creates", "a", "decorator", "bean" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java#L49-L51
train
weld/core
impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java
MergedStereotypes.merge
protected void merge(Set<Annotation> stereotypeAnnotations) { final MetaAnnotationStore store = manager.getServices().get(MetaAnnotationStore.class); for (Annotation stereotypeAnnotation : stereotypeAnnotations) { // Retrieve and merge all metadata from stereotypes StereotypeModel<?> stereotype = store.getStereotype(stereotypeAnnotation.annotationType()); if (stereotype == null) { throw MetadataLogger.LOG.stereotypeNotRegistered(stereotypeAnnotation); } if (stereotype.isAlternative()) { alternative = true; } if (stereotype.getDefaultScopeType() != null) { possibleScopeTypes.add(stereotype.getDefaultScopeType()); } if (stereotype.isBeanNameDefaulted()) { beanNameDefaulted = true; } this.stereotypes.add(stereotypeAnnotation.annotationType()); // Merge in inherited stereotypes merge(stereotype.getInheritedStereotypes()); } }
java
protected void merge(Set<Annotation> stereotypeAnnotations) { final MetaAnnotationStore store = manager.getServices().get(MetaAnnotationStore.class); for (Annotation stereotypeAnnotation : stereotypeAnnotations) { // Retrieve and merge all metadata from stereotypes StereotypeModel<?> stereotype = store.getStereotype(stereotypeAnnotation.annotationType()); if (stereotype == null) { throw MetadataLogger.LOG.stereotypeNotRegistered(stereotypeAnnotation); } if (stereotype.isAlternative()) { alternative = true; } if (stereotype.getDefaultScopeType() != null) { possibleScopeTypes.add(stereotype.getDefaultScopeType()); } if (stereotype.isBeanNameDefaulted()) { beanNameDefaulted = true; } this.stereotypes.add(stereotypeAnnotation.annotationType()); // Merge in inherited stereotypes merge(stereotype.getInheritedStereotypes()); } }
[ "protected", "void", "merge", "(", "Set", "<", "Annotation", ">", "stereotypeAnnotations", ")", "{", "final", "MetaAnnotationStore", "store", "=", "manager", ".", "getServices", "(", ")", ".", "get", "(", "MetaAnnotationStore", ".", "class", ")", ";", "for", ...
Perform the merge @param stereotypeAnnotations The stereotype annotations
[ "Perform", "the", "merge" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/cache/MergedStereotypes.java#L73-L94
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/threading/RunnableDecorator.java
RunnableDecorator.run
@Override public void run() { try { threadContext.activate(); // run the original thread runnable.run(); } finally { threadContext.invalidate(); threadContext.deactivate(); } }
java
@Override public void run() { try { threadContext.activate(); // run the original thread runnable.run(); } finally { threadContext.invalidate(); threadContext.deactivate(); } }
[ "@", "Override", "public", "void", "run", "(", ")", "{", "try", "{", "threadContext", ".", "activate", "(", ")", ";", "// run the original thread", "runnable", ".", "run", "(", ")", ";", "}", "finally", "{", "threadContext", ".", "invalidate", "(", ")", ...
Set up the ThreadContext and delegate.
[ "Set", "up", "the", "ThreadContext", "and", "delegate", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/threading/RunnableDecorator.java#L52-L63
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
AbstractBeanDeployer.deploySpecialized
protected AbstractBeanDeployer<E> deploySpecialized() { // ensure that all decorators are initialized before initializing // the rest of the beans for (DecoratorImpl<?> bean : getEnvironment().getDecorators()) { bean.initialize(getEnvironment()); containerLifecycleEvents.fireProcessBean(getManager(), bean); manager.addDecorator(bean); BootstrapLogger.LOG.foundDecorator(bean); } for (InterceptorImpl<?> bean : getEnvironment().getInterceptors()) { bean.initialize(getEnvironment()); containerLifecycleEvents.fireProcessBean(getManager(), bean); manager.addInterceptor(bean); BootstrapLogger.LOG.foundInterceptor(bean); } return this; }
java
protected AbstractBeanDeployer<E> deploySpecialized() { // ensure that all decorators are initialized before initializing // the rest of the beans for (DecoratorImpl<?> bean : getEnvironment().getDecorators()) { bean.initialize(getEnvironment()); containerLifecycleEvents.fireProcessBean(getManager(), bean); manager.addDecorator(bean); BootstrapLogger.LOG.foundDecorator(bean); } for (InterceptorImpl<?> bean : getEnvironment().getInterceptors()) { bean.initialize(getEnvironment()); containerLifecycleEvents.fireProcessBean(getManager(), bean); manager.addInterceptor(bean); BootstrapLogger.LOG.foundInterceptor(bean); } return this; }
[ "protected", "AbstractBeanDeployer", "<", "E", ">", "deploySpecialized", "(", ")", "{", "// ensure that all decorators are initialized before initializing", "// the rest of the beans", "for", "(", "DecoratorImpl", "<", "?", ">", "bean", ":", "getEnvironment", "(", ")", "....
interceptors, decorators and observers go first
[ "interceptors", "decorators", "and", "observers", "go", "first" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java#L100-L116
train
weld/core
impl/src/main/java/org/jboss/weld/util/Observers.java
Observers.validateObserverMethod
public static void validateObserverMethod(ObserverMethod<?> observerMethod, BeanManager beanManager, ObserverMethod<?> originalObserverMethod) { Set<Annotation> qualifiers = observerMethod.getObservedQualifiers(); if (observerMethod.getBeanClass() == null) { throw EventLogger.LOG.observerMethodsMethodReturnsNull("getBeanClass", observerMethod); } if (observerMethod.getObservedType() == null) { throw EventLogger.LOG.observerMethodsMethodReturnsNull("getObservedType", observerMethod); } Bindings.validateQualifiers(qualifiers, beanManager, observerMethod, "ObserverMethod.getObservedQualifiers"); if (observerMethod.getReception() == null) { throw EventLogger.LOG.observerMethodsMethodReturnsNull("getReception", observerMethod); } if (observerMethod.getTransactionPhase() == null) { throw EventLogger.LOG.observerMethodsMethodReturnsNull("getTransactionPhase", observerMethod); } if (originalObserverMethod != null && (!observerMethod.getBeanClass().equals(originalObserverMethod.getBeanClass()))) { throw EventLogger.LOG.beanClassMismatch(originalObserverMethod, observerMethod); } if (!(observerMethod instanceof SyntheticObserverMethod) && !hasNotifyOverriden(observerMethod.getClass(), observerMethod)) { throw EventLogger.LOG.notifyMethodNotImplemented(observerMethod); } }
java
public static void validateObserverMethod(ObserverMethod<?> observerMethod, BeanManager beanManager, ObserverMethod<?> originalObserverMethod) { Set<Annotation> qualifiers = observerMethod.getObservedQualifiers(); if (observerMethod.getBeanClass() == null) { throw EventLogger.LOG.observerMethodsMethodReturnsNull("getBeanClass", observerMethod); } if (observerMethod.getObservedType() == null) { throw EventLogger.LOG.observerMethodsMethodReturnsNull("getObservedType", observerMethod); } Bindings.validateQualifiers(qualifiers, beanManager, observerMethod, "ObserverMethod.getObservedQualifiers"); if (observerMethod.getReception() == null) { throw EventLogger.LOG.observerMethodsMethodReturnsNull("getReception", observerMethod); } if (observerMethod.getTransactionPhase() == null) { throw EventLogger.LOG.observerMethodsMethodReturnsNull("getTransactionPhase", observerMethod); } if (originalObserverMethod != null && (!observerMethod.getBeanClass().equals(originalObserverMethod.getBeanClass()))) { throw EventLogger.LOG.beanClassMismatch(originalObserverMethod, observerMethod); } if (!(observerMethod instanceof SyntheticObserverMethod) && !hasNotifyOverriden(observerMethod.getClass(), observerMethod)) { throw EventLogger.LOG.notifyMethodNotImplemented(observerMethod); } }
[ "public", "static", "void", "validateObserverMethod", "(", "ObserverMethod", "<", "?", ">", "observerMethod", ",", "BeanManager", "beanManager", ",", "ObserverMethod", "<", "?", ">", "originalObserverMethod", ")", "{", "Set", "<", "Annotation", ">", "qualifiers", ...
Validates given external observer method. @param observerMethod the given observer method @param beanManager @param originalObserverMethod observer method replaced by given observer method (this parameter is optional)
[ "Validates", "given", "external", "observer", "method", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Observers.java#L124-L145
train
weld/core
impl/src/main/java/org/jboss/weld/resolution/CovariantTypes.java
CovariantTypes.isAssignableFrom
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; }
java
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; }
[ "private", "static", "boolean", "isAssignableFrom", "(", "WildcardType", "type1", ",", "Type", "type2", ")", "{", "if", "(", "!", "isAssignableFrom", "(", "type1", ".", "getUpperBounds", "(", ")", "[", "0", "]", ",", "type2", ")", ")", "{", "return", "fa...
This logic is shared for all actual types i.e. raw types, parameterized types and generic array types.
[ "This", "logic", "is", "shared", "for", "all", "actual", "types", "i", ".", "e", ".", "raw", "types", "parameterized", "types", "and", "generic", "array", "types", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/CovariantTypes.java#L295-L303
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/InterceptionDecorationContext.java
InterceptionDecorationContext.peekIfNotEmpty
public static CombinedInterceptorAndDecoratorStackMethodHandler peekIfNotEmpty() { Stack stack = interceptionContexts.get(); if (stack == null) { return null; } return stack.peek(); }
java
public static CombinedInterceptorAndDecoratorStackMethodHandler peekIfNotEmpty() { Stack stack = interceptionContexts.get(); if (stack == null) { return null; } return stack.peek(); }
[ "public", "static", "CombinedInterceptorAndDecoratorStackMethodHandler", "peekIfNotEmpty", "(", ")", "{", "Stack", "stack", "=", "interceptionContexts", ".", "get", "(", ")", ";", "if", "(", "stack", "==", "null", ")", "{", "return", "null", ";", "}", "return", ...
Peeks the current top of the stack or returns null if the stack is empty @return the current top of the stack or returns null if the stack is empty
[ "Peeks", "the", "current", "top", "of", "the", "stack", "or", "returns", "null", "if", "the", "stack", "is", "empty" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/InterceptionDecorationContext.java#L151-L157
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/InterceptionDecorationContext.java
InterceptionDecorationContext.getStack
public static Stack getStack() { Stack stack = interceptionContexts.get(); if (stack == null) { stack = new Stack(interceptionContexts); interceptionContexts.set(stack); } return stack; }
java
public static Stack getStack() { Stack stack = interceptionContexts.get(); if (stack == null) { stack = new Stack(interceptionContexts); interceptionContexts.set(stack); } return stack; }
[ "public", "static", "Stack", "getStack", "(", ")", "{", "Stack", "stack", "=", "interceptionContexts", ".", "get", "(", ")", ";", "if", "(", "stack", "==", "null", ")", "{", "stack", "=", "new", "Stack", "(", "interceptionContexts", ")", ";", "intercepti...
Gets the current Stack. If the stack is not set, a new empty instance is created and set. @return
[ "Gets", "the", "current", "Stack", ".", "If", "the", "stack", "is", "not", "set", "a", "new", "empty", "instance", "is", "created", "and", "set", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/InterceptionDecorationContext.java#L210-L217
train
weld/core
impl/src/main/java/org/jboss/weld/util/Proxies.java
Proxies.isTypesProxyable
public static boolean isTypesProxyable(Iterable<? extends Type> types, ServiceRegistry services) { return getUnproxyableTypesException(types, services) == null; }
java
public static boolean isTypesProxyable(Iterable<? extends Type> types, ServiceRegistry services) { return getUnproxyableTypesException(types, services) == null; }
[ "public", "static", "boolean", "isTypesProxyable", "(", "Iterable", "<", "?", "extends", "Type", ">", "types", ",", "ServiceRegistry", "services", ")", "{", "return", "getUnproxyableTypesException", "(", "types", ",", "services", ")", "==", "null", ";", "}" ]
Indicates if a set of types are all proxyable @param types The types to test @return True if proxyable, false otherwise
[ "Indicates", "if", "a", "set", "of", "types", "are", "all", "proxyable" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Proxies.java#L160-L162
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/Iterators.java
Iterators.addAll
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; }
java
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; }
[ "public", "static", "<", "T", ">", "boolean", "addAll", "(", "Collection", "<", "T", ">", "target", ",", "Iterator", "<", "?", "extends", "T", ">", "iterator", ")", "{", "Preconditions", ".", "checkArgumentNotNull", "(", "target", ",", "\"target\"", ")", ...
Add all elements in the iterator to the collection. @param target @param iterator @return true if the target was modified, false otherwise
[ "Add", "all", "elements", "in", "the", "iterator", "to", "the", "collection", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/Iterators.java#L46-L53
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/Iterators.java
Iterators.concat
public static <T> Iterator<T> concat(Iterator<? extends Iterator<? extends T>> iterators) { Preconditions.checkArgumentNotNull(iterators, "iterators"); return new CombinedIterator<T>(iterators); }
java
public static <T> Iterator<T> concat(Iterator<? extends Iterator<? extends T>> iterators) { Preconditions.checkArgumentNotNull(iterators, "iterators"); return new CombinedIterator<T>(iterators); }
[ "public", "static", "<", "T", ">", "Iterator", "<", "T", ">", "concat", "(", "Iterator", "<", "?", "extends", "Iterator", "<", "?", "extends", "T", ">", ">", "iterators", ")", "{", "Preconditions", ".", "checkArgumentNotNull", "(", "iterators", ",", "\"i...
Combine the iterators into a single one. @param iterators An iterator of iterators @return a single combined iterator
[ "Combine", "the", "iterators", "into", "a", "single", "one", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/Iterators.java#L61-L64
train
weld/core
probe/core/src/main/java/org/jboss/weld/probe/HtmlTag.java
HtmlTag.attr
HtmlTag attr(String name, String value) { if (attrs == null) { attrs = new HashMap<>(); } attrs.put(name, value); return this; }
java
HtmlTag attr(String name, String value) { if (attrs == null) { attrs = new HashMap<>(); } attrs.put(name, value); return this; }
[ "HtmlTag", "attr", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "attrs", "==", "null", ")", "{", "attrs", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "attrs", ".", "put", "(", "name", ",", "value", ")", ";", "return", ...
Attribute name and value are not escaped or modified in any way. @param name @param value @return self
[ "Attribute", "name", "and", "value", "are", "not", "escaped", "or", "modified", "in", "any", "way", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/probe/core/src/main/java/org/jboss/weld/probe/HtmlTag.java#L173-L179
train
weld/core
impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java
MetaAnnotationStore.clearAnnotationData
public void clearAnnotationData(Class<? extends Annotation> annotationClass) { stereotypes.invalidate(annotationClass); scopes.invalidate(annotationClass); qualifiers.invalidate(annotationClass); interceptorBindings.invalidate(annotationClass); }
java
public void clearAnnotationData(Class<? extends Annotation> annotationClass) { stereotypes.invalidate(annotationClass); scopes.invalidate(annotationClass); qualifiers.invalidate(annotationClass); interceptorBindings.invalidate(annotationClass); }
[ "public", "void", "clearAnnotationData", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ")", "{", "stereotypes", ".", "invalidate", "(", "annotationClass", ")", ";", "scopes", ".", "invalidate", "(", "annotationClass", ")", ";", "qualif...
removes all data for an annotation class. This should be called after an annotation has been modified through the SPI
[ "removes", "all", "data", "for", "an", "annotation", "class", ".", "This", "should", "be", "called", "after", "an", "annotation", "has", "been", "modified", "through", "the", "SPI" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java#L153-L158
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/WeldCollections.java
WeldCollections.immutableMapView
public static <K, V> Map<K, V> immutableMapView(Map<K, V> map) { if (map instanceof ImmutableMap<?, ?>) { return map; } return Collections.unmodifiableMap(map); }
java
public static <K, V> Map<K, V> immutableMapView(Map<K, V> map) { if (map instanceof ImmutableMap<?, ?>) { return map; } return Collections.unmodifiableMap(map); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "immutableMapView", "(", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "if", "(", "map", "instanceof", "ImmutableMap", "<", "?", ",", "?", ">", ")", "{", "return", ...
Returns an immutable view of a given map.
[ "Returns", "an", "immutable", "view", "of", "a", "given", "map", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/WeldCollections.java#L67-L72
train
weld/core
impl/src/main/java/org/jboss/weld/injection/producer/ProducerMethodProducer.java
ProducerMethodProducer.checkProducerMethod
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(method.getJavaMember())); } else if (method.getEnhancedParameters(ObservesAsync.class).size() > 0) { throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, "@ObservesAsync", this.method, Formats.formatAsStackTraceElement(method.getJavaMember())); } else if (method.getEnhancedParameters(Disposes.class).size() > 0) { throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, "@Disposes", this.method, Formats.formatAsStackTraceElement(method.getJavaMember())); } else if (getDeclaringBean() instanceof SessionBean<?> && !Modifier.isStatic(method.slim().getJavaMember().getModifiers())) { boolean methodDeclaredOnTypes = false; for (Type type : getDeclaringBean().getTypes()) { Class<?> clazz = Reflections.getRawType(type); try { AccessController.doPrivileged(new GetMethodAction(clazz, method.getName(), method.getParameterTypesAsArray())); methodDeclaredOnTypes = true; break; } catch (PrivilegedActionException ignored) { } } if (!methodDeclaredOnTypes) { throw BeanLogger.LOG.methodNotBusinessMethod("Producer", this, getDeclaringBean(), Formats.formatAsStackTraceElement(method.getJavaMember())); } } }
java
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(method.getJavaMember())); } else if (method.getEnhancedParameters(ObservesAsync.class).size() > 0) { throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, "@ObservesAsync", this.method, Formats.formatAsStackTraceElement(method.getJavaMember())); } else if (method.getEnhancedParameters(Disposes.class).size() > 0) { throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, "@Disposes", this.method, Formats.formatAsStackTraceElement(method.getJavaMember())); } else if (getDeclaringBean() instanceof SessionBean<?> && !Modifier.isStatic(method.slim().getJavaMember().getModifiers())) { boolean methodDeclaredOnTypes = false; for (Type type : getDeclaringBean().getTypes()) { Class<?> clazz = Reflections.getRawType(type); try { AccessController.doPrivileged(new GetMethodAction(clazz, method.getName(), method.getParameterTypesAsArray())); methodDeclaredOnTypes = true; break; } catch (PrivilegedActionException ignored) { } } if (!methodDeclaredOnTypes) { throw BeanLogger.LOG.methodNotBusinessMethod("Producer", this, getDeclaringBean(), Formats.formatAsStackTraceElement(method.getJavaMember())); } } }
[ "protected", "void", "checkProducerMethod", "(", "EnhancedAnnotatedMethod", "<", "T", ",", "?", "super", "X", ">", "method", ")", "{", "if", "(", "method", ".", "getEnhancedParameters", "(", "Observes", ".", "class", ")", ".", "size", "(", ")", ">", "0", ...
Validates the producer method
[ "Validates", "the", "producer", "method" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/injection/producer/ProducerMethodProducer.java#L69-L94
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProtectionDomainCache.java
ProtectionDomainCache.getProtectionDomainForProxy
ProtectionDomain getProtectionDomainForProxy(ProtectionDomain domain) { if (domain.getCodeSource() == null) { // no codesource to cache on return create(domain); } ProtectionDomain proxyProtectionDomain = proxyProtectionDomains.get(domain.getCodeSource()); if (proxyProtectionDomain == null) { // as this is not atomic create() may be called multiple times for the same domain // we ignore that proxyProtectionDomain = create(domain); ProtectionDomain existing = proxyProtectionDomains.putIfAbsent(domain.getCodeSource(), proxyProtectionDomain); if (existing != null) { proxyProtectionDomain = existing; } } return proxyProtectionDomain; }
java
ProtectionDomain getProtectionDomainForProxy(ProtectionDomain domain) { if (domain.getCodeSource() == null) { // no codesource to cache on return create(domain); } ProtectionDomain proxyProtectionDomain = proxyProtectionDomains.get(domain.getCodeSource()); if (proxyProtectionDomain == null) { // as this is not atomic create() may be called multiple times for the same domain // we ignore that proxyProtectionDomain = create(domain); ProtectionDomain existing = proxyProtectionDomains.putIfAbsent(domain.getCodeSource(), proxyProtectionDomain); if (existing != null) { proxyProtectionDomain = existing; } } return proxyProtectionDomain; }
[ "ProtectionDomain", "getProtectionDomainForProxy", "(", "ProtectionDomain", "domain", ")", "{", "if", "(", "domain", ".", "getCodeSource", "(", ")", "==", "null", ")", "{", "// no codesource to cache on", "return", "create", "(", "domain", ")", ";", "}", "Protecti...
Gets an enhanced protection domain for a proxy based on the given protection domain. @param domain the given protection domain @return protection domain enhanced with "accessDeclaredMembers" runtime permission
[ "Gets", "an", "enhanced", "protection", "domain", "for", "a", "proxy", "based", "on", "the", "given", "protection", "domain", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProtectionDomainCache.java#L54-L70
train
weld/core
impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/EnhancedAnnotationImpl.java
EnhancedAnnotationImpl.create
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 Annotation>, Annotation>(); annotationMap.putAll(buildAnnotationMap(annotatedType.getAnnotations())); annotationMap.putAll(buildAnnotationMap(classTransformer.getTypeStore().get(annotationType))); // Annotations and declared annotations are the same for annotation type return new EnhancedAnnotationImpl<A>(annotatedType, annotationMap, annotationMap, classTransformer); }
java
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 Annotation>, Annotation>(); annotationMap.putAll(buildAnnotationMap(annotatedType.getAnnotations())); annotationMap.putAll(buildAnnotationMap(classTransformer.getTypeStore().get(annotationType))); // Annotations and declared annotations are the same for annotation type return new EnhancedAnnotationImpl<A>(annotatedType, annotationMap, annotationMap, classTransformer); }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "EnhancedAnnotation", "<", "A", ">", "create", "(", "SlimAnnotatedType", "<", "A", ">", "annotatedType", ",", "ClassTransformer", "classTransformer", ")", "{", "Class", "<", "A", ">", "annotationType", ...
we can't call this method 'of', cause it won't compile on JDK7
[ "we", "can", "t", "call", "this", "method", "of", "cause", "it", "won", "t", "compile", "on", "JDK7" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/EnhancedAnnotationImpl.java#L53-L62
train
weld/core
impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java
AnnotationModel.init
protected void init(EnhancedAnnotation<T> annotatedAnnotation) { initType(annotatedAnnotation); initValid(annotatedAnnotation); check(annotatedAnnotation); }
java
protected void init(EnhancedAnnotation<T> annotatedAnnotation) { initType(annotatedAnnotation); initValid(annotatedAnnotation); check(annotatedAnnotation); }
[ "protected", "void", "init", "(", "EnhancedAnnotation", "<", "T", ">", "annotatedAnnotation", ")", "{", "initType", "(", "annotatedAnnotation", ")", ";", "initValid", "(", "annotatedAnnotation", ")", ";", "check", "(", "annotatedAnnotation", ")", ";", "}" ]
Initializes the type and validates it
[ "Initializes", "the", "type", "and", "validates", "it" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java#L55-L59
train
weld/core
impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java
AnnotationModel.initValid
protected void initValid(EnhancedAnnotation<T> annotatedAnnotation) { this.valid = false; for (Class<? extends Annotation> annotationType : getMetaAnnotationTypes()) { if (annotatedAnnotation.isAnnotationPresent(annotationType)) { this.valid = true; } } }
java
protected void initValid(EnhancedAnnotation<T> annotatedAnnotation) { this.valid = false; for (Class<? extends Annotation> annotationType : getMetaAnnotationTypes()) { if (annotatedAnnotation.isAnnotationPresent(annotationType)) { this.valid = true; } } }
[ "protected", "void", "initValid", "(", "EnhancedAnnotation", "<", "T", ">", "annotatedAnnotation", ")", "{", "this", ".", "valid", "=", "false", ";", "for", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ":", "getMetaAnnotationTypes", ...
Validates the data for correct annotation
[ "Validates", "the", "data", "for", "correct", "annotation" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/metadata/cache/AnnotationModel.java#L73-L80
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/WeldStartup.java
WeldStartup.installFastProcessAnnotatedTypeResolver
private void installFastProcessAnnotatedTypeResolver(ServiceRegistry services) { ClassFileServices classFileServices = services.get(ClassFileServices.class); if (classFileServices != null) { final GlobalObserverNotifierService observers = services.get(GlobalObserverNotifierService.class); try { final FastProcessAnnotatedTypeResolver resolver = new FastProcessAnnotatedTypeResolver(observers.getAllObserverMethods()); services.add(FastProcessAnnotatedTypeResolver.class, resolver); } catch (UnsupportedObserverMethodException e) { BootstrapLogger.LOG.notUsingFastResolver(e.getObserver()); return; } } }
java
private void installFastProcessAnnotatedTypeResolver(ServiceRegistry services) { ClassFileServices classFileServices = services.get(ClassFileServices.class); if (classFileServices != null) { final GlobalObserverNotifierService observers = services.get(GlobalObserverNotifierService.class); try { final FastProcessAnnotatedTypeResolver resolver = new FastProcessAnnotatedTypeResolver(observers.getAllObserverMethods()); services.add(FastProcessAnnotatedTypeResolver.class, resolver); } catch (UnsupportedObserverMethodException e) { BootstrapLogger.LOG.notUsingFastResolver(e.getObserver()); return; } } }
[ "private", "void", "installFastProcessAnnotatedTypeResolver", "(", "ServiceRegistry", "services", ")", "{", "ClassFileServices", "classFileServices", "=", "services", ".", "get", "(", "ClassFileServices", ".", "class", ")", ";", "if", "(", "classFileServices", "!=", "...
needs to be resolved once extension beans are deployed
[ "needs", "to", "be", "resolved", "once", "extension", "beans", "are", "deployed" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/WeldStartup.java#L369-L381
train
weld/core
examples/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
History.load
public String load() { this.paginator = new Paginator(); this.codes = null; // Perform a search this.codes = codeFragmentManager.searchCodeFragments(this.codeFragmentPrototype, this.page, this.paginator); return "history"; }
java
public String load() { this.paginator = new Paginator(); this.codes = null; // Perform a search this.codes = codeFragmentManager.searchCodeFragments(this.codeFragmentPrototype, this.page, this.paginator); return "history"; }
[ "public", "String", "load", "(", ")", "{", "this", ".", "paginator", "=", "new", "Paginator", "(", ")", ";", "this", ".", "codes", "=", "null", ";", "// Perform a search", "this", ".", "codes", "=", "codeFragmentManager", ".", "searchCodeFragments", "(", "...
Do the search, called as a "page action"
[ "Do", "the", "search", "called", "as", "a", "page", "action" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/examples/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java#L70-L78
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/EjbDescriptors.java
EjbDescriptors.get
public <T> InternalEjbDescriptor<T> get(String beanName) { return cast(ejbByName.get(beanName)); }
java
public <T> InternalEjbDescriptor<T> get(String beanName) { return cast(ejbByName.get(beanName)); }
[ "public", "<", "T", ">", "InternalEjbDescriptor", "<", "T", ">", "get", "(", "String", "beanName", ")", "{", "return", "cast", "(", "ejbByName", ".", "get", "(", "beanName", ")", ")", ";", "}" ]
Gets an iterator to the EJB descriptors for an EJB implementation class @param beanClass The EJB class @return An iterator
[ "Gets", "an", "iterator", "to", "the", "EJB", "descriptors", "for", "an", "EJB", "implementation", "class" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/EjbDescriptors.java#L57-L59
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/EjbDescriptors.java
EjbDescriptors.add
private <T> void add(EjbDescriptor<T> ejbDescriptor) { InternalEjbDescriptor<T> internalEjbDescriptor = InternalEjbDescriptor.of(ejbDescriptor); ejbByName.put(ejbDescriptor.getEjbName(), internalEjbDescriptor); ejbByClass.put(ejbDescriptor.getBeanClass(), internalEjbDescriptor.getEjbName()); }
java
private <T> void add(EjbDescriptor<T> ejbDescriptor) { InternalEjbDescriptor<T> internalEjbDescriptor = InternalEjbDescriptor.of(ejbDescriptor); ejbByName.put(ejbDescriptor.getEjbName(), internalEjbDescriptor); ejbByClass.put(ejbDescriptor.getBeanClass(), internalEjbDescriptor.getEjbName()); }
[ "private", "<", "T", ">", "void", "add", "(", "EjbDescriptor", "<", "T", ">", "ejbDescriptor", ")", "{", "InternalEjbDescriptor", "<", "T", ">", "internalEjbDescriptor", "=", "InternalEjbDescriptor", ".", "of", "(", "ejbDescriptor", ")", ";", "ejbByName", ".",...
Adds an EJB descriptor to the maps @param ejbDescriptor The EJB descriptor to add
[ "Adds", "an", "EJB", "descriptor", "to", "the", "maps" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/EjbDescriptors.java#L66-L70
train
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/WeldRuntime.java
WeldRuntime.fireEventForNonWebModules
private void fireEventForNonWebModules(Type eventType, Object event, Annotation... qualifiers) { try { BeanDeploymentModules modules = deploymentManager.getServices().get(BeanDeploymentModules.class); if (modules != null) { // fire event for non-web modules // web modules are handled by HttpContextLifecycle for (BeanDeploymentModule module : modules) { if (!module.isWebModule()) { module.fireEvent(eventType, event, qualifiers); } } } } catch (Exception ignored) { } }
java
private void fireEventForNonWebModules(Type eventType, Object event, Annotation... qualifiers) { try { BeanDeploymentModules modules = deploymentManager.getServices().get(BeanDeploymentModules.class); if (modules != null) { // fire event for non-web modules // web modules are handled by HttpContextLifecycle for (BeanDeploymentModule module : modules) { if (!module.isWebModule()) { module.fireEvent(eventType, event, qualifiers); } } } } catch (Exception ignored) { } }
[ "private", "void", "fireEventForNonWebModules", "(", "Type", "eventType", ",", "Object", "event", ",", "Annotation", "...", "qualifiers", ")", "{", "try", "{", "BeanDeploymentModules", "modules", "=", "deploymentManager", ".", "getServices", "(", ")", ".", "get", ...
Fires given event for non-web modules. Used for @BeforeDestroyed and @Destroyed events.
[ "Fires", "given", "event", "for", "non", "-", "web", "modules", ".", "Used", "for" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/WeldRuntime.java#L81-L95
train
weld/core
impl/src/main/java/org/jboss/weld/Container.java
Container.initialize
public static void initialize(BeanManagerImpl deploymentManager, ServiceRegistry deploymentServices) { Container instance = new Container(RegistrySingletonProvider.STATIC_INSTANCE, deploymentManager, deploymentServices); Container.instance.set(RegistrySingletonProvider.STATIC_INSTANCE, instance); }
java
public static void initialize(BeanManagerImpl deploymentManager, ServiceRegistry deploymentServices) { Container instance = new Container(RegistrySingletonProvider.STATIC_INSTANCE, deploymentManager, deploymentServices); Container.instance.set(RegistrySingletonProvider.STATIC_INSTANCE, instance); }
[ "public", "static", "void", "initialize", "(", "BeanManagerImpl", "deploymentManager", ",", "ServiceRegistry", "deploymentServices", ")", "{", "Container", "instance", "=", "new", "Container", "(", "RegistrySingletonProvider", ".", "STATIC_INSTANCE", ",", "deploymentManag...
Initialize the container for the current application deployment @param deploymentManager @param deploymentServices
[ "Initialize", "the", "container", "for", "the", "current", "application", "deployment" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/Container.java#L90-L93
train
weld/core
impl/src/main/java/org/jboss/weld/Container.java
Container.cleanup
public void cleanup() { managers.clear(); for (BeanManagerImpl beanManager : beanDeploymentArchives.values()) { beanManager.cleanup(); } beanDeploymentArchives.clear(); deploymentServices.cleanup(); deploymentManager.cleanup(); instance.clear(contextId); }
java
public void cleanup() { managers.clear(); for (BeanManagerImpl beanManager : beanDeploymentArchives.values()) { beanManager.cleanup(); } beanDeploymentArchives.clear(); deploymentServices.cleanup(); deploymentManager.cleanup(); instance.clear(contextId); }
[ "public", "void", "cleanup", "(", ")", "{", "managers", ".", "clear", "(", ")", ";", "for", "(", "BeanManagerImpl", "beanManager", ":", "beanDeploymentArchives", ".", "values", "(", ")", ")", "{", "beanManager", ".", "cleanup", "(", ")", ";", "}", "beanD...
Cause the container to be cleaned up, including all registered bean managers, and all deployment services
[ "Cause", "the", "container", "to", "be", "cleaned", "up", "including", "all", "registered", "bean", "managers", "and", "all", "deployment", "services" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/Container.java#L141-L150
train
weld/core
impl/src/main/java/org/jboss/weld/Container.java
Container.putBeanDeployments
public void putBeanDeployments(BeanDeploymentArchiveMapping bdaMapping) { for (Entry<BeanDeploymentArchive, BeanManagerImpl> entry : bdaMapping.getBdaToBeanManagerMap().entrySet()) { beanDeploymentArchives.put(entry.getKey(), entry.getValue()); addBeanManager(entry.getValue()); } }
java
public void putBeanDeployments(BeanDeploymentArchiveMapping bdaMapping) { for (Entry<BeanDeploymentArchive, BeanManagerImpl> entry : bdaMapping.getBdaToBeanManagerMap().entrySet()) { beanDeploymentArchives.put(entry.getKey(), entry.getValue()); addBeanManager(entry.getValue()); } }
[ "public", "void", "putBeanDeployments", "(", "BeanDeploymentArchiveMapping", "bdaMapping", ")", "{", "for", "(", "Entry", "<", "BeanDeploymentArchive", ",", "BeanManagerImpl", ">", "entry", ":", "bdaMapping", ".", "getBdaToBeanManagerMap", "(", ")", ".", "entrySet", ...
Add sub-deployment units to the container @param bdaMapping
[ "Add", "sub", "-", "deployment", "units", "to", "the", "container" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/Container.java#L204-L209
train
weld/core
impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
ObserverMethodImpl.checkObserverMethod
private <Y> void checkObserverMethod(EnhancedAnnotatedMethod<T, Y> annotated) { // Make sure exactly one and only one parameter is annotated with Observes or ObservesAsync List<EnhancedAnnotatedParameter<?, Y>> eventObjects = annotated.getEnhancedParameters(Observes.class); eventObjects.addAll(annotated.getEnhancedParameters(ObservesAsync.class)); if (this.reception.equals(Reception.IF_EXISTS) && declaringBean.getScope().equals(Dependent.class)) { throw EventLogger.LOG.invalidScopedConditionalObserver(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } if (eventObjects.size() > 1) { throw EventLogger.LOG.multipleEventParameters(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } EnhancedAnnotatedParameter<?, Y> eventParameter = eventObjects.iterator().next(); checkRequiredTypeAnnotations(eventParameter); // Check for parameters annotated with @Disposes List<?> disposeParams = annotated.getEnhancedParameters(Disposes.class); if (disposeParams.size() > 0) { throw EventLogger.LOG.invalidDisposesParameter(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } // Check annotations on the method to make sure this is not a producer // method, initializer method, or destructor method. if (this.observerMethod.getAnnotated().isAnnotationPresent(Produces.class)) { throw EventLogger.LOG.invalidProducer(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } if (this.observerMethod.getAnnotated().isAnnotationPresent(Inject.class)) { throw EventLogger.LOG.invalidInitializer(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } boolean containerLifecycleObserverMethod = Observers.isContainerLifecycleObserverMethod(this); for (EnhancedAnnotatedParameter<?, ?> parameter : annotated.getEnhancedParameters()) { // if this is an observer method for container lifecycle event, it must not inject anything besides BeanManager if (containerLifecycleObserverMethod && !parameter.isAnnotationPresent(Observes.class) && !parameter.isAnnotationPresent(ObservesAsync.class) && !BeanManager.class.equals(parameter.getBaseType())) { throw EventLogger.LOG.invalidInjectionPoint(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } } }
java
private <Y> void checkObserverMethod(EnhancedAnnotatedMethod<T, Y> annotated) { // Make sure exactly one and only one parameter is annotated with Observes or ObservesAsync List<EnhancedAnnotatedParameter<?, Y>> eventObjects = annotated.getEnhancedParameters(Observes.class); eventObjects.addAll(annotated.getEnhancedParameters(ObservesAsync.class)); if (this.reception.equals(Reception.IF_EXISTS) && declaringBean.getScope().equals(Dependent.class)) { throw EventLogger.LOG.invalidScopedConditionalObserver(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } if (eventObjects.size() > 1) { throw EventLogger.LOG.multipleEventParameters(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } EnhancedAnnotatedParameter<?, Y> eventParameter = eventObjects.iterator().next(); checkRequiredTypeAnnotations(eventParameter); // Check for parameters annotated with @Disposes List<?> disposeParams = annotated.getEnhancedParameters(Disposes.class); if (disposeParams.size() > 0) { throw EventLogger.LOG.invalidDisposesParameter(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } // Check annotations on the method to make sure this is not a producer // method, initializer method, or destructor method. if (this.observerMethod.getAnnotated().isAnnotationPresent(Produces.class)) { throw EventLogger.LOG.invalidProducer(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } if (this.observerMethod.getAnnotated().isAnnotationPresent(Inject.class)) { throw EventLogger.LOG.invalidInitializer(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } boolean containerLifecycleObserverMethod = Observers.isContainerLifecycleObserverMethod(this); for (EnhancedAnnotatedParameter<?, ?> parameter : annotated.getEnhancedParameters()) { // if this is an observer method for container lifecycle event, it must not inject anything besides BeanManager if (containerLifecycleObserverMethod && !parameter.isAnnotationPresent(Observes.class) && !parameter.isAnnotationPresent(ObservesAsync.class) && !BeanManager.class.equals(parameter.getBaseType())) { throw EventLogger.LOG.invalidInjectionPoint(this, Formats.formatAsStackTraceElement(annotated.getJavaMember())); } } }
[ "private", "<", "Y", ">", "void", "checkObserverMethod", "(", "EnhancedAnnotatedMethod", "<", "T", ",", "Y", ">", "annotated", ")", "{", "// Make sure exactly one and only one parameter is annotated with Observes or ObservesAsync", "List", "<", "EnhancedAnnotatedParameter", "...
Performs validation of the observer method for compliance with the specifications.
[ "Performs", "validation", "of", "the", "observer", "method", "for", "compliance", "with", "the", "specifications", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java#L199-L232
train
weld/core
impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
ObserverMethodImpl.sendEvent
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) { // creational context is created only if we need it for obtaining receiver // ObserverInvocationStrategy takes care of creating CC for parameters, if needed creationalContext = beanManager.createCreationalContext(declaringBean); receiver = getReceiverIfExists(creationalContext); } if (receiver != null) { sendEvent(event, receiver, creationalContext); } } finally { if (creationalContext != null) { creationalContext.release(); } } } }
java
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) { // creational context is created only if we need it for obtaining receiver // ObserverInvocationStrategy takes care of creating CC for parameters, if needed creationalContext = beanManager.createCreationalContext(declaringBean); receiver = getReceiverIfExists(creationalContext); } if (receiver != null) { sendEvent(event, receiver, creationalContext); } } finally { if (creationalContext != null) { creationalContext.release(); } } } }
[ "protected", "void", "sendEvent", "(", "final", "T", "event", ")", "{", "if", "(", "isStatic", ")", "{", "sendEvent", "(", "event", ",", "null", ",", "null", ")", ";", "}", "else", "{", "CreationalContext", "<", "X", ">", "creationalContext", "=", "nul...
Invokes the observer method immediately passing the event. @param event The event to notify observer with
[ "Invokes", "the", "observer", "method", "immediately", "passing", "the", "event", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java#L294-L316
train
weld/core
impl/src/main/java/org/jboss/weld/contexts/cache/RequestScopedCache.java
RequestScopedCache.endRequest
public static void endRequest() { final List<RequestScopedItem> result = CACHE.get(); if (result != null) { CACHE.remove(); for (final RequestScopedItem item : result) { item.invalidate(); } } }
java
public static void endRequest() { final List<RequestScopedItem> result = CACHE.get(); if (result != null) { CACHE.remove(); for (final RequestScopedItem item : result) { item.invalidate(); } } }
[ "public", "static", "void", "endRequest", "(", ")", "{", "final", "List", "<", "RequestScopedItem", ">", "result", "=", "CACHE", ".", "get", "(", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "CACHE", ".", "remove", "(", ")", ";", "for", "...
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.
[ "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", "."...
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/cache/RequestScopedCache.java#L83-L91
train
weld/core
impl/src/main/java/org/jboss/weld/annotated/runtime/InvokableAnnotatedMethod.java
InvokableAnnotatedMethod.invokeOnInstance
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()); if (method == null) { // the same method may be written to the map twice, but that is ok // lookupMethod is very slow Method delegate = annotatedMethod.getJavaMember(); method = SecurityActions.lookupMethod(instance.getClass(), delegate.getName(), delegate.getParameterTypes()); SecurityActions.ensureAccessible(method); synchronized (this) { final Map<Class<?>, Method> newMethods = new HashMap<Class<?>, Method>(methods); newMethods.put(instance.getClass(), method); this.methods = WeldCollections.immutableMapView(newMethods); } } return cast(method.invoke(instance, parameters)); }
java
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()); if (method == null) { // the same method may be written to the map twice, but that is ok // lookupMethod is very slow Method delegate = annotatedMethod.getJavaMember(); method = SecurityActions.lookupMethod(instance.getClass(), delegate.getName(), delegate.getParameterTypes()); SecurityActions.ensureAccessible(method); synchronized (this) { final Map<Class<?>, Method> newMethods = new HashMap<Class<?>, Method>(methods); newMethods.put(instance.getClass(), method); this.methods = WeldCollections.immutableMapView(newMethods); } } return cast(method.invoke(instance, parameters)); }
[ "public", "<", "X", ">", "X", "invokeOnInstance", "(", "Object", "instance", ",", "Object", "...", "parameters", ")", "throws", "IllegalArgumentException", ",", "SecurityException", ",", "IllegalAccessException", ",", "InvocationTargetException", ",", "NoSuchMethodExcep...
Invokes the method on the class of the passed instance, not the declaring class. Useful with proxies @param instance The instance to invoke @param manager The Bean manager @return A reference to the instance
[ "Invokes", "the", "method", "on", "the", "class", "of", "the", "passed", "instance", "not", "the", "declaring", "class", ".", "Useful", "with", "proxies" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/annotated/runtime/InvokableAnnotatedMethod.java#L71-L87
train
weld/core
impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java
ApiAbstraction.annotationTypeForName
@SuppressWarnings("unchecked") protected Class<? extends Annotation> annotationTypeForName(String name) { try { return (Class<? extends Annotation>) resourceLoader.classForName(name); } catch (ResourceLoadingException cnfe) { return DUMMY_ANNOTATION; } }
java
@SuppressWarnings("unchecked") protected Class<? extends Annotation> annotationTypeForName(String name) { try { return (Class<? extends Annotation>) resourceLoader.classForName(name); } catch (ResourceLoadingException cnfe) { return DUMMY_ANNOTATION; } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "Class", "<", "?", "extends", "Annotation", ">", "annotationTypeForName", "(", "String", "name", ")", "{", "try", "{", "return", "(", "Class", "<", "?", "extends", "Annotation", ">", ")", "reso...
Initializes an annotation class @param name The name of the annotation class @return The instance of the annotation. Returns a dummy if the class was not found
[ "Initializes", "an", "annotation", "class" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java#L74-L81
train
weld/core
impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java
ApiAbstraction.classForName
protected Class<?> classForName(String name) { try { return resourceLoader.classForName(name); } catch (ResourceLoadingException cnfe) { return DUMMY_CLASS; } }
java
protected Class<?> classForName(String name) { try { return resourceLoader.classForName(name); } catch (ResourceLoadingException cnfe) { return DUMMY_CLASS; } }
[ "protected", "Class", "<", "?", ">", "classForName", "(", "String", "name", ")", "{", "try", "{", "return", "resourceLoader", ".", "classForName", "(", "name", ")", ";", "}", "catch", "(", "ResourceLoadingException", "cnfe", ")", "{", "return", "DUMMY_CLASS"...
Initializes a type @param name The name of the class @return The instance of the class. Returns a dummy if the class was not found.
[ "Initializes", "a", "type" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/ApiAbstraction.java#L90-L96
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
ProxyFactory.addInterface
public void addInterface(Class<?> newInterface) { if (!newInterface.isInterface()) { throw new IllegalArgumentException(newInterface + " is not an interface"); } additionalInterfaces.add(newInterface); }
java
public void addInterface(Class<?> newInterface) { if (!newInterface.isInterface()) { throw new IllegalArgumentException(newInterface + " is not an interface"); } additionalInterfaces.add(newInterface); }
[ "public", "void", "addInterface", "(", "Class", "<", "?", ">", "newInterface", ")", "{", "if", "(", "!", "newInterface", ".", "isInterface", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "newInterface", "+", "\" is not an interface\"", "...
Adds an additional interface that the proxy should implement. The default implementation will be to forward invocations to the bean instance. @param newInterface an interface
[ "Adds", "an", "additional", "interface", "that", "the", "proxy", "should", "implement", ".", "The", "default", "implementation", "will", "be", "to", "forward", "invocations", "to", "the", "bean", "instance", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L309-L314
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
ProxyFactory.create
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; }
java
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; }
[ "public", "T", "create", "(", "BeanInstance", "beanInstance", ")", "{", "final", "T", "proxy", "=", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "?", "run", "(", ")", ":", "AccessController", ".", "doPrivileged", "(", "this", ")...
Method to create a new proxy that wraps the bean instance. @param beanInstance the bean instance @return a new proxy object
[ "Method", "to", "create", "a", "new", "proxy", "that", "wraps", "the", "bean", "instance", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L322-L326
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
ProxyFactory.getProxyClass
public Class<T> getProxyClass() { String suffix = "_$$_Weld" + getProxyNameSuffix(); String proxyClassName = getBaseProxyName(); if (!proxyClassName.endsWith(suffix)) { proxyClassName = proxyClassName + suffix; } if (proxyClassName.startsWith(JAVA)) { proxyClassName = proxyClassName.replaceFirst(JAVA, "org.jboss.weld"); } Class<T> proxyClass = null; Class<?> originalClass = bean != null ? bean.getBeanClass() : proxiedBeanType; BeanLogger.LOG.generatingProxyClass(proxyClassName); try { // First check to see if we already have this proxy class proxyClass = cast(classLoader == null? proxyServices.loadClass(originalClass, proxyClassName) : classLoader.loadClass(proxyClassName)); } catch (ClassNotFoundException e) { // Create the proxy class for this instance try { proxyClass = createProxyClass(originalClass, proxyClassName); } catch (Throwable e1) { //attempt to load the class again, just in case another thread //defined it between the check and the create method try { proxyClass = cast(classLoader == null? proxyServices.loadClass(originalClass, proxyClassName) : classLoader.loadClass(proxyClassName)); } catch (ClassNotFoundException e2) { BeanLogger.LOG.catchingDebug(e1); throw BeanLogger.LOG.unableToLoadProxyClass(bean, proxiedBeanType, e1); } } } return proxyClass; }
java
public Class<T> getProxyClass() { String suffix = "_$$_Weld" + getProxyNameSuffix(); String proxyClassName = getBaseProxyName(); if (!proxyClassName.endsWith(suffix)) { proxyClassName = proxyClassName + suffix; } if (proxyClassName.startsWith(JAVA)) { proxyClassName = proxyClassName.replaceFirst(JAVA, "org.jboss.weld"); } Class<T> proxyClass = null; Class<?> originalClass = bean != null ? bean.getBeanClass() : proxiedBeanType; BeanLogger.LOG.generatingProxyClass(proxyClassName); try { // First check to see if we already have this proxy class proxyClass = cast(classLoader == null? proxyServices.loadClass(originalClass, proxyClassName) : classLoader.loadClass(proxyClassName)); } catch (ClassNotFoundException e) { // Create the proxy class for this instance try { proxyClass = createProxyClass(originalClass, proxyClassName); } catch (Throwable e1) { //attempt to load the class again, just in case another thread //defined it between the check and the create method try { proxyClass = cast(classLoader == null? proxyServices.loadClass(originalClass, proxyClassName) : classLoader.loadClass(proxyClassName)); } catch (ClassNotFoundException e2) { BeanLogger.LOG.catchingDebug(e1); throw BeanLogger.LOG.unableToLoadProxyClass(bean, proxiedBeanType, e1); } } } return proxyClass; }
[ "public", "Class", "<", "T", ">", "getProxyClass", "(", ")", "{", "String", "suffix", "=", "\"_$$_Weld\"", "+", "getProxyNameSuffix", "(", ")", ";", "String", "proxyClassName", "=", "getBaseProxyName", "(", ")", ";", "if", "(", "!", "proxyClassName", ".", ...
Produces or returns the existing proxy class. The operation is thread-safe. @return always the class of the proxy
[ "Produces", "or", "returns", "the", "existing", "proxy", "class", ".", "The", "operation", "is", "thread", "-", "safe", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L352-L383
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
ProxyFactory.setBeanInstance
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)); } }
java
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)); } }
[ "public", "static", "<", "T", ">", "void", "setBeanInstance", "(", "String", "contextId", ",", "T", "proxy", ",", "BeanInstance", "beanInstance", ",", "Bean", "<", "?", ">", "bean", ")", "{", "if", "(", "proxy", "instanceof", "ProxyObject", ")", "{", "Pr...
Convenience method to set the underlying bean instance for a proxy. @param proxy the proxy instance @param beanInstance the instance of the bean
[ "Convenience", "method", "to", "set", "the", "underlying", "bean", "instance", "for", "a", "proxy", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L400-L405
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
ProxyFactory.addConstructors
protected void addConstructors(ClassFile proxyClassType, List<DeferredBytecode> initialValueBytecode) { try { if (getBeanType().isInterface()) { ConstructorUtils.addDefaultConstructor(proxyClassType, initialValueBytecode, !useConstructedFlag()); } else { boolean constructorFound = false; for (Constructor<?> constructor : AccessController.doPrivileged(new GetDeclaredConstructorsAction(getBeanType()))) { if ((constructor.getModifiers() & Modifier.PRIVATE) == 0) { constructorFound = true; String[] exceptions = new String[constructor.getExceptionTypes().length]; for (int i = 0; i < exceptions.length; ++i) { exceptions[i] = constructor.getExceptionTypes()[i].getName(); } ConstructorUtils.addConstructor(BytecodeUtils.VOID_CLASS_DESCRIPTOR, DescriptorUtils.parameterDescriptors(constructor.getParameterTypes()), exceptions, proxyClassType, initialValueBytecode, !useConstructedFlag()); } } if (!constructorFound) { // the bean only has private constructors, we need to generate // two fake constructors that call each other addConstructorsForBeanWithPrivateConstructors(proxyClassType); } } } catch (Exception e) { throw new WeldException(e); } }
java
protected void addConstructors(ClassFile proxyClassType, List<DeferredBytecode> initialValueBytecode) { try { if (getBeanType().isInterface()) { ConstructorUtils.addDefaultConstructor(proxyClassType, initialValueBytecode, !useConstructedFlag()); } else { boolean constructorFound = false; for (Constructor<?> constructor : AccessController.doPrivileged(new GetDeclaredConstructorsAction(getBeanType()))) { if ((constructor.getModifiers() & Modifier.PRIVATE) == 0) { constructorFound = true; String[] exceptions = new String[constructor.getExceptionTypes().length]; for (int i = 0; i < exceptions.length; ++i) { exceptions[i] = constructor.getExceptionTypes()[i].getName(); } ConstructorUtils.addConstructor(BytecodeUtils.VOID_CLASS_DESCRIPTOR, DescriptorUtils.parameterDescriptors(constructor.getParameterTypes()), exceptions, proxyClassType, initialValueBytecode, !useConstructedFlag()); } } if (!constructorFound) { // the bean only has private constructors, we need to generate // two fake constructors that call each other addConstructorsForBeanWithPrivateConstructors(proxyClassType); } } } catch (Exception e) { throw new WeldException(e); } }
[ "protected", "void", "addConstructors", "(", "ClassFile", "proxyClassType", ",", "List", "<", "DeferredBytecode", ">", "initialValueBytecode", ")", "{", "try", "{", "if", "(", "getBeanType", "(", ")", ".", "isInterface", "(", ")", ")", "{", "ConstructorUtils", ...
Adds a constructor for the proxy for each constructor declared by the base bean type. @param proxyClassType the Javassist class for the proxy @param initialValueBytecode
[ "Adds", "a", "constructor", "for", "the", "proxy", "for", "each", "constructor", "declared", "by", "the", "base", "bean", "type", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L521-L546
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
ProxyFactory.resolveClassLoaderForBeanProxy
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(proxiedType); if (cl == null) { cl = Thread.currentThread().getContextClassLoader(); } return cl; } return Container.instance(contextId).services().get(ProxyServices.class).getClassLoader(superClass); }
java
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(proxiedType); if (cl == null) { cl = Thread.currentThread().getContextClassLoader(); } return cl; } return Container.instance(contextId).services().get(ProxyServices.class).getClassLoader(superClass); }
[ "public", "static", "ClassLoader", "resolveClassLoaderForBeanProxy", "(", "String", "contextId", ",", "Class", "<", "?", ">", "proxiedType", ",", "TypeInfo", "typeInfo", ",", "ProxyServices", "proxyServices", ")", "{", "Class", "<", "?", ">", "superClass", "=", ...
Figures out the correct class loader to use for a proxy for a given bean
[ "Figures", "out", "the", "correct", "class", "loader", "to", "use", "for", "a", "proxy", "for", "a", "given", "bean" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L902-L912
train