id
int32 0
165k
| 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
sequence | docstring
stringlengths 3
16k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 105
339
|
---|---|---|---|---|---|---|---|---|---|---|---|
163,300 | 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",
"!=",
"'",
"'",
")",
"{",
"// we have a primitive type",
"switch",
"(",
"tp",
")",
"{",
"case",
"'",
"'",
":",
"code",
".",
"lload",
"(",
"variable",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"code",
".",
"dload",
"(",
"variable",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"code",
".",
"fload",
"(",
"variable",
")",
";",
"break",
";",
"default",
":",
"code",
".",
"iload",
"(",
"variable",
")",
";",
"}",
"}",
"else",
"{",
"code",
".",
"aload",
"(",
"variable",
")",
";",
"}",
"}"
] | 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 |
163,301 | 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\"",
")",
"&&",
"classType",
".",
"endsWith",
"(",
"\";\"",
")",
")",
"{",
"classType",
"=",
"classType",
".",
"substring",
"(",
"1",
",",
"classType",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"b",
".",
"loadClass",
"(",
"classType",
")",
";",
"}",
"else",
"{",
"char",
"type",
"=",
"classType",
".",
"charAt",
"(",
"0",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"'",
"'",
":",
"b",
".",
"getstatic",
"(",
"Integer",
".",
"class",
".",
"getName",
"(",
")",
",",
"TYPE",
",",
"LJAVA_LANG_CLASS",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"b",
".",
"getstatic",
"(",
"Long",
".",
"class",
".",
"getName",
"(",
")",
",",
"TYPE",
",",
"LJAVA_LANG_CLASS",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"b",
".",
"getstatic",
"(",
"Short",
".",
"class",
".",
"getName",
"(",
")",
",",
"TYPE",
",",
"LJAVA_LANG_CLASS",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"b",
".",
"getstatic",
"(",
"Float",
".",
"class",
".",
"getName",
"(",
")",
",",
"TYPE",
",",
"LJAVA_LANG_CLASS",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"b",
".",
"getstatic",
"(",
"Double",
".",
"class",
".",
"getName",
"(",
")",
",",
"TYPE",
",",
"LJAVA_LANG_CLASS",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"b",
".",
"getstatic",
"(",
"Byte",
".",
"class",
".",
"getName",
"(",
")",
",",
"TYPE",
",",
"LJAVA_LANG_CLASS",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"b",
".",
"getstatic",
"(",
"Character",
".",
"class",
".",
"getName",
"(",
")",
",",
"TYPE",
",",
"LJAVA_LANG_CLASS",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"b",
".",
"getstatic",
"(",
"Boolean",
".",
"class",
".",
"getName",
"(",
")",
",",
"TYPE",
",",
"LJAVA_LANG_CLASS",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Cannot handle primitive type: \"",
"+",
"type",
")",
";",
"}",
"}",
"}"
] | 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 |
163,302 | 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",
"(",
"bindings",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"Annotation",
"annotation",
":",
"bindings",
")",
"{",
"if",
"(",
"!",
"annotation",
".",
"annotationType",
"(",
")",
".",
"equals",
"(",
"Named",
".",
"class",
")",
")",
"{",
"throw",
"MetadataLogger",
".",
"LOG",
".",
"qualifierOnStereotype",
"(",
"annotatedAnnotation",
")",
";",
"}",
"}",
"}",
"}"
] | 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 |
163,303 | 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",
"(",
"annotatedAnnotation",
".",
"getAnnotation",
"(",
"Named",
".",
"class",
")",
".",
"value",
"(",
")",
")",
")",
"{",
"throw",
"MetadataLogger",
".",
"LOG",
".",
"valueOnNamedStereotype",
"(",
"annotatedAnnotation",
")",
";",
"}",
"beanNameDefaulted",
"=",
"true",
";",
"}",
"}"
] | 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 |
163,304 | 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",
"(",
"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",
"(",
")",
";",
"}",
"}"
] | 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 |
163,305 | 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",
"type",
";",
"}",
"}"
] | 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 |
163,306 | 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",
"(",
")",
";",
"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",
";",
"}"
] | 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 |
163,307 | 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",
")",
".",
"isArray",
"(",
")",
")",
";",
"}"
] | 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 |
163,308 | 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",
"(",
")",
";",
"}",
"if",
"(",
"type",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"(",
"Class",
"<",
"?",
">",
")",
"type",
";",
"if",
"(",
"clazz",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"clazz",
".",
"getComponentType",
"(",
")",
";",
"}",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not an array type \"",
"+",
"type",
")",
";",
"}"
] | 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 |
163,309 | 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",
")",
")",
"{",
"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",
";",
"}"
] | 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 |
163,310 | 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",
"(",
")",
";",
"}",
"if",
"(",
"creationalContext",
"!=",
"null",
")",
"{",
"T",
"instance",
"=",
"contextual",
".",
"create",
"(",
"creationalContext",
")",
";",
"if",
"(",
"creationalContext",
"instanceof",
"WeldCreationalContext",
"<",
"?",
">",
")",
"{",
"addDependentInstance",
"(",
"instance",
",",
"contextual",
",",
"(",
"WeldCreationalContext",
"<",
"T",
">",
")",
"creationalContext",
")",
";",
"}",
"return",
"instance",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | 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 |
163,311 | 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",
".",
"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",
"(",
")",
")",
")",
";",
"}",
"}"
] | 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 |
163,312 | 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",
"DecoratorImpl",
"<",
"T",
">",
"(",
"attributes",
",",
"clazz",
",",
"beanManager",
")",
";",
"}"
] | 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 |
163,313 | 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",
"(",
"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",
"(",
")",
")",
";",
"}",
"}"
] | 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 |
163,314 | 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",
"(",
")",
";",
"threadContext",
".",
"deactivate",
"(",
")",
";",
"}",
"}"
] | 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 |
163,315 | 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",
"(",
")",
".",
"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",
";",
"}"
] | 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 |
163,316 | 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",
"=",
"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",
")",
";",
"}",
"}"
] | 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 |
163,317 | 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",
"false",
";",
"}",
"if",
"(",
"type1",
".",
"getLowerBounds",
"(",
")",
".",
"length",
">",
"0",
"&&",
"!",
"isAssignableFrom",
"(",
"type2",
",",
"type1",
".",
"getLowerBounds",
"(",
")",
"[",
"0",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | This logic is shared for all actual types i.e. raw types, parameterized types and generic array types. | [
"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 |
163,318 | 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",
"stack",
".",
"peek",
"(",
")",
";",
"}"
] | 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 |
163,319 | 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",
")",
";",
"interceptionContexts",
".",
"set",
"(",
"stack",
")",
";",
"}",
"return",
"stack",
";",
"}"
] | 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 |
163,320 | 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 |
163,321 | 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\"",
")",
";",
"boolean",
"modified",
"=",
"false",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"modified",
"|=",
"target",
".",
"add",
"(",
"iterator",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"modified",
";",
"}"
] | 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 |
163,322 | 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",
",",
"\"iterators\"",
")",
";",
"return",
"new",
"CombinedIterator",
"<",
"T",
">",
"(",
"iterators",
")",
";",
"}"
] | 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 |
163,323 | 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",
"this",
";",
"}"
] | 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 |
163,324 | 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",
")",
";",
"qualifiers",
".",
"invalidate",
"(",
"annotationClass",
")",
";",
"interceptorBindings",
".",
"invalidate",
"(",
"annotationClass",
")",
";",
"}"
] | removes all data for an annotation class. This should be called after an
annotation has been modified through the SPI | [
"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 |
163,325 | 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",
"map",
";",
"}",
"return",
"Collections",
".",
"unmodifiableMap",
"(",
"map",
")",
";",
"}"
] | 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 |
163,326 | 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",
")",
"{",
"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",
"(",
")",
")",
")",
";",
"}",
"}",
"}"
] | 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 |
163,327 | 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",
")",
";",
"}",
"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",
";",
"}"
] | 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 |
163,328 | 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",
"=",
"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",
")",
";",
"}"
] | 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 |
163,329 | 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 |
163,330 | 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",
"(",
")",
")",
"{",
"if",
"(",
"annotatedAnnotation",
".",
"isAnnotationPresent",
"(",
"annotationType",
")",
")",
"{",
"this",
".",
"valid",
"=",
"true",
";",
"}",
"}",
"}"
] | 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 |
163,331 | 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",
"!=",
"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",
";",
"}",
"}",
"}"
] | 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 |
163,332 | 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",
"(",
"this",
".",
"codeFragmentPrototype",
",",
"this",
".",
"page",
",",
"this",
".",
"paginator",
")",
";",
"return",
"\"history\"",
";",
"}"
] | 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 |
163,333 | 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 |
163,334 | 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",
".",
"put",
"(",
"ejbDescriptor",
".",
"getEjbName",
"(",
")",
",",
"internalEjbDescriptor",
")",
";",
"ejbByClass",
".",
"put",
"(",
"ejbDescriptor",
".",
"getBeanClass",
"(",
")",
",",
"internalEjbDescriptor",
".",
"getEjbName",
"(",
")",
")",
";",
"}"
] | 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 |
163,335 | 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",
"(",
"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",
")",
"{",
"}",
"}"
] | 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 |
163,336 | 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",
",",
"deploymentManager",
",",
"deploymentServices",
")",
";",
"Container",
".",
"instance",
".",
"set",
"(",
"RegistrySingletonProvider",
".",
"STATIC_INSTANCE",
",",
"instance",
")",
";",
"}"
] | 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 |
163,337 | 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",
"(",
")",
";",
"}",
"beanDeploymentArchives",
".",
"clear",
"(",
")",
";",
"deploymentServices",
".",
"cleanup",
"(",
")",
";",
"deploymentManager",
".",
"cleanup",
"(",
")",
";",
"instance",
".",
"clear",
"(",
"contextId",
")",
";",
"}"
] | Cause the container to be cleaned up, including all registered bean
managers, and all deployment services | [
"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 |
163,338 | 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",
"(",
")",
")",
"{",
"beanDeploymentArchives",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"addBeanManager",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] | 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 |
163,339 | 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",
"<",
"?",
",",
"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",
"(",
")",
")",
")",
";",
"}",
"}",
"}"
] | 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 |
163,340 | 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",
"=",
"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",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | 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 |
163,341 | 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",
"(",
"final",
"RequestScopedItem",
"item",
":",
"result",
")",
"{",
"item",
".",
"invalidate",
"(",
")",
";",
"}",
"}",
"}"
] | ends the request and clears the cache. This can be called before the request is over,
in which case the cache will be unavailable for the rest of the request. | [
"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 |
163,342 | 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",
",",
"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",
")",
")",
";",
"}"
] | 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 |
163,343 | 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",
">",
")",
"resourceLoader",
".",
"classForName",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"ResourceLoadingException",
"cnfe",
")",
"{",
"return",
"DUMMY_ANNOTATION",
";",
"}",
"}"
] | 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 |
163,344 | 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 |
163,345 | 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\"",
")",
";",
"}",
"additionalInterfaces",
".",
"add",
"(",
"newInterface",
")",
";",
"}"
] | 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 |
163,346 | 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",
")",
";",
"(",
"(",
"ProxyObject",
")",
"proxy",
")",
".",
"weld_setHandler",
"(",
"new",
"ProxyMethodHandler",
"(",
"contextId",
",",
"beanInstance",
",",
"bean",
")",
")",
";",
"return",
"proxy",
";",
"}"
] | 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 |
163,347 | 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",
".",
"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",
";",
"}"
] | 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 |
163,348 | 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",
")",
"{",
"ProxyObject",
"proxyView",
"=",
"(",
"ProxyObject",
")",
"proxy",
";",
"proxyView",
".",
"weld_setHandler",
"(",
"new",
"ProxyMethodHandler",
"(",
"contextId",
",",
"beanInstance",
",",
"bean",
")",
")",
";",
"}",
"}"
] | 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 |
163,349 | 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",
".",
"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",
")",
";",
"}",
"}"
] | 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 |
163,350 | 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",
"=",
"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",
")",
";",
"}"
] | 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 |
163,351 | weld/core | impl/src/main/java/org/jboss/weld/contexts/beanstore/AttributeBeanStore.java | AttributeBeanStore.fetchUninitializedAttributes | public void fetchUninitializedAttributes() {
for (String prefixedId : getPrefixedAttributeNames()) {
BeanIdentifier id = getNamingScheme().deprefix(prefixedId);
if (!beanStore.contains(id)) {
ContextualInstance<?> instance = (ContextualInstance<?>) getAttribute(prefixedId);
beanStore.put(id, instance);
ContextLogger.LOG.addingDetachedContextualUnderId(instance, id);
}
}
} | java | public void fetchUninitializedAttributes() {
for (String prefixedId : getPrefixedAttributeNames()) {
BeanIdentifier id = getNamingScheme().deprefix(prefixedId);
if (!beanStore.contains(id)) {
ContextualInstance<?> instance = (ContextualInstance<?>) getAttribute(prefixedId);
beanStore.put(id, instance);
ContextLogger.LOG.addingDetachedContextualUnderId(instance, id);
}
}
} | [
"public",
"void",
"fetchUninitializedAttributes",
"(",
")",
"{",
"for",
"(",
"String",
"prefixedId",
":",
"getPrefixedAttributeNames",
"(",
")",
")",
"{",
"BeanIdentifier",
"id",
"=",
"getNamingScheme",
"(",
")",
".",
"deprefix",
"(",
"prefixedId",
")",
";",
"if",
"(",
"!",
"beanStore",
".",
"contains",
"(",
"id",
")",
")",
"{",
"ContextualInstance",
"<",
"?",
">",
"instance",
"=",
"(",
"ContextualInstance",
"<",
"?",
">",
")",
"getAttribute",
"(",
"prefixedId",
")",
";",
"beanStore",
".",
"put",
"(",
"id",
",",
"instance",
")",
";",
"ContextLogger",
".",
"LOG",
".",
"addingDetachedContextualUnderId",
"(",
"instance",
",",
"id",
")",
";",
"}",
"}",
"}"
] | Fetch all relevant attributes from the backing store and copy instances which are not present in the local bean store. | [
"Fetch",
"all",
"relevant",
"attributes",
"from",
"the",
"backing",
"store",
"and",
"copy",
"instances",
"which",
"are",
"not",
"present",
"in",
"the",
"local",
"bean",
"store",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/beanstore/AttributeBeanStore.java#L119-L128 |
163,352 | weld/core | impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java | WeldConfiguration.merge | static void merge(Map<ConfigurationKey, Object> original, Map<ConfigurationKey, Object> toMerge, String mergedSourceDescription) {
for (Entry<ConfigurationKey, Object> entry : toMerge.entrySet()) {
Object existing = original.get(entry.getKey());
if (existing != null) {
ConfigurationLogger.LOG.configurationKeyAlreadySet(entry.getKey().get(), existing, entry.getValue(), mergedSourceDescription);
} else {
original.put(entry.getKey(), entry.getValue());
}
}
} | java | static void merge(Map<ConfigurationKey, Object> original, Map<ConfigurationKey, Object> toMerge, String mergedSourceDescription) {
for (Entry<ConfigurationKey, Object> entry : toMerge.entrySet()) {
Object existing = original.get(entry.getKey());
if (existing != null) {
ConfigurationLogger.LOG.configurationKeyAlreadySet(entry.getKey().get(), existing, entry.getValue(), mergedSourceDescription);
} else {
original.put(entry.getKey(), entry.getValue());
}
}
} | [
"static",
"void",
"merge",
"(",
"Map",
"<",
"ConfigurationKey",
",",
"Object",
">",
"original",
",",
"Map",
"<",
"ConfigurationKey",
",",
"Object",
">",
"toMerge",
",",
"String",
"mergedSourceDescription",
")",
"{",
"for",
"(",
"Entry",
"<",
"ConfigurationKey",
",",
"Object",
">",
"entry",
":",
"toMerge",
".",
"entrySet",
"(",
")",
")",
"{",
"Object",
"existing",
"=",
"original",
".",
"get",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"existing",
"!=",
"null",
")",
"{",
"ConfigurationLogger",
".",
"LOG",
".",
"configurationKeyAlreadySet",
"(",
"entry",
".",
"getKey",
"(",
")",
".",
"get",
"(",
")",
",",
"existing",
",",
"entry",
".",
"getValue",
"(",
")",
",",
"mergedSourceDescription",
")",
";",
"}",
"else",
"{",
"original",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Merge two maps of configuration properties. If the original contains a mapping for the same key, the new mapping is ignored.
@param original
@param toMerge | [
"Merge",
"two",
"maps",
"of",
"configuration",
"properties",
".",
"If",
"the",
"original",
"contains",
"a",
"mapping",
"for",
"the",
"same",
"key",
"the",
"new",
"mapping",
"is",
"ignored",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L203-L212 |
163,353 | weld/core | impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java | WeldConfiguration.getObsoleteSystemProperties | private Map<ConfigurationKey, Object> getObsoleteSystemProperties() {
Map<ConfigurationKey, Object> found = new EnumMap<ConfigurationKey, Object>(ConfigurationKey.class);
String concurrentDeployment = getSystemProperty("org.jboss.weld.bootstrap.properties.concurrentDeployment");
if (concurrentDeployment != null) {
processKeyValue(found, ConfigurationKey.CONCURRENT_DEPLOYMENT, concurrentDeployment);
found.put(ConfigurationKey.CONCURRENT_DEPLOYMENT, ConfigurationKey.CONCURRENT_DEPLOYMENT.convertValue(concurrentDeployment));
}
String preloaderThreadPoolSize = getSystemProperty("org.jboss.weld.bootstrap.properties.preloaderThreadPoolSize");
if (preloaderThreadPoolSize != null) {
found.put(ConfigurationKey.PRELOADER_THREAD_POOL_SIZE, ConfigurationKey.PRELOADER_THREAD_POOL_SIZE.convertValue(preloaderThreadPoolSize));
}
return found;
} | java | private Map<ConfigurationKey, Object> getObsoleteSystemProperties() {
Map<ConfigurationKey, Object> found = new EnumMap<ConfigurationKey, Object>(ConfigurationKey.class);
String concurrentDeployment = getSystemProperty("org.jboss.weld.bootstrap.properties.concurrentDeployment");
if (concurrentDeployment != null) {
processKeyValue(found, ConfigurationKey.CONCURRENT_DEPLOYMENT, concurrentDeployment);
found.put(ConfigurationKey.CONCURRENT_DEPLOYMENT, ConfigurationKey.CONCURRENT_DEPLOYMENT.convertValue(concurrentDeployment));
}
String preloaderThreadPoolSize = getSystemProperty("org.jboss.weld.bootstrap.properties.preloaderThreadPoolSize");
if (preloaderThreadPoolSize != null) {
found.put(ConfigurationKey.PRELOADER_THREAD_POOL_SIZE, ConfigurationKey.PRELOADER_THREAD_POOL_SIZE.convertValue(preloaderThreadPoolSize));
}
return found;
} | [
"private",
"Map",
"<",
"ConfigurationKey",
",",
"Object",
">",
"getObsoleteSystemProperties",
"(",
")",
"{",
"Map",
"<",
"ConfigurationKey",
",",
"Object",
">",
"found",
"=",
"new",
"EnumMap",
"<",
"ConfigurationKey",
",",
"Object",
">",
"(",
"ConfigurationKey",
".",
"class",
")",
";",
"String",
"concurrentDeployment",
"=",
"getSystemProperty",
"(",
"\"org.jboss.weld.bootstrap.properties.concurrentDeployment\"",
")",
";",
"if",
"(",
"concurrentDeployment",
"!=",
"null",
")",
"{",
"processKeyValue",
"(",
"found",
",",
"ConfigurationKey",
".",
"CONCURRENT_DEPLOYMENT",
",",
"concurrentDeployment",
")",
";",
"found",
".",
"put",
"(",
"ConfigurationKey",
".",
"CONCURRENT_DEPLOYMENT",
",",
"ConfigurationKey",
".",
"CONCURRENT_DEPLOYMENT",
".",
"convertValue",
"(",
"concurrentDeployment",
")",
")",
";",
"}",
"String",
"preloaderThreadPoolSize",
"=",
"getSystemProperty",
"(",
"\"org.jboss.weld.bootstrap.properties.preloaderThreadPoolSize\"",
")",
";",
"if",
"(",
"preloaderThreadPoolSize",
"!=",
"null",
")",
"{",
"found",
".",
"put",
"(",
"ConfigurationKey",
".",
"PRELOADER_THREAD_POOL_SIZE",
",",
"ConfigurationKey",
".",
"PRELOADER_THREAD_POOL_SIZE",
".",
"convertValue",
"(",
"preloaderThreadPoolSize",
")",
")",
";",
"}",
"return",
"found",
";",
"}"
] | Try to get a system property for obsolete keys. The value is automatically converted - a runtime exception may be thrown during conversion.
@return all the properties whose system property keys were different in previous versions | [
"Try",
"to",
"get",
"a",
"system",
"property",
"for",
"obsolete",
"keys",
".",
"The",
"value",
"is",
"automatically",
"converted",
"-",
"a",
"runtime",
"exception",
"may",
"be",
"thrown",
"during",
"conversion",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L346-L358 |
163,354 | weld/core | impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java | WeldConfiguration.readFileProperties | @SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Only local URLs involved")
private Map<ConfigurationKey, Object> readFileProperties(Set<URL> files) {
Map<ConfigurationKey, Object> found = new EnumMap<ConfigurationKey, Object>(ConfigurationKey.class);
for (URL file : files) {
ConfigurationLogger.LOG.readingPropertiesFile(file);
Properties fileProperties = loadProperties(file);
for (String name : fileProperties.stringPropertyNames()) {
processKeyValue(found, name, fileProperties.getProperty(name));
}
}
return found;
} | java | @SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Only local URLs involved")
private Map<ConfigurationKey, Object> readFileProperties(Set<URL> files) {
Map<ConfigurationKey, Object> found = new EnumMap<ConfigurationKey, Object>(ConfigurationKey.class);
for (URL file : files) {
ConfigurationLogger.LOG.readingPropertiesFile(file);
Properties fileProperties = loadProperties(file);
for (String name : fileProperties.stringPropertyNames()) {
processKeyValue(found, name, fileProperties.getProperty(name));
}
}
return found;
} | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"DMI_COLLECTION_OF_URLS\"",
",",
"justification",
"=",
"\"Only local URLs involved\"",
")",
"private",
"Map",
"<",
"ConfigurationKey",
",",
"Object",
">",
"readFileProperties",
"(",
"Set",
"<",
"URL",
">",
"files",
")",
"{",
"Map",
"<",
"ConfigurationKey",
",",
"Object",
">",
"found",
"=",
"new",
"EnumMap",
"<",
"ConfigurationKey",
",",
"Object",
">",
"(",
"ConfigurationKey",
".",
"class",
")",
";",
"for",
"(",
"URL",
"file",
":",
"files",
")",
"{",
"ConfigurationLogger",
".",
"LOG",
".",
"readingPropertiesFile",
"(",
"file",
")",
";",
"Properties",
"fileProperties",
"=",
"loadProperties",
"(",
"file",
")",
";",
"for",
"(",
"String",
"name",
":",
"fileProperties",
".",
"stringPropertyNames",
"(",
")",
")",
"{",
"processKeyValue",
"(",
"found",
",",
"name",
",",
"fileProperties",
".",
"getProperty",
"(",
"name",
")",
")",
";",
"}",
"}",
"return",
"found",
";",
"}"
] | Read the set of property files. Keys and Values are automatically validated and converted.
@param resourceLoader
@return all the properties from the weld.properties file | [
"Read",
"the",
"set",
"of",
"property",
"files",
".",
"Keys",
"and",
"Values",
"are",
"automatically",
"validated",
"and",
"converted",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L366-L377 |
163,355 | weld/core | impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java | WeldConfiguration.processKeyValue | private void processKeyValue(Map<ConfigurationKey, Object> properties, ConfigurationKey key, Object value) {
if (value instanceof String) {
value = key.convertValue((String) value);
}
if (key.isValidValue(value)) {
Object previous = properties.put(key, value);
if (previous != null && !previous.equals(value)) {
throw ConfigurationLogger.LOG.configurationKeyHasDifferentValues(key.get(), previous, value);
}
} else {
throw ConfigurationLogger.LOG.invalidConfigurationPropertyValue(value, key.get());
}
} | java | private void processKeyValue(Map<ConfigurationKey, Object> properties, ConfigurationKey key, Object value) {
if (value instanceof String) {
value = key.convertValue((String) value);
}
if (key.isValidValue(value)) {
Object previous = properties.put(key, value);
if (previous != null && !previous.equals(value)) {
throw ConfigurationLogger.LOG.configurationKeyHasDifferentValues(key.get(), previous, value);
}
} else {
throw ConfigurationLogger.LOG.invalidConfigurationPropertyValue(value, key.get());
}
} | [
"private",
"void",
"processKeyValue",
"(",
"Map",
"<",
"ConfigurationKey",
",",
"Object",
">",
"properties",
",",
"ConfigurationKey",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"value",
"=",
"key",
".",
"convertValue",
"(",
"(",
"String",
")",
"value",
")",
";",
"}",
"if",
"(",
"key",
".",
"isValidValue",
"(",
"value",
")",
")",
"{",
"Object",
"previous",
"=",
"properties",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"if",
"(",
"previous",
"!=",
"null",
"&&",
"!",
"previous",
".",
"equals",
"(",
"value",
")",
")",
"{",
"throw",
"ConfigurationLogger",
".",
"LOG",
".",
"configurationKeyHasDifferentValues",
"(",
"key",
".",
"get",
"(",
")",
",",
"previous",
",",
"value",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"ConfigurationLogger",
".",
"LOG",
".",
"invalidConfigurationPropertyValue",
"(",
"value",
",",
"key",
".",
"get",
"(",
")",
")",
";",
"}",
"}"
] | Process the given key and value. First validate the value and check if there's no different value for the same key in the same source - invalid and
different values are treated as a deployment problem.
@param properties
@param key
@param value | [
"Process",
"the",
"given",
"key",
"and",
"value",
".",
"First",
"validate",
"the",
"value",
"and",
"check",
"if",
"there",
"s",
"no",
"different",
"value",
"for",
"the",
"same",
"key",
"in",
"the",
"same",
"source",
"-",
"invalid",
"and",
"different",
"values",
"are",
"treated",
"as",
"a",
"deployment",
"problem",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L427-L439 |
163,356 | weld/core | impl/src/main/java/org/jboss/weld/event/ObserverFactory.java | ObserverFactory.create | public static <T, X> ObserverMethodImpl<T, X> create(EnhancedAnnotatedMethod<T, ? super X> method, RIBean<X> declaringBean, BeanManagerImpl manager, boolean isAsync) {
if (declaringBean instanceof ExtensionBean) {
return new ExtensionObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync);
}
return new ObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync);
} | java | public static <T, X> ObserverMethodImpl<T, X> create(EnhancedAnnotatedMethod<T, ? super X> method, RIBean<X> declaringBean, BeanManagerImpl manager, boolean isAsync) {
if (declaringBean instanceof ExtensionBean) {
return new ExtensionObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync);
}
return new ObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync);
} | [
"public",
"static",
"<",
"T",
",",
"X",
">",
"ObserverMethodImpl",
"<",
"T",
",",
"X",
">",
"create",
"(",
"EnhancedAnnotatedMethod",
"<",
"T",
",",
"?",
"super",
"X",
">",
"method",
",",
"RIBean",
"<",
"X",
">",
"declaringBean",
",",
"BeanManagerImpl",
"manager",
",",
"boolean",
"isAsync",
")",
"{",
"if",
"(",
"declaringBean",
"instanceof",
"ExtensionBean",
")",
"{",
"return",
"new",
"ExtensionObserverMethodImpl",
"<",
"T",
",",
"X",
">",
"(",
"method",
",",
"declaringBean",
",",
"manager",
",",
"isAsync",
")",
";",
"}",
"return",
"new",
"ObserverMethodImpl",
"<",
"T",
",",
"X",
">",
"(",
"method",
",",
"declaringBean",
",",
"manager",
",",
"isAsync",
")",
";",
"}"
] | Creates an observer
@param method The observer method abstraction
@param declaringBean The declaring bean
@param manager The Bean manager
@return An observer implementation built from the method abstraction | [
"Creates",
"an",
"observer"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java#L46-L51 |
163,357 | weld/core | impl/src/main/java/org/jboss/weld/event/ObserverFactory.java | ObserverFactory.getTransactionalPhase | public static TransactionPhase getTransactionalPhase(EnhancedAnnotatedMethod<?, ?> observer) {
EnhancedAnnotatedParameter<?, ?> parameter = observer.getEnhancedParameters(Observes.class).iterator().next();
return parameter.getAnnotation(Observes.class).during();
} | java | public static TransactionPhase getTransactionalPhase(EnhancedAnnotatedMethod<?, ?> observer) {
EnhancedAnnotatedParameter<?, ?> parameter = observer.getEnhancedParameters(Observes.class).iterator().next();
return parameter.getAnnotation(Observes.class).during();
} | [
"public",
"static",
"TransactionPhase",
"getTransactionalPhase",
"(",
"EnhancedAnnotatedMethod",
"<",
"?",
",",
"?",
">",
"observer",
")",
"{",
"EnhancedAnnotatedParameter",
"<",
"?",
",",
"?",
">",
"parameter",
"=",
"observer",
".",
"getEnhancedParameters",
"(",
"Observes",
".",
"class",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"return",
"parameter",
".",
"getAnnotation",
"(",
"Observes",
".",
"class",
")",
".",
"during",
"(",
")",
";",
"}"
] | Tests an observer method to see if it is transactional.
@param observer The observer method
@return true if the observer method is annotated as transactional | [
"Tests",
"an",
"observer",
"method",
"to",
"see",
"if",
"it",
"is",
"transactional",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java#L59-L62 |
163,358 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java | WeldContainer.startInitialization | static WeldContainer startInitialization(String id, Deployment deployment, Bootstrap bootstrap) {
if (SINGLETON.isSet(id)) {
throw WeldSELogger.LOG.weldContainerAlreadyRunning(id);
}
WeldContainer weldContainer = new WeldContainer(id, deployment, bootstrap);
SINGLETON.set(id, weldContainer);
RUNNING_CONTAINER_IDS.add(id);
return weldContainer;
} | java | static WeldContainer startInitialization(String id, Deployment deployment, Bootstrap bootstrap) {
if (SINGLETON.isSet(id)) {
throw WeldSELogger.LOG.weldContainerAlreadyRunning(id);
}
WeldContainer weldContainer = new WeldContainer(id, deployment, bootstrap);
SINGLETON.set(id, weldContainer);
RUNNING_CONTAINER_IDS.add(id);
return weldContainer;
} | [
"static",
"WeldContainer",
"startInitialization",
"(",
"String",
"id",
",",
"Deployment",
"deployment",
",",
"Bootstrap",
"bootstrap",
")",
"{",
"if",
"(",
"SINGLETON",
".",
"isSet",
"(",
"id",
")",
")",
"{",
"throw",
"WeldSELogger",
".",
"LOG",
".",
"weldContainerAlreadyRunning",
"(",
"id",
")",
";",
"}",
"WeldContainer",
"weldContainer",
"=",
"new",
"WeldContainer",
"(",
"id",
",",
"deployment",
",",
"bootstrap",
")",
";",
"SINGLETON",
".",
"set",
"(",
"id",
",",
"weldContainer",
")",
";",
"RUNNING_CONTAINER_IDS",
".",
"add",
"(",
"id",
")",
";",
"return",
"weldContainer",
";",
"}"
] | Start the initialization.
@param id
@param manager
@param bootstrap
@return the initialized Weld container | [
"Start",
"the",
"initialization",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java#L161-L169 |
163,359 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java | WeldContainer.endInitialization | static void endInitialization(WeldContainer container, boolean isShutdownHookEnabled) {
container.complete();
// If needed, register one shutdown hook for all containers
if (shutdownHook == null && isShutdownHookEnabled) {
synchronized (LOCK) {
if (shutdownHook == null) {
shutdownHook = new ShutdownHook();
SecurityActions.addShutdownHook(shutdownHook);
}
}
}
container.fireContainerInitializedEvent();
} | java | static void endInitialization(WeldContainer container, boolean isShutdownHookEnabled) {
container.complete();
// If needed, register one shutdown hook for all containers
if (shutdownHook == null && isShutdownHookEnabled) {
synchronized (LOCK) {
if (shutdownHook == null) {
shutdownHook = new ShutdownHook();
SecurityActions.addShutdownHook(shutdownHook);
}
}
}
container.fireContainerInitializedEvent();
} | [
"static",
"void",
"endInitialization",
"(",
"WeldContainer",
"container",
",",
"boolean",
"isShutdownHookEnabled",
")",
"{",
"container",
".",
"complete",
"(",
")",
";",
"// If needed, register one shutdown hook for all containers",
"if",
"(",
"shutdownHook",
"==",
"null",
"&&",
"isShutdownHookEnabled",
")",
"{",
"synchronized",
"(",
"LOCK",
")",
"{",
"if",
"(",
"shutdownHook",
"==",
"null",
")",
"{",
"shutdownHook",
"=",
"new",
"ShutdownHook",
"(",
")",
";",
"SecurityActions",
".",
"addShutdownHook",
"(",
"shutdownHook",
")",
";",
"}",
"}",
"}",
"container",
".",
"fireContainerInitializedEvent",
"(",
")",
";",
"}"
] | Finish the initialization.
@param container
@param isShutdownHookEnabled | [
"Finish",
"the",
"initialization",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java#L177-L189 |
163,360 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java | WeldContainer.shutdown | public synchronized void shutdown() {
checkIsRunning();
try {
beanManager().fireEvent(new ContainerBeforeShutdown(id), BeforeDestroyed.Literal.APPLICATION);
} finally {
discard(id);
// Destroy all the dependent beans correctly
creationalContext.release();
beanManager().fireEvent(new ContainerShutdown(id), Destroyed.Literal.APPLICATION);
bootstrap.shutdown();
WeldSELogger.LOG.weldContainerShutdown(id);
}
} | java | public synchronized void shutdown() {
checkIsRunning();
try {
beanManager().fireEvent(new ContainerBeforeShutdown(id), BeforeDestroyed.Literal.APPLICATION);
} finally {
discard(id);
// Destroy all the dependent beans correctly
creationalContext.release();
beanManager().fireEvent(new ContainerShutdown(id), Destroyed.Literal.APPLICATION);
bootstrap.shutdown();
WeldSELogger.LOG.weldContainerShutdown(id);
}
} | [
"public",
"synchronized",
"void",
"shutdown",
"(",
")",
"{",
"checkIsRunning",
"(",
")",
";",
"try",
"{",
"beanManager",
"(",
")",
".",
"fireEvent",
"(",
"new",
"ContainerBeforeShutdown",
"(",
"id",
")",
",",
"BeforeDestroyed",
".",
"Literal",
".",
"APPLICATION",
")",
";",
"}",
"finally",
"{",
"discard",
"(",
"id",
")",
";",
"// Destroy all the dependent beans correctly",
"creationalContext",
".",
"release",
"(",
")",
";",
"beanManager",
"(",
")",
".",
"fireEvent",
"(",
"new",
"ContainerShutdown",
"(",
"id",
")",
",",
"Destroyed",
".",
"Literal",
".",
"APPLICATION",
")",
";",
"bootstrap",
".",
"shutdown",
"(",
")",
";",
"WeldSELogger",
".",
"LOG",
".",
"weldContainerShutdown",
"(",
"id",
")",
";",
"}",
"}"
] | Shutdown the container.
@see Weld#initialize() | [
"Shutdown",
"the",
"container",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java#L294-L306 |
163,361 | weld/core | impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/EnhancedAnnotatedTypeImpl.java | EnhancedAnnotatedTypeImpl.getEnhancedConstructors | @Override
public Collection<EnhancedAnnotatedConstructor<T>> getEnhancedConstructors(Class<? extends Annotation> annotationType) {
Set<EnhancedAnnotatedConstructor<T>> ret = new HashSet<EnhancedAnnotatedConstructor<T>>();
for (EnhancedAnnotatedConstructor<T> constructor : constructors) {
if (constructor.isAnnotationPresent(annotationType)) {
ret.add(constructor);
}
}
return ret;
} | java | @Override
public Collection<EnhancedAnnotatedConstructor<T>> getEnhancedConstructors(Class<? extends Annotation> annotationType) {
Set<EnhancedAnnotatedConstructor<T>> ret = new HashSet<EnhancedAnnotatedConstructor<T>>();
for (EnhancedAnnotatedConstructor<T> constructor : constructors) {
if (constructor.isAnnotationPresent(annotationType)) {
ret.add(constructor);
}
}
return ret;
} | [
"@",
"Override",
"public",
"Collection",
"<",
"EnhancedAnnotatedConstructor",
"<",
"T",
">",
">",
"getEnhancedConstructors",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"Set",
"<",
"EnhancedAnnotatedConstructor",
"<",
"T",
">>",
"ret",
"=",
"new",
"HashSet",
"<",
"EnhancedAnnotatedConstructor",
"<",
"T",
">",
">",
"(",
")",
";",
"for",
"(",
"EnhancedAnnotatedConstructor",
"<",
"T",
">",
"constructor",
":",
"constructors",
")",
"{",
"if",
"(",
"constructor",
".",
"isAnnotationPresent",
"(",
"annotationType",
")",
")",
"{",
"ret",
".",
"add",
"(",
"constructor",
")",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] | Gets constructors with given annotation type
@param annotationType The annotation type to match
@return A set of abstracted constructors with given annotation type. If
the constructors set is empty, initialize it first. Returns an
empty set if there are no matches.
@see org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType#getEnhancedConstructors(Class) | [
"Gets",
"constructors",
"with",
"given",
"annotation",
"type"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/EnhancedAnnotatedTypeImpl.java#L504-L513 |
163,362 | weld/core | impl/src/main/java/org/jboss/weld/contexts/AbstractBoundContext.java | AbstractBoundContext.setBeanStore | protected void setBeanStore(BoundBeanStore beanStore) {
if (beanStore == null) {
this.beanStore.remove();
} else {
this.beanStore.set(beanStore);
}
} | java | protected void setBeanStore(BoundBeanStore beanStore) {
if (beanStore == null) {
this.beanStore.remove();
} else {
this.beanStore.set(beanStore);
}
} | [
"protected",
"void",
"setBeanStore",
"(",
"BoundBeanStore",
"beanStore",
")",
"{",
"if",
"(",
"beanStore",
"==",
"null",
")",
"{",
"this",
".",
"beanStore",
".",
"remove",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"beanStore",
".",
"set",
"(",
"beanStore",
")",
";",
"}",
"}"
] | Sets the bean store
@param beanStore The bean store | [
"Sets",
"the",
"bean",
"store"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/AbstractBoundContext.java#L59-L65 |
163,363 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/beans/ParametersFactory.java | ParametersFactory.setArgs | public void setArgs(String[] args) {
if (args == null) {
args = new String[]{};
}
this.args = args;
this.argsList = Collections.unmodifiableList(new ArrayList<String>(Arrays.asList(args)));
} | java | public void setArgs(String[] args) {
if (args == null) {
args = new String[]{};
}
this.args = args;
this.argsList = Collections.unmodifiableList(new ArrayList<String>(Arrays.asList(args)));
} | [
"public",
"void",
"setArgs",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
"==",
"null",
")",
"{",
"args",
"=",
"new",
"String",
"[",
"]",
"{",
"}",
";",
"}",
"this",
".",
"args",
"=",
"args",
";",
"this",
".",
"argsList",
"=",
"Collections",
".",
"unmodifiableList",
"(",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"Arrays",
".",
"asList",
"(",
"args",
")",
")",
")",
";",
"}"
] | StartMain passes in the command line args here.
@param args The command line arguments. If null is given then an empty
array will be used instead. | [
"StartMain",
"passes",
"in",
"the",
"command",
"line",
"args",
"here",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/beans/ParametersFactory.java#L76-L82 |
163,364 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java | Weld.addPackages | public Weld addPackages(boolean scanRecursively, Class<?>... packageClasses) {
for (Class<?> packageClass : packageClasses) {
addPackage(scanRecursively, packageClass);
}
return this;
} | java | public Weld addPackages(boolean scanRecursively, Class<?>... packageClasses) {
for (Class<?> packageClass : packageClasses) {
addPackage(scanRecursively, packageClass);
}
return this;
} | [
"public",
"Weld",
"addPackages",
"(",
"boolean",
"scanRecursively",
",",
"Class",
"<",
"?",
">",
"...",
"packageClasses",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"packageClass",
":",
"packageClasses",
")",
"{",
"addPackage",
"(",
"scanRecursively",
",",
"packageClass",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Packages of the specified classes will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive.
@param scanRecursively
@param packageClasses
@return self | [
"Packages",
"of",
"the",
"specified",
"classes",
"will",
"be",
"scanned",
"and",
"found",
"classes",
"will",
"be",
"added",
"to",
"the",
"set",
"of",
"bean",
"classes",
"for",
"the",
"synthetic",
"bean",
"archive",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L368-L373 |
163,365 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java | Weld.addPackage | public Weld addPackage(boolean scanRecursively, Class<?> packageClass) {
packages.add(new PackInfo(packageClass, scanRecursively));
return this;
} | java | public Weld addPackage(boolean scanRecursively, Class<?> packageClass) {
packages.add(new PackInfo(packageClass, scanRecursively));
return this;
} | [
"public",
"Weld",
"addPackage",
"(",
"boolean",
"scanRecursively",
",",
"Class",
"<",
"?",
">",
"packageClass",
")",
"{",
"packages",
".",
"add",
"(",
"new",
"PackInfo",
"(",
"packageClass",
",",
"scanRecursively",
")",
")",
";",
"return",
"this",
";",
"}"
] | A package of the specified class will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive.
@param scanRecursively
@param packageClass
@return self | [
"A",
"package",
"of",
"the",
"specified",
"class",
"will",
"be",
"scanned",
"and",
"found",
"classes",
"will",
"be",
"added",
"to",
"the",
"set",
"of",
"bean",
"classes",
"for",
"the",
"synthetic",
"bean",
"archive",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L402-L405 |
163,366 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java | Weld.extensions | public Weld extensions(Extension... extensions) {
this.extensions.clear();
for (Extension extension : extensions) {
addExtension(extension);
}
return this;
} | java | public Weld extensions(Extension... extensions) {
this.extensions.clear();
for (Extension extension : extensions) {
addExtension(extension);
}
return this;
} | [
"public",
"Weld",
"extensions",
"(",
"Extension",
"...",
"extensions",
")",
"{",
"this",
".",
"extensions",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Extension",
"extension",
":",
"extensions",
")",
"{",
"addExtension",
"(",
"extension",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Define the set of extensions.
@param extensions
@return self | [
"Define",
"the",
"set",
"of",
"extensions",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L413-L419 |
163,367 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java | Weld.addExtension | public Weld addExtension(Extension extension) {
extensions.add(new MetadataImpl<Extension>(extension, SYNTHETIC_LOCATION_PREFIX + extension.getClass().getName()));
return this;
} | java | public Weld addExtension(Extension extension) {
extensions.add(new MetadataImpl<Extension>(extension, SYNTHETIC_LOCATION_PREFIX + extension.getClass().getName()));
return this;
} | [
"public",
"Weld",
"addExtension",
"(",
"Extension",
"extension",
")",
"{",
"extensions",
".",
"add",
"(",
"new",
"MetadataImpl",
"<",
"Extension",
">",
"(",
"extension",
",",
"SYNTHETIC_LOCATION_PREFIX",
"+",
"extension",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add an extension to the set of extensions.
@param extension an extension | [
"Add",
"an",
"extension",
"to",
"the",
"set",
"of",
"extensions",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L426-L429 |
163,368 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java | Weld.property | public Weld property(String key, Object value) {
properties.put(key, value);
return this;
} | java | public Weld property(String key, Object value) {
properties.put(key, value);
return this;
} | [
"public",
"Weld",
"property",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"properties",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Set the configuration property.
@param key
@param value
@return self
@see #ARCHIVE_ISOLATION_SYSTEM_PROPERTY
@see #SHUTDOWN_HOOK_SYSTEM_PROPERTY
@see #DEV_MODE_SYSTEM_PROPERTY
@see ConfigurationKey | [
"Set",
"the",
"configuration",
"property",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L626-L629 |
163,369 | weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java | Weld.addBeanDefiningAnnotations | public Weld addBeanDefiningAnnotations(Class<? extends Annotation>... annotations) {
for (Class<? extends Annotation> annotation : annotations) {
this.extendedBeanDefiningAnnotations.add(annotation);
}
return this;
} | java | public Weld addBeanDefiningAnnotations(Class<? extends Annotation>... annotations) {
for (Class<? extends Annotation> annotation : annotations) {
this.extendedBeanDefiningAnnotations.add(annotation);
}
return this;
} | [
"public",
"Weld",
"addBeanDefiningAnnotations",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"...",
"annotations",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
":",
"annotations",
")",
"{",
"this",
".",
"extendedBeanDefiningAnnotations",
".",
"add",
"(",
"annotation",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Registers annotations which will be considered as bean defining annotations.
NOTE - If used along with {@code <trim/>} bean archives and/or with Weld configuration key
{@code org.jboss.weld.bootstrap.vetoTypesWithoutBeanDefiningAnnotation}, these annotations will be ignored.
@param annotations annotations which will be considered as Bean Defining Annotations.
@return self | [
"Registers",
"annotations",
"which",
"will",
"be",
"considered",
"as",
"bean",
"defining",
"annotations",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L902-L907 |
163,370 | weld/core | impl/src/main/java/org/jboss/weld/annotated/AnnotatedTypeValidator.java | AnnotatedTypeValidator.checkSensibility | private static void checkSensibility(AnnotatedType<?> type) {
// check if it has a constructor
if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) {
MetadataLogger.LOG.noConstructor(type);
}
Set<Class<?>> hierarchy = new HashSet<Class<?>>();
for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) {
hierarchy.add(clazz);
hierarchy.addAll(Reflections.getInterfaceClosure(clazz));
}
checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type);
checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type);
checkMembersBelongToHierarchy(type.getFields(), hierarchy, type);
} | java | private static void checkSensibility(AnnotatedType<?> type) {
// check if it has a constructor
if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) {
MetadataLogger.LOG.noConstructor(type);
}
Set<Class<?>> hierarchy = new HashSet<Class<?>>();
for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) {
hierarchy.add(clazz);
hierarchy.addAll(Reflections.getInterfaceClosure(clazz));
}
checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type);
checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type);
checkMembersBelongToHierarchy(type.getFields(), hierarchy, type);
} | [
"private",
"static",
"void",
"checkSensibility",
"(",
"AnnotatedType",
"<",
"?",
">",
"type",
")",
"{",
"// check if it has a constructor",
"if",
"(",
"type",
".",
"getConstructors",
"(",
")",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"type",
".",
"getJavaClass",
"(",
")",
".",
"isInterface",
"(",
")",
")",
"{",
"MetadataLogger",
".",
"LOG",
".",
"noConstructor",
"(",
"type",
")",
";",
"}",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"hierarchy",
"=",
"new",
"HashSet",
"<",
"Class",
"<",
"?",
">",
">",
"(",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"clazz",
"=",
"type",
".",
"getJavaClass",
"(",
")",
";",
"clazz",
"!=",
"null",
";",
"clazz",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
")",
"{",
"hierarchy",
".",
"add",
"(",
"clazz",
")",
";",
"hierarchy",
".",
"addAll",
"(",
"Reflections",
".",
"getInterfaceClosure",
"(",
"clazz",
")",
")",
";",
"}",
"checkMembersBelongToHierarchy",
"(",
"type",
".",
"getConstructors",
"(",
")",
",",
"hierarchy",
",",
"type",
")",
";",
"checkMembersBelongToHierarchy",
"(",
"type",
".",
"getMethods",
"(",
")",
",",
"hierarchy",
",",
"type",
")",
";",
"checkMembersBelongToHierarchy",
"(",
"type",
".",
"getFields",
"(",
")",
",",
"hierarchy",
",",
"type",
")",
";",
"}"
] | Checks if the given AnnotatedType is sensible, otherwise provides warnings. | [
"Checks",
"if",
"the",
"given",
"AnnotatedType",
"is",
"sensible",
"otherwise",
"provides",
"warnings",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/annotated/AnnotatedTypeValidator.java#L79-L93 |
163,371 | weld/core | impl/src/main/java/org/jboss/weld/interceptor/proxy/AbstractInvocationContext.java | AbstractInvocationContext.isWideningPrimitive | private static boolean isWideningPrimitive(Class<?> argumentClass, Class<?> targetClass) {
return WIDENING_TABLE.containsKey(argumentClass) && WIDENING_TABLE.get(argumentClass).contains(targetClass);
} | java | private static boolean isWideningPrimitive(Class<?> argumentClass, Class<?> targetClass) {
return WIDENING_TABLE.containsKey(argumentClass) && WIDENING_TABLE.get(argumentClass).contains(targetClass);
} | [
"private",
"static",
"boolean",
"isWideningPrimitive",
"(",
"Class",
"<",
"?",
">",
"argumentClass",
",",
"Class",
"<",
"?",
">",
"targetClass",
")",
"{",
"return",
"WIDENING_TABLE",
".",
"containsKey",
"(",
"argumentClass",
")",
"&&",
"WIDENING_TABLE",
".",
"get",
"(",
"argumentClass",
")",
".",
"contains",
"(",
"targetClass",
")",
";",
"}"
] | Checks that the targetClass is widening the argument class
@param argumentClass
@param targetClass
@return | [
"Checks",
"that",
"the",
"targetClass",
"is",
"widening",
"the",
"argument",
"class"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/interceptor/proxy/AbstractInvocationContext.java#L114-L116 |
163,372 | weld/core | impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java | AnnotatedTypes.createTypeId | public static <X> String createTypeId(AnnotatedType<X> annotatedType) {
String id = createTypeId(annotatedType.getJavaClass(), annotatedType.getAnnotations(), annotatedType.getMethods(), annotatedType.getFields(), annotatedType.getConstructors());
String hash = hash(id);
MetadataLogger.LOG.tracef("Generated AnnotatedType id hash for %s: %s", id, hash);
return hash;
} | java | public static <X> String createTypeId(AnnotatedType<X> annotatedType) {
String id = createTypeId(annotatedType.getJavaClass(), annotatedType.getAnnotations(), annotatedType.getMethods(), annotatedType.getFields(), annotatedType.getConstructors());
String hash = hash(id);
MetadataLogger.LOG.tracef("Generated AnnotatedType id hash for %s: %s", id, hash);
return hash;
} | [
"public",
"static",
"<",
"X",
">",
"String",
"createTypeId",
"(",
"AnnotatedType",
"<",
"X",
">",
"annotatedType",
")",
"{",
"String",
"id",
"=",
"createTypeId",
"(",
"annotatedType",
".",
"getJavaClass",
"(",
")",
",",
"annotatedType",
".",
"getAnnotations",
"(",
")",
",",
"annotatedType",
".",
"getMethods",
"(",
")",
",",
"annotatedType",
".",
"getFields",
"(",
")",
",",
"annotatedType",
".",
"getConstructors",
"(",
")",
")",
";",
"String",
"hash",
"=",
"hash",
"(",
"id",
")",
";",
"MetadataLogger",
".",
"LOG",
".",
"tracef",
"(",
"\"Generated AnnotatedType id hash for %s: %s\"",
",",
"id",
",",
"hash",
")",
";",
"return",
"hash",
";",
"}"
] | Generates a unique signature for an annotated type. Members without
annotations are omitted to reduce the length of the signature
@param <X>
@param annotatedType
@return hash of a signature for a concrete annotated type | [
"Generates",
"a",
"unique",
"signature",
"for",
"an",
"annotated",
"type",
".",
"Members",
"without",
"annotations",
"are",
"omitted",
"to",
"reduce",
"the",
"length",
"of",
"the",
"signature"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L218-L223 |
163,373 | weld/core | impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java | AnnotatedTypes.compareAnnotatedParameters | public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) {
return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2);
} | java | public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) {
return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2);
} | [
"public",
"static",
"boolean",
"compareAnnotatedParameters",
"(",
"AnnotatedParameter",
"<",
"?",
">",
"p1",
",",
"AnnotatedParameter",
"<",
"?",
">",
"p2",
")",
"{",
"return",
"compareAnnotatedCallable",
"(",
"p1",
".",
"getDeclaringCallable",
"(",
")",
",",
"p2",
".",
"getDeclaringCallable",
"(",
")",
")",
"&&",
"p1",
".",
"getPosition",
"(",
")",
"==",
"p2",
".",
"getPosition",
"(",
")",
"&&",
"compareAnnotated",
"(",
"p1",
",",
"p2",
")",
";",
"}"
] | Compares two annotated parameters and returns true if they are equal | [
"Compares",
"two",
"annotated",
"parameters",
"and",
"returns",
"true",
"if",
"they",
"are",
"equal"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L450-L452 |
163,374 | weld/core | impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java | AnnotatedTypes.compareAnnotatedTypes | public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2) {
if (!t1.getJavaClass().equals(t2.getJavaClass())) {
return false;
}
if (!compareAnnotated(t1, t2)) {
return false;
}
if (t1.getFields().size() != t2.getFields().size()) {
return false;
}
Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>();
for (AnnotatedField<?> f : t2.getFields()) {
fields.put(f.getJavaMember(), f);
}
for (AnnotatedField<?> f : t1.getFields()) {
if (fields.containsKey(f.getJavaMember())) {
if (!compareAnnotatedField(f, fields.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
if (t1.getMethods().size() != t2.getMethods().size()) {
return false;
}
Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>();
for (AnnotatedMethod<?> f : t2.getMethods()) {
methods.put(f.getJavaMember(), f);
}
for (AnnotatedMethod<?> f : t1.getMethods()) {
if (methods.containsKey(f.getJavaMember())) {
if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
if (t1.getConstructors().size() != t2.getConstructors().size()) {
return false;
}
Map<Constructor<?>, AnnotatedConstructor<?>> constructors = new HashMap<Constructor<?>, AnnotatedConstructor<?>>();
for (AnnotatedConstructor<?> f : t2.getConstructors()) {
constructors.put(f.getJavaMember(), f);
}
for (AnnotatedConstructor<?> f : t1.getConstructors()) {
if (constructors.containsKey(f.getJavaMember())) {
if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
return true;
} | java | public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2) {
if (!t1.getJavaClass().equals(t2.getJavaClass())) {
return false;
}
if (!compareAnnotated(t1, t2)) {
return false;
}
if (t1.getFields().size() != t2.getFields().size()) {
return false;
}
Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>();
for (AnnotatedField<?> f : t2.getFields()) {
fields.put(f.getJavaMember(), f);
}
for (AnnotatedField<?> f : t1.getFields()) {
if (fields.containsKey(f.getJavaMember())) {
if (!compareAnnotatedField(f, fields.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
if (t1.getMethods().size() != t2.getMethods().size()) {
return false;
}
Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>();
for (AnnotatedMethod<?> f : t2.getMethods()) {
methods.put(f.getJavaMember(), f);
}
for (AnnotatedMethod<?> f : t1.getMethods()) {
if (methods.containsKey(f.getJavaMember())) {
if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
if (t1.getConstructors().size() != t2.getConstructors().size()) {
return false;
}
Map<Constructor<?>, AnnotatedConstructor<?>> constructors = new HashMap<Constructor<?>, AnnotatedConstructor<?>>();
for (AnnotatedConstructor<?> f : t2.getConstructors()) {
constructors.put(f.getJavaMember(), f);
}
for (AnnotatedConstructor<?> f : t1.getConstructors()) {
if (constructors.containsKey(f.getJavaMember())) {
if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember()))) {
return false;
}
} else {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"compareAnnotatedTypes",
"(",
"AnnotatedType",
"<",
"?",
">",
"t1",
",",
"AnnotatedType",
"<",
"?",
">",
"t2",
")",
"{",
"if",
"(",
"!",
"t1",
".",
"getJavaClass",
"(",
")",
".",
"equals",
"(",
"t2",
".",
"getJavaClass",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"compareAnnotated",
"(",
"t1",
",",
"t2",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"t1",
".",
"getFields",
"(",
")",
".",
"size",
"(",
")",
"!=",
"t2",
".",
"getFields",
"(",
")",
".",
"size",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Map",
"<",
"Field",
",",
"AnnotatedField",
"<",
"?",
">",
">",
"fields",
"=",
"new",
"HashMap",
"<",
"Field",
",",
"AnnotatedField",
"<",
"?",
">",
">",
"(",
")",
";",
"for",
"(",
"AnnotatedField",
"<",
"?",
">",
"f",
":",
"t2",
".",
"getFields",
"(",
")",
")",
"{",
"fields",
".",
"put",
"(",
"f",
".",
"getJavaMember",
"(",
")",
",",
"f",
")",
";",
"}",
"for",
"(",
"AnnotatedField",
"<",
"?",
">",
"f",
":",
"t1",
".",
"getFields",
"(",
")",
")",
"{",
"if",
"(",
"fields",
".",
"containsKey",
"(",
"f",
".",
"getJavaMember",
"(",
")",
")",
")",
"{",
"if",
"(",
"!",
"compareAnnotatedField",
"(",
"f",
",",
"fields",
".",
"get",
"(",
"f",
".",
"getJavaMember",
"(",
")",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"t1",
".",
"getMethods",
"(",
")",
".",
"size",
"(",
")",
"!=",
"t2",
".",
"getMethods",
"(",
")",
".",
"size",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Map",
"<",
"Method",
",",
"AnnotatedMethod",
"<",
"?",
">",
">",
"methods",
"=",
"new",
"HashMap",
"<",
"Method",
",",
"AnnotatedMethod",
"<",
"?",
">",
">",
"(",
")",
";",
"for",
"(",
"AnnotatedMethod",
"<",
"?",
">",
"f",
":",
"t2",
".",
"getMethods",
"(",
")",
")",
"{",
"methods",
".",
"put",
"(",
"f",
".",
"getJavaMember",
"(",
")",
",",
"f",
")",
";",
"}",
"for",
"(",
"AnnotatedMethod",
"<",
"?",
">",
"f",
":",
"t1",
".",
"getMethods",
"(",
")",
")",
"{",
"if",
"(",
"methods",
".",
"containsKey",
"(",
"f",
".",
"getJavaMember",
"(",
")",
")",
")",
"{",
"if",
"(",
"!",
"compareAnnotatedCallable",
"(",
"f",
",",
"methods",
".",
"get",
"(",
"f",
".",
"getJavaMember",
"(",
")",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"if",
"(",
"t1",
".",
"getConstructors",
"(",
")",
".",
"size",
"(",
")",
"!=",
"t2",
".",
"getConstructors",
"(",
")",
".",
"size",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Map",
"<",
"Constructor",
"<",
"?",
">",
",",
"AnnotatedConstructor",
"<",
"?",
">",
">",
"constructors",
"=",
"new",
"HashMap",
"<",
"Constructor",
"<",
"?",
">",
",",
"AnnotatedConstructor",
"<",
"?",
">",
">",
"(",
")",
";",
"for",
"(",
"AnnotatedConstructor",
"<",
"?",
">",
"f",
":",
"t2",
".",
"getConstructors",
"(",
")",
")",
"{",
"constructors",
".",
"put",
"(",
"f",
".",
"getJavaMember",
"(",
")",
",",
"f",
")",
";",
"}",
"for",
"(",
"AnnotatedConstructor",
"<",
"?",
">",
"f",
":",
"t1",
".",
"getConstructors",
"(",
")",
")",
"{",
"if",
"(",
"constructors",
".",
"containsKey",
"(",
"f",
".",
"getJavaMember",
"(",
")",
")",
")",
"{",
"if",
"(",
"!",
"compareAnnotatedCallable",
"(",
"f",
",",
"constructors",
".",
"get",
"(",
"f",
".",
"getJavaMember",
"(",
")",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Compares two annotated types and returns true if they are the same | [
"Compares",
"two",
"annotated",
"types",
"and",
"returns",
"true",
"if",
"they",
"are",
"the",
"same"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L474-L533 |
163,375 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.isPassivatingScope | public static boolean isPassivatingScope(Bean<?> bean, BeanManagerImpl manager) {
if (bean == null) {
return false;
} else {
return manager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isPassivating();
}
} | java | public static boolean isPassivatingScope(Bean<?> bean, BeanManagerImpl manager) {
if (bean == null) {
return false;
} else {
return manager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isPassivating();
}
} | [
"public",
"static",
"boolean",
"isPassivatingScope",
"(",
"Bean",
"<",
"?",
">",
"bean",
",",
"BeanManagerImpl",
"manager",
")",
"{",
"if",
"(",
"bean",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"manager",
".",
"getServices",
"(",
")",
".",
"get",
"(",
"MetaAnnotationStore",
".",
"class",
")",
".",
"getScopeModel",
"(",
"bean",
".",
"getScope",
"(",
")",
")",
".",
"isPassivating",
"(",
")",
";",
"}",
"}"
] | Indicates if a bean's scope type is passivating
@param bean The bean to inspect
@return True if the scope is passivating, false otherwise | [
"Indicates",
"if",
"a",
"bean",
"s",
"scope",
"type",
"is",
"passivating"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L115-L121 |
163,376 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.isBeanProxyable | public static boolean isBeanProxyable(Bean<?> bean, BeanManagerImpl manager) {
if (bean instanceof RIBean<?>) {
return ((RIBean<?>) bean).isProxyable();
} else {
return Proxies.isTypesProxyable(bean.getTypes(), manager.getServices());
}
} | java | public static boolean isBeanProxyable(Bean<?> bean, BeanManagerImpl manager) {
if (bean instanceof RIBean<?>) {
return ((RIBean<?>) bean).isProxyable();
} else {
return Proxies.isTypesProxyable(bean.getTypes(), manager.getServices());
}
} | [
"public",
"static",
"boolean",
"isBeanProxyable",
"(",
"Bean",
"<",
"?",
">",
"bean",
",",
"BeanManagerImpl",
"manager",
")",
"{",
"if",
"(",
"bean",
"instanceof",
"RIBean",
"<",
"?",
">",
")",
"{",
"return",
"(",
"(",
"RIBean",
"<",
"?",
">",
")",
"bean",
")",
".",
"isProxyable",
"(",
")",
";",
"}",
"else",
"{",
"return",
"Proxies",
".",
"isTypesProxyable",
"(",
"bean",
".",
"getTypes",
"(",
")",
",",
"manager",
".",
"getServices",
"(",
")",
")",
";",
"}",
"}"
] | Indicates if a bean is proxyable
@param bean The bean to test
@return True if proxyable, false otherwise | [
"Indicates",
"if",
"a",
"bean",
"is",
"proxyable"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L156-L162 |
163,377 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.containsAllQualifiers | public static boolean containsAllQualifiers(Set<QualifierInstance> requiredQualifiers, Set<QualifierInstance> qualifiers) {
return qualifiers.containsAll(requiredQualifiers);
} | java | public static boolean containsAllQualifiers(Set<QualifierInstance> requiredQualifiers, Set<QualifierInstance> qualifiers) {
return qualifiers.containsAll(requiredQualifiers);
} | [
"public",
"static",
"boolean",
"containsAllQualifiers",
"(",
"Set",
"<",
"QualifierInstance",
">",
"requiredQualifiers",
",",
"Set",
"<",
"QualifierInstance",
">",
"qualifiers",
")",
"{",
"return",
"qualifiers",
".",
"containsAll",
"(",
"requiredQualifiers",
")",
";",
"}"
] | Checks that all the qualifiers in the set requiredQualifiers are in the set of qualifiers. Qualifier equality rules for
annotation members are followed.
@param requiredQualifiers The required qualifiers
@param qualifiers The set of qualifiers to check
@return True if all matches, false otherwise | [
"Checks",
"that",
"all",
"the",
"qualifiers",
"in",
"the",
"set",
"requiredQualifiers",
"are",
"in",
"the",
"set",
"of",
"qualifiers",
".",
"Qualifier",
"equality",
"rules",
"for",
"annotation",
"members",
"are",
"followed",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L194-L196 |
163,378 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.removeDisabledBeans | public static <T extends Bean<?>> Set<T> removeDisabledBeans(Set<T> beans, final BeanManagerImpl beanManager) {
if (beans.isEmpty()) {
return beans;
} else {
for (Iterator<T> iterator = beans.iterator(); iterator.hasNext();) {
if (!isBeanEnabled(iterator.next(), beanManager.getEnabled())) {
iterator.remove();
}
}
return beans;
}
} | java | public static <T extends Bean<?>> Set<T> removeDisabledBeans(Set<T> beans, final BeanManagerImpl beanManager) {
if (beans.isEmpty()) {
return beans;
} else {
for (Iterator<T> iterator = beans.iterator(); iterator.hasNext();) {
if (!isBeanEnabled(iterator.next(), beanManager.getEnabled())) {
iterator.remove();
}
}
return beans;
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Bean",
"<",
"?",
">",
">",
"Set",
"<",
"T",
">",
"removeDisabledBeans",
"(",
"Set",
"<",
"T",
">",
"beans",
",",
"final",
"BeanManagerImpl",
"beanManager",
")",
"{",
"if",
"(",
"beans",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"beans",
";",
"}",
"else",
"{",
"for",
"(",
"Iterator",
"<",
"T",
">",
"iterator",
"=",
"beans",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"if",
"(",
"!",
"isBeanEnabled",
"(",
"iterator",
".",
"next",
"(",
")",
",",
"beanManager",
".",
"getEnabled",
"(",
")",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"}",
"}",
"return",
"beans",
";",
"}",
"}"
] | Retains only beans which are enabled.
@param beans The mutable set of beans to filter
@param beanManager The bean manager
@return a mutable set of enabled beans | [
"Retains",
"only",
"beans",
"which",
"are",
"enabled",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L211-L222 |
163,379 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.isAlternative | public static boolean isAlternative(EnhancedAnnotated<?, ?> annotated, MergedStereotypes<?, ?> mergedStereotypes) {
return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative();
} | java | public static boolean isAlternative(EnhancedAnnotated<?, ?> annotated, MergedStereotypes<?, ?> mergedStereotypes) {
return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative();
} | [
"public",
"static",
"boolean",
"isAlternative",
"(",
"EnhancedAnnotated",
"<",
"?",
",",
"?",
">",
"annotated",
",",
"MergedStereotypes",
"<",
"?",
",",
"?",
">",
"mergedStereotypes",
")",
"{",
"return",
"annotated",
".",
"isAnnotationPresent",
"(",
"Alternative",
".",
"class",
")",
"||",
"mergedStereotypes",
".",
"isAlternative",
"(",
")",
";",
"}"
] | Is alternative.
@param annotated the annotated
@param mergedStereotypes merged stereotypes
@return true if alternative, false otherwise | [
"Is",
"alternative",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L255-L257 |
163,380 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.injectEEFields | public static <T> void injectEEFields(Iterable<Set<ResourceInjection<?>>> resourceInjectionsHierarchy,
T beanInstance, CreationalContext<T> ctx) {
for (Set<ResourceInjection<?>> resourceInjections : resourceInjectionsHierarchy) {
for (ResourceInjection<?> resourceInjection : resourceInjections) {
resourceInjection.injectResourceReference(beanInstance, ctx);
}
}
} | java | public static <T> void injectEEFields(Iterable<Set<ResourceInjection<?>>> resourceInjectionsHierarchy,
T beanInstance, CreationalContext<T> ctx) {
for (Set<ResourceInjection<?>> resourceInjections : resourceInjectionsHierarchy) {
for (ResourceInjection<?> resourceInjection : resourceInjections) {
resourceInjection.injectResourceReference(beanInstance, ctx);
}
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"injectEEFields",
"(",
"Iterable",
"<",
"Set",
"<",
"ResourceInjection",
"<",
"?",
">",
">",
">",
"resourceInjectionsHierarchy",
",",
"T",
"beanInstance",
",",
"CreationalContext",
"<",
"T",
">",
"ctx",
")",
"{",
"for",
"(",
"Set",
"<",
"ResourceInjection",
"<",
"?",
">",
">",
"resourceInjections",
":",
"resourceInjectionsHierarchy",
")",
"{",
"for",
"(",
"ResourceInjection",
"<",
"?",
">",
"resourceInjection",
":",
"resourceInjections",
")",
"{",
"resourceInjection",
".",
"injectResourceReference",
"(",
"beanInstance",
",",
"ctx",
")",
";",
"}",
"}",
"}"
] | Injects EJBs and other EE resources.
@param resourceInjectionsHierarchy
@param beanInstance
@param ctx | [
"Injects",
"EJBs",
"and",
"other",
"EE",
"resources",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L305-L312 |
163,381 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.getDeclaredBeanType | public static Type getDeclaredBeanType(Class<?> clazz) {
Type[] actualTypeArguments = Reflections.getActualTypeArguments(clazz);
if (actualTypeArguments.length == 1) {
return actualTypeArguments[0];
} else {
return null;
}
} | java | public static Type getDeclaredBeanType(Class<?> clazz) {
Type[] actualTypeArguments = Reflections.getActualTypeArguments(clazz);
if (actualTypeArguments.length == 1) {
return actualTypeArguments[0];
} else {
return null;
}
} | [
"public",
"static",
"Type",
"getDeclaredBeanType",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Type",
"[",
"]",
"actualTypeArguments",
"=",
"Reflections",
".",
"getActualTypeArguments",
"(",
"clazz",
")",
";",
"if",
"(",
"actualTypeArguments",
".",
"length",
"==",
"1",
")",
"{",
"return",
"actualTypeArguments",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Gets the declared bean type
@return The bean type | [
"Gets",
"the",
"declared",
"bean",
"type"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L319-L326 |
163,382 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.injectBoundFields | public static <T> void injectBoundFields(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager,
Iterable<? extends FieldInjectionPoint<?, ?>> injectableFields) {
for (FieldInjectionPoint<?, ?> injectableField : injectableFields) {
injectableField.inject(instance, manager, creationalContext);
}
} | java | public static <T> void injectBoundFields(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager,
Iterable<? extends FieldInjectionPoint<?, ?>> injectableFields) {
for (FieldInjectionPoint<?, ?> injectableField : injectableFields) {
injectableField.inject(instance, manager, creationalContext);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"injectBoundFields",
"(",
"T",
"instance",
",",
"CreationalContext",
"<",
"T",
">",
"creationalContext",
",",
"BeanManagerImpl",
"manager",
",",
"Iterable",
"<",
"?",
"extends",
"FieldInjectionPoint",
"<",
"?",
",",
"?",
">",
">",
"injectableFields",
")",
"{",
"for",
"(",
"FieldInjectionPoint",
"<",
"?",
",",
"?",
">",
"injectableField",
":",
"injectableFields",
")",
"{",
"injectableField",
".",
"inject",
"(",
"instance",
",",
"manager",
",",
"creationalContext",
")",
";",
"}",
"}"
] | Injects bound fields
@param instance The instance to inject into | [
"Injects",
"bound",
"fields"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L333-L338 |
163,383 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.callInitializers | public static <T> void callInitializers(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager,
Iterable<? extends MethodInjectionPoint<?, ?>> initializerMethods) {
for (MethodInjectionPoint<?, ?> initializer : initializerMethods) {
initializer.invoke(instance, null, manager, creationalContext, CreationException.class);
}
} | java | public static <T> void callInitializers(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager,
Iterable<? extends MethodInjectionPoint<?, ?>> initializerMethods) {
for (MethodInjectionPoint<?, ?> initializer : initializerMethods) {
initializer.invoke(instance, null, manager, creationalContext, CreationException.class);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"callInitializers",
"(",
"T",
"instance",
",",
"CreationalContext",
"<",
"T",
">",
"creationalContext",
",",
"BeanManagerImpl",
"manager",
",",
"Iterable",
"<",
"?",
"extends",
"MethodInjectionPoint",
"<",
"?",
",",
"?",
">",
">",
"initializerMethods",
")",
"{",
"for",
"(",
"MethodInjectionPoint",
"<",
"?",
",",
"?",
">",
"initializer",
":",
"initializerMethods",
")",
"{",
"initializer",
".",
"invoke",
"(",
"instance",
",",
"null",
",",
"manager",
",",
"creationalContext",
",",
"CreationException",
".",
"class",
")",
";",
"}",
"}"
] | Calls all initializers of the bean
@param instance The bean instance | [
"Calls",
"all",
"initializers",
"of",
"the",
"bean"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L357-L362 |
163,384 | weld/core | impl/src/main/java/org/jboss/weld/util/Beans.java | Beans.isTypeManagedBeanOrDecoratorOrInterceptor | public static boolean isTypeManagedBeanOrDecoratorOrInterceptor(AnnotatedType<?> annotatedType) {
Class<?> javaClass = annotatedType.getJavaClass();
return !javaClass.isEnum() && !Extension.class.isAssignableFrom(javaClass)
&& Reflections.isTopLevelOrStaticNestedClass(javaClass) && !Reflections.isParameterizedTypeWithWildcard(javaClass)
&& hasSimpleCdiConstructor(annotatedType);
} | java | public static boolean isTypeManagedBeanOrDecoratorOrInterceptor(AnnotatedType<?> annotatedType) {
Class<?> javaClass = annotatedType.getJavaClass();
return !javaClass.isEnum() && !Extension.class.isAssignableFrom(javaClass)
&& Reflections.isTopLevelOrStaticNestedClass(javaClass) && !Reflections.isParameterizedTypeWithWildcard(javaClass)
&& hasSimpleCdiConstructor(annotatedType);
} | [
"public",
"static",
"boolean",
"isTypeManagedBeanOrDecoratorOrInterceptor",
"(",
"AnnotatedType",
"<",
"?",
">",
"annotatedType",
")",
"{",
"Class",
"<",
"?",
">",
"javaClass",
"=",
"annotatedType",
".",
"getJavaClass",
"(",
")",
";",
"return",
"!",
"javaClass",
".",
"isEnum",
"(",
")",
"&&",
"!",
"Extension",
".",
"class",
".",
"isAssignableFrom",
"(",
"javaClass",
")",
"&&",
"Reflections",
".",
"isTopLevelOrStaticNestedClass",
"(",
"javaClass",
")",
"&&",
"!",
"Reflections",
".",
"isParameterizedTypeWithWildcard",
"(",
"javaClass",
")",
"&&",
"hasSimpleCdiConstructor",
"(",
"annotatedType",
")",
";",
"}"
] | Indicates if the type is a simple Web Bean
@param clazz The type to inspect
@return True if simple Web Bean, false otherwise | [
"Indicates",
"if",
"the",
"type",
"is",
"a",
"simple",
"Web",
"Bean"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L445-L450 |
163,385 | weld/core | modules/ejb/src/main/java/org/jboss/weld/module/ejb/NewSessionBean.java | NewSessionBean.of | public static <T> NewSessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager) {
EnhancedAnnotatedType<T> type = beanManager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(ejbDescriptor.getBeanClass(), beanManager.getId());
return new NewSessionBean<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(SessionBeans.createIdentifierForNew(ejbDescriptor)), beanManager);
} | java | public static <T> NewSessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager) {
EnhancedAnnotatedType<T> type = beanManager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(ejbDescriptor.getBeanClass(), beanManager.getId());
return new NewSessionBean<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(SessionBeans.createIdentifierForNew(ejbDescriptor)), beanManager);
} | [
"public",
"static",
"<",
"T",
">",
"NewSessionBean",
"<",
"T",
">",
"of",
"(",
"BeanAttributes",
"<",
"T",
">",
"attributes",
",",
"InternalEjbDescriptor",
"<",
"T",
">",
"ejbDescriptor",
",",
"BeanManagerImpl",
"beanManager",
")",
"{",
"EnhancedAnnotatedType",
"<",
"T",
">",
"type",
"=",
"beanManager",
".",
"getServices",
"(",
")",
".",
"get",
"(",
"ClassTransformer",
".",
"class",
")",
".",
"getEnhancedAnnotatedType",
"(",
"ejbDescriptor",
".",
"getBeanClass",
"(",
")",
",",
"beanManager",
".",
"getId",
"(",
")",
")",
";",
"return",
"new",
"NewSessionBean",
"<",
"T",
">",
"(",
"attributes",
",",
"type",
",",
"ejbDescriptor",
",",
"new",
"StringBeanIdentifier",
"(",
"SessionBeans",
".",
"createIdentifierForNew",
"(",
"ejbDescriptor",
")",
")",
",",
"beanManager",
")",
";",
"}"
] | Creates an instance of a NewEnterpriseBean from an annotated class
@param clazz The annotated class
@param beanManager The Bean manager
@return a new NewEnterpriseBean instance | [
"Creates",
"an",
"instance",
"of",
"a",
"NewEnterpriseBean",
"from",
"an",
"annotated",
"class"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/NewSessionBean.java#L42-L45 |
163,386 | weld/core | impl/src/main/java/org/jboss/weld/bean/ProducerField.java | ProducerField.of | public static <X, T> ProducerField<X, T> of(BeanAttributes<T> attributes, EnhancedAnnotatedField<T, ? super X> field, AbstractClassBean<X> declaringBean, DisposalMethod<X, ?> disposalMethod, BeanManagerImpl beanManager, ServiceRegistry services) {
return new ProducerField<X, T>(attributes, field, declaringBean, disposalMethod, beanManager, services);
} | java | public static <X, T> ProducerField<X, T> of(BeanAttributes<T> attributes, EnhancedAnnotatedField<T, ? super X> field, AbstractClassBean<X> declaringBean, DisposalMethod<X, ?> disposalMethod, BeanManagerImpl beanManager, ServiceRegistry services) {
return new ProducerField<X, T>(attributes, field, declaringBean, disposalMethod, beanManager, services);
} | [
"public",
"static",
"<",
"X",
",",
"T",
">",
"ProducerField",
"<",
"X",
",",
"T",
">",
"of",
"(",
"BeanAttributes",
"<",
"T",
">",
"attributes",
",",
"EnhancedAnnotatedField",
"<",
"T",
",",
"?",
"super",
"X",
">",
"field",
",",
"AbstractClassBean",
"<",
"X",
">",
"declaringBean",
",",
"DisposalMethod",
"<",
"X",
",",
"?",
">",
"disposalMethod",
",",
"BeanManagerImpl",
"beanManager",
",",
"ServiceRegistry",
"services",
")",
"{",
"return",
"new",
"ProducerField",
"<",
"X",
",",
"T",
">",
"(",
"attributes",
",",
"field",
",",
"declaringBean",
",",
"disposalMethod",
",",
"beanManager",
",",
"services",
")",
";",
"}"
] | Creates a producer field
@param field The underlying method abstraction
@param declaringBean The declaring bean abstraction
@param beanManager the current manager
@return A producer field | [
"Creates",
"a",
"producer",
"field"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ProducerField.java#L55-L57 |
163,387 | weld/core | impl/src/main/java/org/jboss/weld/util/Permissions.java | Permissions.hasPermission | public static boolean hasPermission(Permission permission) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
try {
security.checkPermission(permission);
} catch (java.security.AccessControlException e) {
return false;
}
}
return true;
} | java | public static boolean hasPermission(Permission permission) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
try {
security.checkPermission(permission);
} catch (java.security.AccessControlException e) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"hasPermission",
"(",
"Permission",
"permission",
")",
"{",
"SecurityManager",
"security",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"security",
"!=",
"null",
")",
"{",
"try",
"{",
"security",
".",
"checkPermission",
"(",
"permission",
")",
";",
"}",
"catch",
"(",
"java",
".",
"security",
".",
"AccessControlException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Determines whether the specified permission is permitted.
@param permission
@return <tt>false<tt> if the specified permission is not permitted, based on the current security policy; <tt>true<tt> otherwise | [
"Determines",
"whether",
"the",
"specified",
"permission",
"is",
"permitted",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Permissions.java#L39-L49 |
163,388 | weld/core | impl/src/main/java/org/jboss/weld/bean/ManagedBean.java | ManagedBean.of | public static <T> ManagedBean<T> of(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> clazz, BeanManagerImpl beanManager) {
return new ManagedBean<T>(attributes, clazz, createId(attributes, clazz), beanManager);
} | java | public static <T> ManagedBean<T> of(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> clazz, BeanManagerImpl beanManager) {
return new ManagedBean<T>(attributes, clazz, createId(attributes, clazz), beanManager);
} | [
"public",
"static",
"<",
"T",
">",
"ManagedBean",
"<",
"T",
">",
"of",
"(",
"BeanAttributes",
"<",
"T",
">",
"attributes",
",",
"EnhancedAnnotatedType",
"<",
"T",
">",
"clazz",
",",
"BeanManagerImpl",
"beanManager",
")",
"{",
"return",
"new",
"ManagedBean",
"<",
"T",
">",
"(",
"attributes",
",",
"clazz",
",",
"createId",
"(",
"attributes",
",",
"clazz",
")",
",",
"beanManager",
")",
";",
"}"
] | Creates a simple, annotation defined Web Bean
@param <T> The type
@param clazz The class
@param beanManager the current manager
@return A Web Bean | [
"Creates",
"a",
"simple",
"annotation",
"defined",
"Web",
"Bean"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java#L79-L81 |
163,389 | weld/core | impl/src/main/java/org/jboss/weld/bean/ManagedBean.java | ManagedBean.destroy | @Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
super.destroy(instance, creationalContext);
try {
getProducer().preDestroy(instance);
// WELD-1010 hack?
if (creationalContext instanceof CreationalContextImpl) {
((CreationalContextImpl<T>) creationalContext).release(this, instance);
} else {
creationalContext.release();
}
} catch (Exception e) {
BeanLogger.LOG.errorDestroying(instance, this);
BeanLogger.LOG.catchingDebug(e);
}
} | java | @Override
public void destroy(T instance, CreationalContext<T> creationalContext) {
super.destroy(instance, creationalContext);
try {
getProducer().preDestroy(instance);
// WELD-1010 hack?
if (creationalContext instanceof CreationalContextImpl) {
((CreationalContextImpl<T>) creationalContext).release(this, instance);
} else {
creationalContext.release();
}
} catch (Exception e) {
BeanLogger.LOG.errorDestroying(instance, this);
BeanLogger.LOG.catchingDebug(e);
}
} | [
"@",
"Override",
"public",
"void",
"destroy",
"(",
"T",
"instance",
",",
"CreationalContext",
"<",
"T",
">",
"creationalContext",
")",
"{",
"super",
".",
"destroy",
"(",
"instance",
",",
"creationalContext",
")",
";",
"try",
"{",
"getProducer",
"(",
")",
".",
"preDestroy",
"(",
"instance",
")",
";",
"// WELD-1010 hack?",
"if",
"(",
"creationalContext",
"instanceof",
"CreationalContextImpl",
")",
"{",
"(",
"(",
"CreationalContextImpl",
"<",
"T",
">",
")",
"creationalContext",
")",
".",
"release",
"(",
"this",
",",
"instance",
")",
";",
"}",
"else",
"{",
"creationalContext",
".",
"release",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"BeanLogger",
".",
"LOG",
".",
"errorDestroying",
"(",
"instance",
",",
"this",
")",
";",
"BeanLogger",
".",
"LOG",
".",
"catchingDebug",
"(",
"e",
")",
";",
"}",
"}"
] | Destroys an instance of the bean
@param instance The instance | [
"Destroys",
"an",
"instance",
"of",
"the",
"bean"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java#L188-L203 |
163,390 | weld/core | impl/src/main/java/org/jboss/weld/bean/ManagedBean.java | ManagedBean.checkType | @Override
protected void checkType() {
if (!isDependent() && getEnhancedAnnotated().isParameterizedType()) {
throw BeanLogger.LOG.managedBeanWithParameterizedBeanClassMustBeDependent(type);
}
boolean passivating = beanManager.isPassivatingScope(getScope());
if (passivating && !isPassivationCapableBean()) {
if (!getEnhancedAnnotated().isSerializable()) {
throw BeanLogger.LOG.passivatingBeanNeedsSerializableImpl(this);
} else if (hasDecorators() && !allDecoratorsArePassivationCapable()) {
throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableDecorator(this, getFirstNonPassivationCapableDecorator());
} else if (hasInterceptors() && !allInterceptorsArePassivationCapable()) {
throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableInterceptor(this, getFirstNonPassivationCapableInterceptor());
}
}
} | java | @Override
protected void checkType() {
if (!isDependent() && getEnhancedAnnotated().isParameterizedType()) {
throw BeanLogger.LOG.managedBeanWithParameterizedBeanClassMustBeDependent(type);
}
boolean passivating = beanManager.isPassivatingScope(getScope());
if (passivating && !isPassivationCapableBean()) {
if (!getEnhancedAnnotated().isSerializable()) {
throw BeanLogger.LOG.passivatingBeanNeedsSerializableImpl(this);
} else if (hasDecorators() && !allDecoratorsArePassivationCapable()) {
throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableDecorator(this, getFirstNonPassivationCapableDecorator());
} else if (hasInterceptors() && !allInterceptorsArePassivationCapable()) {
throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableInterceptor(this, getFirstNonPassivationCapableInterceptor());
}
}
} | [
"@",
"Override",
"protected",
"void",
"checkType",
"(",
")",
"{",
"if",
"(",
"!",
"isDependent",
"(",
")",
"&&",
"getEnhancedAnnotated",
"(",
")",
".",
"isParameterizedType",
"(",
")",
")",
"{",
"throw",
"BeanLogger",
".",
"LOG",
".",
"managedBeanWithParameterizedBeanClassMustBeDependent",
"(",
"type",
")",
";",
"}",
"boolean",
"passivating",
"=",
"beanManager",
".",
"isPassivatingScope",
"(",
"getScope",
"(",
")",
")",
";",
"if",
"(",
"passivating",
"&&",
"!",
"isPassivationCapableBean",
"(",
")",
")",
"{",
"if",
"(",
"!",
"getEnhancedAnnotated",
"(",
")",
".",
"isSerializable",
"(",
")",
")",
"{",
"throw",
"BeanLogger",
".",
"LOG",
".",
"passivatingBeanNeedsSerializableImpl",
"(",
"this",
")",
";",
"}",
"else",
"if",
"(",
"hasDecorators",
"(",
")",
"&&",
"!",
"allDecoratorsArePassivationCapable",
"(",
")",
")",
"{",
"throw",
"BeanLogger",
".",
"LOG",
".",
"passivatingBeanHasNonPassivationCapableDecorator",
"(",
"this",
",",
"getFirstNonPassivationCapableDecorator",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"hasInterceptors",
"(",
")",
"&&",
"!",
"allInterceptorsArePassivationCapable",
"(",
")",
")",
"{",
"throw",
"BeanLogger",
".",
"LOG",
".",
"passivatingBeanHasNonPassivationCapableInterceptor",
"(",
"this",
",",
"getFirstNonPassivationCapableInterceptor",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Validates the type | [
"Validates",
"the",
"type"
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java#L208-L223 |
163,391 | weld/core | impl/src/main/java/org/jboss/weld/util/collections/ImmutableSet.java | ImmutableSet.of | @SafeVarargs
public static <T> Set<T> of(T... elements) {
Preconditions.checkNotNull(elements);
return ImmutableSet.<T> builder().addAll(elements).build();
} | java | @SafeVarargs
public static <T> Set<T> of(T... elements) {
Preconditions.checkNotNull(elements);
return ImmutableSet.<T> builder().addAll(elements).build();
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"of",
"(",
"T",
"...",
"elements",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"elements",
")",
";",
"return",
"ImmutableSet",
".",
"<",
"T",
">",
"builder",
"(",
")",
".",
"addAll",
"(",
"elements",
")",
".",
"build",
"(",
")",
";",
"}"
] | Creates a new immutable set that consists of given elements.
@param elements the given elements
@return a new immutable set that consists of given elements | [
"Creates",
"a",
"new",
"immutable",
"set",
"that",
"consists",
"of",
"given",
"elements",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/ImmutableSet.java#L81-L85 |
163,392 | weld/core | impl/src/main/java/org/jboss/weld/bean/proxy/util/SerializableClientProxy.java | SerializableClientProxy.readResolve | Object readResolve() throws ObjectStreamException {
Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId);
if (bean == null) {
throw BeanLogger.LOG.proxyDeserializationFailure(beanId);
}
return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean);
} | java | Object readResolve() throws ObjectStreamException {
Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId);
if (bean == null) {
throw BeanLogger.LOG.proxyDeserializationFailure(beanId);
}
return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean);
} | [
"Object",
"readResolve",
"(",
")",
"throws",
"ObjectStreamException",
"{",
"Bean",
"<",
"?",
">",
"bean",
"=",
"Container",
".",
"instance",
"(",
"contextId",
")",
".",
"services",
"(",
")",
".",
"get",
"(",
"ContextualStore",
".",
"class",
")",
".",
"<",
"Bean",
"<",
"Object",
">",
",",
"Object",
">",
"getContextual",
"(",
"beanId",
")",
";",
"if",
"(",
"bean",
"==",
"null",
")",
"{",
"throw",
"BeanLogger",
".",
"LOG",
".",
"proxyDeserializationFailure",
"(",
"beanId",
")",
";",
"}",
"return",
"Container",
".",
"instance",
"(",
"contextId",
")",
".",
"deploymentManager",
"(",
")",
".",
"getClientProxyProvider",
"(",
")",
".",
"getClientProxy",
"(",
"bean",
")",
";",
"}"
] | Always returns the original proxy object that was serialized.
@return the proxy object
@throws java.io.ObjectStreamException | [
"Always",
"returns",
"the",
"original",
"proxy",
"object",
"that",
"was",
"serialized",
"."
] | 567a2eaf95b168597d23a56be89bf05a7834b2aa | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/util/SerializableClientProxy.java#L57-L63 |
163,393 | GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/AppIdentityOAuthURLFetchService.java | AppIdentityOAuthURLFetchService.getToken | @Override
protected String getToken() {
GetAccessTokenResult token = accessToken.get();
if (token == null || isExpired(token)
|| (isAboutToExpire(token) && refreshInProgress.compareAndSet(false, true))) {
lock.lock();
try {
token = accessToken.get();
if (token == null || isAboutToExpire(token)) {
token = accessTokenProvider.getNewAccessToken(oauthScopes);
accessToken.set(token);
cacheExpirationHeadroom.set(getNextCacheExpirationHeadroom());
}
} finally {
refreshInProgress.set(false);
lock.unlock();
}
}
return token.getAccessToken();
} | java | @Override
protected String getToken() {
GetAccessTokenResult token = accessToken.get();
if (token == null || isExpired(token)
|| (isAboutToExpire(token) && refreshInProgress.compareAndSet(false, true))) {
lock.lock();
try {
token = accessToken.get();
if (token == null || isAboutToExpire(token)) {
token = accessTokenProvider.getNewAccessToken(oauthScopes);
accessToken.set(token);
cacheExpirationHeadroom.set(getNextCacheExpirationHeadroom());
}
} finally {
refreshInProgress.set(false);
lock.unlock();
}
}
return token.getAccessToken();
} | [
"@",
"Override",
"protected",
"String",
"getToken",
"(",
")",
"{",
"GetAccessTokenResult",
"token",
"=",
"accessToken",
".",
"get",
"(",
")",
";",
"if",
"(",
"token",
"==",
"null",
"||",
"isExpired",
"(",
"token",
")",
"||",
"(",
"isAboutToExpire",
"(",
"token",
")",
"&&",
"refreshInProgress",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"token",
"=",
"accessToken",
".",
"get",
"(",
")",
";",
"if",
"(",
"token",
"==",
"null",
"||",
"isAboutToExpire",
"(",
"token",
")",
")",
"{",
"token",
"=",
"accessTokenProvider",
".",
"getNewAccessToken",
"(",
"oauthScopes",
")",
";",
"accessToken",
".",
"set",
"(",
"token",
")",
";",
"cacheExpirationHeadroom",
".",
"set",
"(",
"getNextCacheExpirationHeadroom",
"(",
")",
")",
";",
"}",
"}",
"finally",
"{",
"refreshInProgress",
".",
"set",
"(",
"false",
")",
";",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}",
"return",
"token",
".",
"getAccessToken",
"(",
")",
";",
"}"
] | Attempts to return the token from cache. If this is not possible because it is expired or was
never assigned, a new token is requested and parallel requests will block on retrieving a new
token. As such no guarantee of maximum latency is provided.
To avoid blocking the token is refreshed before it's expiration, while parallel requests
continue to use the old token. | [
"Attempts",
"to",
"return",
"the",
"token",
"from",
"cache",
".",
"If",
"this",
"is",
"not",
"possible",
"because",
"it",
"is",
"expired",
"or",
"was",
"never",
"assigned",
"a",
"new",
"token",
"is",
"requested",
"and",
"parallel",
"requests",
"will",
"block",
"on",
"retrieving",
"a",
"new",
"token",
".",
"As",
"such",
"no",
"guarantee",
"of",
"maximum",
"latency",
"is",
"provided",
"."
] | d11078331ecd915d753c886e96a80133599f3f98 | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/AppIdentityOAuthURLFetchService.java#L76-L95 |
163,394 | GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/GcsOutputChannelImpl.java | GcsOutputChannelImpl.waitForOutstandingRequest | private void waitForOutstandingRequest() throws IOException {
if (outstandingRequest == null) {
return;
}
try {
RetryHelper.runWithRetries(new Callable<Void>() {
@Override
public Void call() throws IOException, InterruptedException {
if (RetryHelper.getContext().getAttemptNumber() > 1) {
outstandingRequest.retry();
}
token = outstandingRequest.waitForNextToken();
outstandingRequest = null;
return null;
}
}, retryParams, GcsServiceImpl.exceptionHandler);
} catch (RetryInterruptedException ex) {
token = null;
throw new ClosedByInterruptException();
} catch (NonRetriableException e) {
Throwables.propagateIfInstanceOf(e.getCause(), IOException.class);
throw e;
}
} | java | private void waitForOutstandingRequest() throws IOException {
if (outstandingRequest == null) {
return;
}
try {
RetryHelper.runWithRetries(new Callable<Void>() {
@Override
public Void call() throws IOException, InterruptedException {
if (RetryHelper.getContext().getAttemptNumber() > 1) {
outstandingRequest.retry();
}
token = outstandingRequest.waitForNextToken();
outstandingRequest = null;
return null;
}
}, retryParams, GcsServiceImpl.exceptionHandler);
} catch (RetryInterruptedException ex) {
token = null;
throw new ClosedByInterruptException();
} catch (NonRetriableException e) {
Throwables.propagateIfInstanceOf(e.getCause(), IOException.class);
throw e;
}
} | [
"private",
"void",
"waitForOutstandingRequest",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"outstandingRequest",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"RetryHelper",
".",
"runWithRetries",
"(",
"new",
"Callable",
"<",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"RetryHelper",
".",
"getContext",
"(",
")",
".",
"getAttemptNumber",
"(",
")",
">",
"1",
")",
"{",
"outstandingRequest",
".",
"retry",
"(",
")",
";",
"}",
"token",
"=",
"outstandingRequest",
".",
"waitForNextToken",
"(",
")",
";",
"outstandingRequest",
"=",
"null",
";",
"return",
"null",
";",
"}",
"}",
",",
"retryParams",
",",
"GcsServiceImpl",
".",
"exceptionHandler",
")",
";",
"}",
"catch",
"(",
"RetryInterruptedException",
"ex",
")",
"{",
"token",
"=",
"null",
";",
"throw",
"new",
"ClosedByInterruptException",
"(",
")",
";",
"}",
"catch",
"(",
"NonRetriableException",
"e",
")",
"{",
"Throwables",
".",
"propagateIfInstanceOf",
"(",
"e",
".",
"getCause",
"(",
")",
",",
"IOException",
".",
"class",
")",
";",
"throw",
"e",
";",
"}",
"}"
] | Waits for the current outstanding request retrying it with exponential backoff if it fails.
@throws ClosedByInterruptException if request was interrupted
@throws IOException In the event of FileNotFoundException, MalformedURLException
@throws RetriesExhaustedException if exceeding the number of retries | [
"Waits",
"for",
"the",
"current",
"outstanding",
"request",
"retrying",
"it",
"with",
"exponential",
"backoff",
"if",
"it",
"fails",
"."
] | d11078331ecd915d753c886e96a80133599f3f98 | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/GcsOutputChannelImpl.java#L224-L247 |
163,395 | GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/URLFetchUtils.java | URLFetchUtils.parseDate | static Date parseDate(String dateString) {
try {
return DATE_FORMAT.parseDateTime(dateString).toDate();
} catch (IllegalArgumentException e) {
return null;
}
} | java | static Date parseDate(String dateString) {
try {
return DATE_FORMAT.parseDateTime(dateString).toDate();
} catch (IllegalArgumentException e) {
return null;
}
} | [
"static",
"Date",
"parseDate",
"(",
"String",
"dateString",
")",
"{",
"try",
"{",
"return",
"DATE_FORMAT",
".",
"parseDateTime",
"(",
"dateString",
")",
".",
"toDate",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Parses the date or returns null if it fails to do so. | [
"Parses",
"the",
"date",
"or",
"returns",
"null",
"if",
"it",
"fails",
"to",
"do",
"so",
"."
] | d11078331ecd915d753c886e96a80133599f3f98 | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/URLFetchUtils.java#L121-L127 |
163,396 | GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/dev/LocalRawGcsService.java | LocalRawGcsService.continueObjectCreationAsync | @Override
public Future<RawGcsCreationToken> continueObjectCreationAsync(final RawGcsCreationToken token,
final ByteBuffer chunk, long timeoutMillis) {
try {
ensureInitialized();
} catch (IOException e) {
throw new RuntimeException(e);
}
final Environment environment = ApiProxy.getCurrentEnvironment();
return writePool.schedule(new Callable<RawGcsCreationToken>() {
@Override
public RawGcsCreationToken call() throws Exception {
ApiProxy.setEnvironmentForCurrentThread(environment);
return append(token, chunk);
}
}, 50, TimeUnit.MILLISECONDS);
} | java | @Override
public Future<RawGcsCreationToken> continueObjectCreationAsync(final RawGcsCreationToken token,
final ByteBuffer chunk, long timeoutMillis) {
try {
ensureInitialized();
} catch (IOException e) {
throw new RuntimeException(e);
}
final Environment environment = ApiProxy.getCurrentEnvironment();
return writePool.schedule(new Callable<RawGcsCreationToken>() {
@Override
public RawGcsCreationToken call() throws Exception {
ApiProxy.setEnvironmentForCurrentThread(environment);
return append(token, chunk);
}
}, 50, TimeUnit.MILLISECONDS);
} | [
"@",
"Override",
"public",
"Future",
"<",
"RawGcsCreationToken",
">",
"continueObjectCreationAsync",
"(",
"final",
"RawGcsCreationToken",
"token",
",",
"final",
"ByteBuffer",
"chunk",
",",
"long",
"timeoutMillis",
")",
"{",
"try",
"{",
"ensureInitialized",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"final",
"Environment",
"environment",
"=",
"ApiProxy",
".",
"getCurrentEnvironment",
"(",
")",
";",
"return",
"writePool",
".",
"schedule",
"(",
"new",
"Callable",
"<",
"RawGcsCreationToken",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"RawGcsCreationToken",
"call",
"(",
")",
"throws",
"Exception",
"{",
"ApiProxy",
".",
"setEnvironmentForCurrentThread",
"(",
"environment",
")",
";",
"return",
"append",
"(",
"token",
",",
"chunk",
")",
";",
"}",
"}",
",",
"50",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] | Runs calls in a background thread so that the results will actually be asynchronous.
@see com.google.appengine.tools.cloudstorage.RawGcsService#continueObjectCreationAsync(
com.google.appengine.tools.cloudstorage.RawGcsService.RawGcsCreationToken,
java.nio.ByteBuffer, long) | [
"Runs",
"calls",
"in",
"a",
"background",
"thread",
"so",
"that",
"the",
"results",
"will",
"actually",
"be",
"asynchronous",
"."
] | d11078331ecd915d753c886e96a80133599f3f98 | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/dev/LocalRawGcsService.java#L286-L302 |
163,397 | GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/PrefetchingGcsInputChannelImpl.java | PrefetchingGcsInputChannelImpl.requestBlock | private void requestBlock() {
next = ByteBuffer.allocate(blockSizeBytes);
long requestTimeout = retryParams.getRequestTimeoutMillisForCurrentAttempt();
pendingFetch = raw.readObjectAsync(next, filename, fetchPosition, requestTimeout);
} | java | private void requestBlock() {
next = ByteBuffer.allocate(blockSizeBytes);
long requestTimeout = retryParams.getRequestTimeoutMillisForCurrentAttempt();
pendingFetch = raw.readObjectAsync(next, filename, fetchPosition, requestTimeout);
} | [
"private",
"void",
"requestBlock",
"(",
")",
"{",
"next",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"blockSizeBytes",
")",
";",
"long",
"requestTimeout",
"=",
"retryParams",
".",
"getRequestTimeoutMillisForCurrentAttempt",
"(",
")",
";",
"pendingFetch",
"=",
"raw",
".",
"readObjectAsync",
"(",
"next",
",",
"filename",
",",
"fetchPosition",
",",
"requestTimeout",
")",
";",
"}"
] | Allocates a new next buffer and pending fetch. | [
"Allocates",
"a",
"new",
"next",
"buffer",
"and",
"pending",
"fetch",
"."
] | d11078331ecd915d753c886e96a80133599f3f98 | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/PrefetchingGcsInputChannelImpl.java#L104-L108 |
163,398 | GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java | OauthRawGcsService.handlePutResponse | GcsRestCreationToken handlePutResponse(final GcsRestCreationToken token,
final boolean isFinalChunk,
final int length,
final HTTPRequestInfo reqInfo,
HTTPResponse resp) throws Error, IOException {
switch (resp.getResponseCode()) {
case 200:
if (!isFinalChunk) {
throw new RuntimeException("Unexpected response code 200 on non-final chunk. Request: \n"
+ URLFetchUtils.describeRequestAndResponse(reqInfo, resp));
} else {
return null;
}
case 308:
if (isFinalChunk) {
throw new RuntimeException("Unexpected response code 308 on final chunk: "
+ URLFetchUtils.describeRequestAndResponse(reqInfo, resp));
} else {
return new GcsRestCreationToken(token.filename, token.uploadId, token.offset + length);
}
default:
throw HttpErrorHandler.error(resp.getResponseCode(),
URLFetchUtils.describeRequestAndResponse(reqInfo, resp));
}
} | java | GcsRestCreationToken handlePutResponse(final GcsRestCreationToken token,
final boolean isFinalChunk,
final int length,
final HTTPRequestInfo reqInfo,
HTTPResponse resp) throws Error, IOException {
switch (resp.getResponseCode()) {
case 200:
if (!isFinalChunk) {
throw new RuntimeException("Unexpected response code 200 on non-final chunk. Request: \n"
+ URLFetchUtils.describeRequestAndResponse(reqInfo, resp));
} else {
return null;
}
case 308:
if (isFinalChunk) {
throw new RuntimeException("Unexpected response code 308 on final chunk: "
+ URLFetchUtils.describeRequestAndResponse(reqInfo, resp));
} else {
return new GcsRestCreationToken(token.filename, token.uploadId, token.offset + length);
}
default:
throw HttpErrorHandler.error(resp.getResponseCode(),
URLFetchUtils.describeRequestAndResponse(reqInfo, resp));
}
} | [
"GcsRestCreationToken",
"handlePutResponse",
"(",
"final",
"GcsRestCreationToken",
"token",
",",
"final",
"boolean",
"isFinalChunk",
",",
"final",
"int",
"length",
",",
"final",
"HTTPRequestInfo",
"reqInfo",
",",
"HTTPResponse",
"resp",
")",
"throws",
"Error",
",",
"IOException",
"{",
"switch",
"(",
"resp",
".",
"getResponseCode",
"(",
")",
")",
"{",
"case",
"200",
":",
"if",
"(",
"!",
"isFinalChunk",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unexpected response code 200 on non-final chunk. Request: \\n\"",
"+",
"URLFetchUtils",
".",
"describeRequestAndResponse",
"(",
"reqInfo",
",",
"resp",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"case",
"308",
":",
"if",
"(",
"isFinalChunk",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unexpected response code 308 on final chunk: \"",
"+",
"URLFetchUtils",
".",
"describeRequestAndResponse",
"(",
"reqInfo",
",",
"resp",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"GcsRestCreationToken",
"(",
"token",
".",
"filename",
",",
"token",
".",
"uploadId",
",",
"token",
".",
"offset",
"+",
"length",
")",
";",
"}",
"default",
":",
"throw",
"HttpErrorHandler",
".",
"error",
"(",
"resp",
".",
"getResponseCode",
"(",
")",
",",
"URLFetchUtils",
".",
"describeRequestAndResponse",
"(",
"reqInfo",
",",
"resp",
")",
")",
";",
"}",
"}"
] | Given a HTTPResponce, process it, throwing an error if needed and return a Token for the next
request. | [
"Given",
"a",
"HTTPResponce",
"process",
"it",
"throwing",
"an",
"error",
"if",
"needed",
"and",
"return",
"a",
"Token",
"for",
"the",
"next",
"request",
"."
] | d11078331ecd915d753c886e96a80133599f3f98 | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java#L375-L399 |
163,399 | GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java | OauthRawGcsService.put | private RawGcsCreationToken put(final GcsRestCreationToken token, ByteBuffer chunk,
final boolean isFinalChunk, long timeoutMillis) throws IOException {
final int length = chunk.remaining();
HTTPRequest req = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length);
HTTPRequestInfo info = new HTTPRequestInfo(req);
HTTPResponse response;
try {
response = urlfetch.fetch(req);
} catch (IOException e) {
throw createIOException(info, e);
}
return handlePutResponse(token, isFinalChunk, length, info, response);
} | java | private RawGcsCreationToken put(final GcsRestCreationToken token, ByteBuffer chunk,
final boolean isFinalChunk, long timeoutMillis) throws IOException {
final int length = chunk.remaining();
HTTPRequest req = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length);
HTTPRequestInfo info = new HTTPRequestInfo(req);
HTTPResponse response;
try {
response = urlfetch.fetch(req);
} catch (IOException e) {
throw createIOException(info, e);
}
return handlePutResponse(token, isFinalChunk, length, info, response);
} | [
"private",
"RawGcsCreationToken",
"put",
"(",
"final",
"GcsRestCreationToken",
"token",
",",
"ByteBuffer",
"chunk",
",",
"final",
"boolean",
"isFinalChunk",
",",
"long",
"timeoutMillis",
")",
"throws",
"IOException",
"{",
"final",
"int",
"length",
"=",
"chunk",
".",
"remaining",
"(",
")",
";",
"HTTPRequest",
"req",
"=",
"createPutRequest",
"(",
"token",
",",
"chunk",
",",
"isFinalChunk",
",",
"timeoutMillis",
",",
"length",
")",
";",
"HTTPRequestInfo",
"info",
"=",
"new",
"HTTPRequestInfo",
"(",
"req",
")",
";",
"HTTPResponse",
"response",
";",
"try",
"{",
"response",
"=",
"urlfetch",
".",
"fetch",
"(",
"req",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"createIOException",
"(",
"info",
",",
"e",
")",
";",
"}",
"return",
"handlePutResponse",
"(",
"token",
",",
"isFinalChunk",
",",
"length",
",",
"info",
",",
"response",
")",
";",
"}"
] | Write the provided chunk at the offset specified in the token. If finalChunk is set, the file
will be closed. | [
"Write",
"the",
"provided",
"chunk",
"at",
"the",
"offset",
"specified",
"in",
"the",
"token",
".",
"If",
"finalChunk",
"is",
"set",
"the",
"file",
"will",
"be",
"closed",
"."
] | d11078331ecd915d753c886e96a80133599f3f98 | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java#L405-L417 |
Subsets and Splits