proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/declarators/PatternSymbolDeclarator.java
PatternSymbolDeclarator
getSymbolDeclarations
class PatternSymbolDeclarator extends AbstractSymbolDeclarator<PatternExpr> { public PatternSymbolDeclarator(PatternExpr wrappedNode, TypeSolver typeSolver) { super(wrappedNode, typeSolver); } @Override public List<ResolvedValueDeclaration> getSymbolDeclarations() {<FILL_FUNCTION_BODY>} }
List<ResolvedValueDeclaration> symbols = new LinkedList<>(); symbols.add(JavaParserSymbolDeclaration.patternVar(wrappedNode, typeSolver)); return symbols;
96
46
142
<methods>public void <init>(com.github.javaparser.ast.expr.PatternExpr, com.github.javaparser.resolution.TypeSolver) <variables>protected com.github.javaparser.resolution.TypeSolver typeSolver,protected com.github.javaparser.ast.expr.PatternExpr wrappedNode
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/declarators/VariableSymbolDeclarator.java
VariableSymbolDeclarator
getSymbolDeclarations
class VariableSymbolDeclarator extends AbstractSymbolDeclarator<VariableDeclarationExpr> { public VariableSymbolDeclarator(VariableDeclarationExpr wrappedNode, TypeSolver typeSolver) { super(wrappedNode, typeSolver); wrappedNode.getParentNode().ifPresent(p -> { if (p instanceof FieldDec...
List<ResolvedValueDeclaration> variables = wrappedNode.getVariables() .stream() .map(v -> JavaParserSymbolDeclaration.localVar(v, typeSolver)) .collect(Collectors.toCollection(ArrayList::new)); // // FIXME: This returns ALL PatternExpr, regardless of whet...
136
266
402
<methods>public void <init>(com.github.javaparser.ast.expr.VariableDeclarationExpr, com.github.javaparser.resolution.TypeSolver) <variables>protected com.github.javaparser.resolution.TypeSolver typeSolver,protected com.github.javaparser.ast.expr.VariableDeclarationExpr wrappedNode
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistAnnotationMemberDeclaration.java
JavassistAnnotationMemberDeclaration
getDefaultValue
class JavassistAnnotationMemberDeclaration implements ResolvedAnnotationMemberDeclaration { private static Map<Class<? extends MemberValue>, Function<MemberValue, ? extends Expression>> memberValueAsExressionConverter = new HashMap<>(); static { memberValueAsExressionConverter.put(BooleanMemberValu...
AnnotationDefaultAttribute defaultAttribute = (AnnotationDefaultAttribute) annotationMember.getMethodInfo().getAttribute(AnnotationDefaultAttribute.tag); if (defaultAttribute == null) return null; MemberValue memberValue = defaultAttribute.getDefaultValue(); Function<MemberValue, ? ...
646
137
783
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistConstructorDeclaration.java
JavassistConstructorDeclaration
toString
class JavassistConstructorDeclaration implements ResolvedConstructorDeclaration { private final CtConstructor ctConstructor; private final TypeSolver typeSolver; private final JavassistMethodLikeDeclarationAdapter methodLikeAdaper; public JavassistConstructorDeclaration(CtConstructor ctConstructor, Typ...
return getClass().getSimpleName() + "{" + "ctConstructor=" + ctConstructor.getName() + ", typeSolver=" + typeSolver + '}';
517
50
567
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistEnumConstantDeclaration.java
JavassistEnumConstantDeclaration
toString
class JavassistEnumConstantDeclaration implements ResolvedEnumConstantDeclaration { private CtField ctField; private TypeSolver typeSolver; private ResolvedType type; public JavassistEnumConstantDeclaration(CtField ctField, TypeSolver typeSolver) { if (ctField == null) { throw new ...
return getClass().getSimpleName() + "{" + "ctField=" + ctField.getName() + ", typeSolver=" + typeSolver + '}';
311
50
361
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistFactory.java
JavassistFactory
toTypeDeclaration
class JavassistFactory { public static ResolvedType typeUsageFor(CtClass ctClazz, TypeSolver typeSolver) { try { if (ctClazz.isArray()) { return new ResolvedArrayType(typeUsageFor(ctClazz.getComponentType(), typeSolver)); } if (ctClazz.isPrimitive()) { if (ctClazz.getName()....
if (ctClazz.isAnnotation()) { return new JavassistAnnotationDeclaration(ctClazz, typeSolver); } if (ctClazz.isInterface()) { return new JavassistInterfaceDeclaration(ctClazz, typeSolver); } if (ctClazz.isEnum()) { return new JavassistEnumDeclaration(ctClazz, typeSolver); }...
440
156
596
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistFieldDeclaration.java
JavassistFieldDeclaration
getType
class JavassistFieldDeclaration implements ResolvedFieldDeclaration { private CtField ctField; private TypeSolver typeSolver; public JavassistFieldDeclaration(CtField ctField, TypeSolver typeSolver) { this.ctField = ctField; this.typeSolver = typeSolver; } @Override public Reso...
try { String signature = ctField.getGenericSignature(); if (signature == null) { signature = ctField.getSignature(); } SignatureAttribute.Type genericSignatureType = SignatureAttribute.toTypeSignature(signature); return JavassistUtils....
359
122
481
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistMethodLikeDeclarationAdapter.java
JavassistMethodLikeDeclarationAdapter
getSpecifiedException
class JavassistMethodLikeDeclarationAdapter { private CtBehavior ctBehavior; private TypeSolver typeSolver; private ResolvedMethodLikeDeclaration declaration; private SignatureAttribute.MethodSignature methodSignature; public JavassistMethodLikeDeclarationAdapter(CtBehavior ctBehavior, TypeSolver...
if (index < 0) { throw new IllegalArgumentException(String.format("index < 0: %d", index)); } ExceptionsAttribute exceptionsAttribute = ctBehavior.getMethodInfo().getExceptionsAttribute(); if (exceptionsAttribute == null) { throw new IllegalArgumentException(Str...
672
211
883
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistParameterDeclaration.java
JavassistParameterDeclaration
toString
class JavassistParameterDeclaration implements ResolvedParameterDeclaration { private ResolvedType type; private TypeSolver typeSolver; private boolean variadic; private String name; public JavassistParameterDeclaration(CtClass type, TypeSolver typeSolver, boolean variadic, String name) { t...
return "JavassistParameterDeclaration{" + "type=" + type + ", typeSolver=" + typeSolver + ", variadic=" + variadic + '}';
364
53
417
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistTypeParameter.java
JavassistTypeParameter
getBounds
class JavassistTypeParameter implements ResolvedTypeParameterDeclaration { private SignatureAttribute.TypeParameter wrapped; private TypeSolver typeSolver; private ResolvedTypeParametrizable container; public JavassistTypeParameter(SignatureAttribute.TypeParameter wrapped, ResolvedTypeParametrizable c...
List<Bound> bounds = new ArrayList<>(); SignatureAttribute.ObjectType classBound = wrapped.getClassBound(); if (classBound != null) { bounds.add(Bound.extendsBound(JavassistUtils.signatureTypeToType(classBound, typeSolver, getContainer()))); } for (SignatureAttribute...
664
139
803
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/logic/AbstractClassDeclaration.java
AbstractClassDeclaration
getAllInterfaces
class AbstractClassDeclaration extends AbstractTypeDeclaration implements ResolvedClassDeclaration, MethodResolutionCapability { /// /// Public /// @Override public boolean hasName() { return getQualifiedName() != null; } @Override public final List<ResolvedReferenceTy...
List<ResolvedReferenceType> interfaces = new ArrayList<>(); for (ResolvedReferenceType interfaceDeclaration : getInterfaces()) { interfaces.add(interfaceDeclaration); interfaces.addAll(interfaceDeclaration.getAllInterfacesAncestors()); } getSuperClass().ifPresent...
297
106
403
<methods>public non-sealed void <init>() ,public final Set<com.github.javaparser.resolution.MethodUsage> getAllMethods() ,public final boolean isFunctionalInterface() <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/logic/AbstractTypeDeclaration.java
AbstractTypeDeclaration
getAllMethods
class AbstractTypeDeclaration implements ResolvedReferenceTypeDeclaration { /* * Returns all methods which have distinct "enhanced" signature declared in this type and all members. * An "enhanced" signature include the return type which is used sometimes to identify functional interfaces. * This is a different ...
Set<MethodUsage> methods = new HashSet<>(); Set<String> methodsSignatures = new HashSet<>(); for (ResolvedMethodDeclaration methodDeclaration : getDeclaredMethods()) { MethodUsage methodUsage = new MethodUsage(methodDeclaration); methods.add(methodUsage); S...
170
380
550
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionAnnotationDeclaration.java
ReflectionAnnotationDeclaration
solveMethodAsUsage
class ReflectionAnnotationDeclaration extends AbstractTypeDeclaration implements ResolvedAnnotationDeclaration, MethodUsageResolutionCapability, ...
Optional<MethodUsage> res = ReflectionMethodResolutionLogic.solveMethodAsUsage(name, parameterTypes, typeSolver, invokationContext, typeParameterValues, this, clazz); if (res.isPresent()) { // We have to replace method type typeParametersValues here InferenceContext ...
1,355
346
1,701
<methods>public non-sealed void <init>() ,public final Set<com.github.javaparser.resolution.MethodUsage> getAllMethods() ,public final boolean isFunctionalInterface() <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionAnnotationMemberDeclaration.java
ReflectionAnnotationMemberDeclaration
transformDefaultValue
class ReflectionAnnotationMemberDeclaration implements ResolvedAnnotationMemberDeclaration { private static Map<Class<?>, Function<Object, ? extends Expression>> valueAsExpressionConverters = new HashMap<>(); static { valueAsExpressionConverters.put(Boolean.class, (value) -> new BooleanLiteralExpr((Boo...
if (value instanceof Enum<?>) { final Class<?> declaringClass = ((Enum<?>) value).getDeclaringClass(); final String name = ((Enum<?>) value).name(); return new FieldAccessExpr(new NameExpr(declaringClass.getSimpleName()), name); } else if (value instanceof Annotation...
701
342
1,043
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionClassAdapter.java
ReflectionClassAdapter
hasField
class ReflectionClassAdapter { private Class<?> clazz; private TypeSolver typeSolver; private ResolvedReferenceTypeDeclaration typeDeclaration; public ReflectionClassAdapter(Class<?> clazz, TypeSolver typeSolver, ResolvedReferenceTypeDeclaration typeDeclaration) { this.clazz = clazz; t...
// First consider fields declared on this class for (Field field : clazz.getDeclaredFields()) { if (field.getName().equals(name)) { return true; } } // Then consider fields inherited from ancestors for (ResolvedReferenceType ancestor : ty...
1,830
134
1,964
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionConstructorDeclaration.java
ReflectionConstructorDeclaration
getParam
class ReflectionConstructorDeclaration implements ResolvedConstructorDeclaration { private Constructor<?> constructor; private TypeSolver typeSolver; public ReflectionConstructorDeclaration(Constructor<?> constructor, TypeSolver typeSolver) { this.constructor = constructor; this.typeSolver...
if (i < 0 || i >= getNumberOfParams()) { throw new IllegalArgumentException(String.format("No param with index %d. Number of params: %d", i, getNumberOfParams())); } boolean variadic = false; if (constructor.isVarArgs()) { variadic = i == (constructor.getParamete...
434
143
577
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionEnumConstantDeclaration.java
ReflectionEnumConstantDeclaration
getType
class ReflectionEnumConstantDeclaration implements ResolvedEnumConstantDeclaration { private Field enumConstant; private TypeSolver typeSolver; public ReflectionEnumConstantDeclaration(Field enumConstant, TypeSolver typeSolver) { if (!enumConstant.isEnumConstant()) { throw new IllegalA...
Class<?> enumClass = enumConstant.getDeclaringClass(); ResolvedReferenceTypeDeclaration typeDeclaration = new ReflectionEnumDeclaration(enumClass, typeSolver); return new ReferenceTypeImpl(typeDeclaration);
166
55
221
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionEnumDeclaration.java
ReflectionEnumDeclaration
getAncestors
class ReflectionEnumDeclaration extends AbstractTypeDeclaration implements ResolvedEnumDeclaration, MethodResolutionCapability, MethodUsageResolutionCapability, SymbolResolutionCapability { /// /// Fields /// private Class<?> clazz; private TypeSolver typeSolver; private ReflectionClassAda...
// we do not attempt to perform any symbol solving when analyzing ancestors in the reflection model, so we can // simply ignore the boolean parameter here; an UnsolvedSymbolException cannot occur return reflectionClassAdapter.getAncestors();
1,843
59
1,902
<methods>public non-sealed void <init>() ,public final Set<com.github.javaparser.resolution.MethodUsage> getAllMethods() ,public final boolean isFunctionalInterface() <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionFactory.java
ReflectionFactory
modifiersToAccessLevel
class ReflectionFactory { private static String JAVA_LANG_OBJECT = Object.class.getCanonicalName(); public static ResolvedReferenceTypeDeclaration typeDeclarationFor(Class<?> clazz, TypeSolver typeSolver) { if (clazz.isArray()) { throw new IllegalArgumentException("No type declaration avai...
if (Modifier.isPublic(modifiers)) { return AccessSpecifier.PUBLIC; } if (Modifier.isProtected(modifiers)) { return AccessSpecifier.PROTECTED; } if (Modifier.isPrivate(modifiers)) { return AccessSpecifier.PRIVATE; } retu...
1,144
100
1,244
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionFieldDeclaration.java
ReflectionFieldDeclaration
calcType
class ReflectionFieldDeclaration implements ResolvedFieldDeclaration { private Field field; private TypeSolver typeSolver; private ResolvedType type; public ReflectionFieldDeclaration(Field field, TypeSolver typeSolver) { this.field = field; this.typeSolver = typeSolver; this.t...
// TODO consider interfaces, enums, primitive types, arrays return ReflectionFactory.typeUsageFor(field.getGenericType(), typeSolver);
470
38
508
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionMethodDeclaration.java
ReflectionMethodDeclaration
declaringType
class ReflectionMethodDeclaration implements ResolvedMethodDeclaration, TypeVariableResolutionCapability { private Method method; private TypeSolver typeSolver; public ReflectionMethodDeclaration(Method method, TypeSolver typeSolver) { this.method = method; if (method.isSynthetic() || meth...
if (method.getDeclaringClass().isInterface()) { return new ReflectionInterfaceDeclaration(method.getDeclaringClass(), typeSolver); } if (method.getDeclaringClass().isEnum()) { return new ReflectionEnumDeclaration(method.getDeclaringClass(), typeSolver); } ...
840
99
939
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionMethodResolutionLogic.java
ReflectionMethodResolutionLogic
solveMethod
class ReflectionMethodResolutionLogic { static SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<ResolvedType> parameterTypes, boolean staticOnly, TypeSolver typeSolver, ResolvedReferenceTypeDeclaration scopeType, ...
List<ResolvedMethodDeclaration> methods = new ArrayList<>(); Predicate<Method> staticOnlyCheck = m -> !staticOnly || (staticOnly && Modifier.isStatic(m.getModifiers())); for (Method method : clazz.getMethods()) { if (method.isBridge() || method.isSynthetic() || !method.getName().equ...
1,086
412
1,498
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionParameterDeclaration.java
ReflectionParameterDeclaration
equals
class ReflectionParameterDeclaration implements ResolvedParameterDeclaration { private Class<?> type; private java.lang.reflect.Type genericType; private TypeSolver typeSolver; private boolean variadic; private String name; /** * * @param type * @param genericType * @param t...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ReflectionParameterDeclaration that = (ReflectionParameterDeclaration) o; return variadic == that.variadic && Objects.equals(type, that.type) && Objects.equals(genericT...
504
123
627
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionTypeParameter.java
ReflectionTypeParameter
equals
class ReflectionTypeParameter implements ResolvedTypeParameterDeclaration { private TypeVariable typeVariable; private TypeSolver typeSolver; private ResolvedTypeParametrizable container; public ReflectionTypeParameter(TypeVariable typeVariable, boolean declaredOnClass, TypeSolver typeSolver) { ...
if (this == o) return true; if (!(o instanceof ResolvedTypeParameterDeclaration)) return false; ResolvedTypeParameterDeclaration that = (ResolvedTypeParameterDeclaration) o; if (!getQualifiedName().equals(that.getQualifiedName())) { return false; } if (decl...
692
128
820
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/comparators/ClassComparator.java
ClassComparator
compare
class ClassComparator implements Comparator<Class<?>> { @Override public int compare(Class<?> o1, Class<?> o2) {<FILL_FUNCTION_BODY>} }
int subCompare; subCompare = o1.getCanonicalName().compareTo(o2.getCanonicalName()); if (subCompare != 0) return subCompare; subCompare = Boolean.compare(o1.isAnnotation(), o2.isAnnotation()); if (subCompare != 0) return subCompare; subCompare = Boolean.compare(o1.isArra...
56
193
249
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/comparators/MethodComparator.java
MethodComparator
compare
class MethodComparator implements Comparator<Method> { @Override public int compare(Method o1, Method o2) {<FILL_FUNCTION_BODY>} }
int compareName = o1.getName().compareTo(o2.getName()); if (compareName != 0) return compareName; int compareNParams = o1.getParameterCount() - o2.getParameterCount(); if (compareNParams != 0) return compareNParams; for (int i = 0; i < o1.getParameterCount(); i++) { ...
48
194
242
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/comparators/ParameterComparator.java
ParameterComparator
compare
class ParameterComparator implements Comparator<Parameter> { @Override public int compare(Parameter o1, Parameter o2) {<FILL_FUNCTION_BODY>} }
int compareName = o1.getName().compareTo(o2.getName()); if (compareName != 0) return compareName; int compareType = new ClassComparator().compare(o1.getType(), o2.getType()); if (compareType != 0) return compareType; return 0;
50
82
132
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/SymbolSolver.java
SymbolSolver
classToResolvedType
class SymbolSolver implements Solver { private final TypeSolver typeSolver; public SymbolSolver(TypeSolver typeSolver) { if (typeSolver == null) { throw new IllegalArgumentException("Missing Parameter - Cannot initialise a SymbolSolver, without a way to solve types."); } t...
if (clazz.isPrimitive()) { return ResolvedPrimitiveType.byName(clazz.getName()); } ResolvedReferenceTypeDeclaration declaration; if (clazz.isAnnotation()) { declaration = new ReflectionAnnotationDeclaration(clazz, typeSolver); } else if (clazz.isEnum()) ...
1,226
171
1,397
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/promotion/BooleanConditionalExprHandler.java
BooleanConditionalExprHandler
resolveType
class BooleanConditionalExprHandler implements ConditionalExprHandler { ResolvedType thenExpr; ResolvedType elseExpr; public BooleanConditionalExprHandler(ResolvedType thenExpr, ResolvedType elseExpr) { this.thenExpr = thenExpr; this.elseExpr = elseExpr; } @Override public ...
if (thenExpr.isReferenceType() && elseExpr.isReferenceType()) { return thenExpr.asReferenceType(); } return thenExpr.isPrimitive() ? thenExpr : elseExpr;
109
53
162
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/promotion/ConditionalExprResolver.java
ConditionalExprResolver
getConditionExprHandler
class ConditionalExprResolver { private static final ResolvedPrimitiveType TYPE_BOOLEAN = ResolvedPrimitiveType.BOOLEAN; public static ConditionalExprHandler getConditionExprHandler(ResolvedType thenExpr, ResolvedType elseExpr) {<FILL_FUNCTION_BODY>} }
// boolean conditional expressions if (!thenExpr.isNull() && !elseExpr.isNull() && thenExpr.isAssignableBy(TYPE_BOOLEAN) && elseExpr.isAssignableBy(TYPE_BOOLEAN)) { return new BooleanConditionalExprHandler(thenExpr, elseExpr); // numeric conditional expressions ...
79
155
234
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/promotion/NumericConditionalExprHandler.java
NumericConditionalExprHandler
isResolvableTo
class NumericConditionalExprHandler implements ConditionalExprHandler { private static Map<ResolvedType, List<ResolvedType>> NumericConverter = new HashMap(); static { // first type is the type of the resolution // the list indicates the types that can be resolved in the type specified as ...
return NumericConverter.entrySet().stream().filter(e -> e.getKey() == toType) .flatMap(entry -> entry.getValue().stream()) .anyMatch(rt -> rt == resolvedType || (verifyBoxedType && resolvedType.isReferenceType() && resolvedType.asReferenceType().toUnboxed...
1,793
96
1,889
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/promotion/ReferenceConditionalExprHandler.java
ReferenceConditionalExprHandler
resolveType
class ReferenceConditionalExprHandler implements ConditionalExprHandler { ResolvedType thenExpr; ResolvedType elseExpr; public ReferenceConditionalExprHandler(ResolvedType thenExpr, ResolvedType elseExpr) { this.thenExpr = thenExpr; this.elseExpr = elseExpr; } @Override public ...
// If one of the second and third operands is of the null type and the type of the other is a reference type, then the type of the conditional expression is that reference type. if (thenExpr.isNull()) { return elseExpr; } if (elseExpr.isNull()) { return thenExpr;...
108
111
219
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/Bound.java
Bound
isProperUpperBoundFor
class Bound { /// /// Creation of bounds /// static Bound falseBound() { return FalseBound.getInstance(); } /// /// Satisfiability /// /** * A bound is satisfied by an inference variable substitution if, after applying the substitution, * the assertion is true. ...
Optional<ProperUpperBound> partial = isProperUpperBound(); if (partial.isPresent() && partial.get().getInferenceVariable().equals(inferenceVariable)) { return partial; } return Optional.empty();
717
63
780
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/ConstraintFormula.java
ReductionResult
equals
class ReductionResult { private BoundSet boundSet; private List<ConstraintFormula> constraintFormulas; public BoundSet getBoundSet() { return boundSet; } public List<ConstraintFormula> getConstraintFormulas() { return constraintFormulas; } ...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ReductionResult that = (ReductionResult) o; if (!boundSet.equals(that.boundSet)) return false; return constraintFormulas.equals(that.constraintFormulas);
785
85
870
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/ConstraintFormulaSet.java
ConstraintFormulaSet
reduce
class ConstraintFormulaSet { private List<ConstraintFormula> constraintFormulas; public ConstraintFormulaSet withConstraint(ConstraintFormula constraintFormula) { ConstraintFormulaSet newInstance = new ConstraintFormulaSet(); newInstance.constraintFormulas.addAll(this.constraintFormulas); ...
List<ConstraintFormula> constraints = new LinkedList<>(constraintFormulas); BoundSet boundSet = BoundSet.empty(); while (constraints.size() > 0) { ConstraintFormula constraintFormula = constraints.remove(0); ConstraintFormula.ReductionResult reductionResult = constraintF...
332
137
469
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/InferenceVariable.java
InferenceVariable
equals
class InferenceVariable implements ResolvedType { private static int unnamedInstantiated = 0; private String name; private ResolvedTypeParameterDeclaration typeParameterDeclaration; public static List<InferenceVariable> instantiate(List<ResolvedTypeParameterDeclaration> typeParameterDeclarations) { ...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; InferenceVariable that = (InferenceVariable) o; if (!name.equals(that.name)) return false; return typeParameterDeclaration != null ? typeParameterDeclaration.equals(that.typeParameterDeclara...
587
99
686
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/InferenceVariableSubstitution.java
InferenceVariableSubstitution
withPair
class InferenceVariableSubstitution { private final static InferenceVariableSubstitution EMPTY = new InferenceVariableSubstitution(); private List<InferenceVariable> inferenceVariables; private List<ResolvedType> types; public static InferenceVariableSubstitution empty() { return EMPTY; }...
InferenceVariableSubstitution newInstance = new InferenceVariableSubstitution(); newInstance.inferenceVariables.addAll(this.inferenceVariables); newInstance.types.addAll(this.types); newInstance.inferenceVariables.add(inferenceVariable); newInstance.types.add(type); retu...
163
89
252
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/Instantiation.java
Instantiation
hashCode
class Instantiation { private InferenceVariable inferenceVariable; private ResolvedType properType; public Instantiation(InferenceVariable inferenceVariable, ResolvedType properType) { this.inferenceVariable = inferenceVariable; this.properType = properType; } public InferenceVaria...
int result = inferenceVariable.hashCode(); result = 31 * result + properType.hashCode(); return result;
296
34
330
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/InstantiationSet.java
InstantiationSet
withInstantiation
class InstantiationSet { private List<Instantiation> instantiations; public boolean allInferenceVariablesAreResolved(BoundSet boundSet) { throw new UnsupportedOperationException(); } public static InstantiationSet empty() { return EMPTY; } private static final InstantiationSe...
InstantiationSet newInstance = new InstantiationSet(); newInstance.instantiations.addAll(this.instantiations); newInstance.instantiations.add(instantiation); return newInstance;
395
57
452
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/LeastUpperBoundLogic.java
TypeSubstitution
lctaBothWildcards
class TypeSubstitution { private List<ResolvedTypeParameterDeclaration> typeParameterDeclarations; private List<ResolvedType> types; private final static TypeSubstitution EMPTY = new TypeSubstitution(); public static TypeSubstitution empty() { return new TypeSubstitution()...
// lcta(? super U, ? super V) = ? super glb(U, V) if (type1.isUpperBounded() && type2.isUpperBounded()) { ResolvedType glb = TypeHelper.glb(toSet(type1.getBoundedType(), type2.getBoundedType())); return bound(glb, BoundType.SUPER); } // lcta(? extends U, ? extend...
1,185
278
1,463
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/ProperLowerBound.java
ProperLowerBound
toString
class ProperLowerBound { private InferenceVariable inferenceVariable; private ResolvedType properType; public ProperLowerBound(InferenceVariable inferenceVariable, ResolvedType properType) { this.inferenceVariable = inferenceVariable; this.properType = properType; } @Override p...
return "ProperLowerBound{" + "inferenceVariable=" + inferenceVariable + ", properType=" + properType + '}';
294
41
335
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/ProperUpperBound.java
ProperUpperBound
toString
class ProperUpperBound { private InferenceVariable inferenceVariable; private ResolvedType properType; public ProperUpperBound(InferenceVariable inferenceVariable, ResolvedType properType) { this.inferenceVariable = inferenceVariable; this.properType = properType; } @Override p...
return "ProperUpperBound{" + "inferenceVariable=" + inferenceVariable + ", properType=" + properType + '}';
298
42
340
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/Substitution.java
Substitution
apply
class Substitution { private List<ResolvedTypeParameterDeclaration> typeParameterDeclarations; private List<ResolvedType> types; private final static Substitution EMPTY = new Substitution(); public static Substitution empty() { return EMPTY; } public Substitution withPair(ResolvedTyp...
ResolvedType result = originalType; for (int i=0;i<typeParameterDeclarations.size();i++) { result = result.replaceTypeVariables(typeParameterDeclarations.get(i), types.get(i)); } return result;
256
72
328
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/TypeInferenceCache.java
TypeInferenceCache
addRecord
class TypeInferenceCache { private static Map<TypeSolver, IdentityHashMap<LambdaExpr, Map<String, ResolvedType>>> typeForLambdaParameters = new HashMap<>(); private static Map<TypeSolver, IdentityHashMap<LambdaExpr, List<InferenceVariable>>> inferenceVariables = new HashMap<>(); public static void addReco...
if (!typeForLambdaParameters.containsKey(typeSolver)) { typeForLambdaParameters.put(typeSolver, new IdentityHashMap<>()); } if (!typeForLambdaParameters.get(typeSolver).containsKey(lambdaExpr)) { typeForLambdaParameters.get(typeSolver).put(lambdaExpr, new HashMap<>()); ...
508
116
624
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/bounds/CapturesBound.java
CapturesBound
equals
class CapturesBound extends Bound { private List<InferenceVariable> inferenceVariables; private List<ResolvedType> typesOrWildcards; public CapturesBound(List<InferenceVariable> inferenceVariables, List<ResolvedType> typesOrWildcards) { this.inferenceVariables = inferenceVariables; this.typ...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CapturesBound that = (CapturesBound) o; if (!inferenceVariables.equals(that.inferenceVariables)) return false; return typesOrWildcards.equals(that.typesOrWildcards);
382
95
477
<methods>public non-sealed void <init>() ,public boolean isADependency() ,public Optional<com.github.javaparser.symbolsolver.resolution.typeinference.Instantiation> isAnInstantiation() ,public Optional<com.github.javaparser.symbolsolver.resolution.typeinference.ProperLowerBound> isProperLowerBound() ,public Optional<co...
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/bounds/SameAsBound.java
SameAsBound
toString
class SameAsBound extends Bound { private ResolvedType s; private ResolvedType t; public SameAsBound(ResolvedType s, ResolvedType t) { if (!s.isInferenceVariable() && !t.isInferenceVariable()) { throw new IllegalArgumentException("One of S or T should be an inference variable"); ...
return "SameAsBound{" + "s=" + s + ", t=" + t + '}';
579
35
614
<methods>public non-sealed void <init>() ,public boolean isADependency() ,public Optional<com.github.javaparser.symbolsolver.resolution.typeinference.Instantiation> isAnInstantiation() ,public Optional<com.github.javaparser.symbolsolver.resolution.typeinference.ProperLowerBound> isProperLowerBound() ,public Optional<co...
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/bounds/SubtypeOfBound.java
SubtypeOfBound
equals
class SubtypeOfBound extends Bound { private ResolvedType s; private ResolvedType t; public SubtypeOfBound(ResolvedType s, ResolvedType t) { if (!s.isInferenceVariable() && !t.isInferenceVariable()) { throw new IllegalArgumentException("One of S or T should be an inference variable"); ...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SubtypeOfBound that = (SubtypeOfBound) o; if (!s.equals(that.s)) return false; return t.equals(that.t);
590
79
669
<methods>public non-sealed void <init>() ,public boolean isADependency() ,public Optional<com.github.javaparser.symbolsolver.resolution.typeinference.Instantiation> isAnInstantiation() ,public Optional<com.github.javaparser.symbolsolver.resolution.typeinference.ProperLowerBound> isProperLowerBound() ,public Optional<co...
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/bounds/ThrowsBound.java
ThrowsBound
equals
class ThrowsBound extends Bound { private InferenceVariable inferenceVariable; public ThrowsBound(InferenceVariable inferenceVariable) { this.inferenceVariable = inferenceVariable; } @Override public boolean equals(Object o) {<FILL_FUNCTION_BODY>} @Override public String toString(...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ThrowsBound that = (ThrowsBound) o; return inferenceVariable.equals(that.inferenceVariable);
271
65
336
<methods>public non-sealed void <init>() ,public boolean isADependency() ,public Optional<com.github.javaparser.symbolsolver.resolution.typeinference.Instantiation> isAnInstantiation() ,public Optional<com.github.javaparser.symbolsolver.resolution.typeinference.ProperLowerBound> isProperLowerBound() ,public Optional<co...
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/constraintformulas/LambdaThrowsCompatibleWithType.java
LambdaThrowsCompatibleWithType
reduce
class LambdaThrowsCompatibleWithType extends ConstraintFormula { private LambdaExpr lambdaExpression; private ResolvedType T; @Override public ReductionResult reduce(BoundSet currentBoundSet) {<FILL_FUNCTION_BODY>} @Override public boolean equals(Object o) { if (this == o) return true;...
// A constraint formula of the form ‹LambdaExpression →throws T› is reduced as follows: // // - If T is not a functional interface type (§9.8), the constraint reduces to false. // // - Otherwise, let the target function type for the lambda expression be determined as specified i...
274
571
845
<methods>public non-sealed void <init>() ,public abstract com.github.javaparser.symbolsolver.resolution.typeinference.ConstraintFormula.ReductionResult reduce(com.github.javaparser.symbolsolver.resolution.typeinference.BoundSet) <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/constraintformulas/MethodReferenceThrowsCompatibleWithType.java
MethodReferenceThrowsCompatibleWithType
reduce
class MethodReferenceThrowsCompatibleWithType extends ConstraintFormula { private MethodReferenceExpr methodReference; private ResolvedType T; @Override public ReductionResult reduce(BoundSet currentBoundSet) {<FILL_FUNCTION_BODY>} @Override public boolean equals(Object o) { if (this =...
// A constraint formula of the form ‹MethodReference →throws T› is reduced as follows: // // - If T is not a functional interface type, or if T is a functional interface type but does not have a function type (§9.9), the constraint reduces to false. // // - Otherwise, let the ta...
273
479
752
<methods>public non-sealed void <init>() ,public abstract com.github.javaparser.symbolsolver.resolution.typeinference.ConstraintFormula.ReductionResult reduce(com.github.javaparser.symbolsolver.resolution.typeinference.BoundSet) <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/constraintformulas/TypeCompatibleWithType.java
TypeCompatibleWithType
reduce
class TypeCompatibleWithType extends ConstraintFormula { private ResolvedType s; private ResolvedType t; private TypeSolver typeSolver; public TypeCompatibleWithType(TypeSolver typeSolver, ResolvedType s, ResolvedType t) { this.typeSolver = typeSolver; this.s = s; this.t = t; ...
// A constraint formula of the form ‹S → T› is reduced as follows: // // 1. If S and T are proper types, the constraint reduces to true if S is compatible in a loose invocation context with T (§5.3), and false otherwise. if (isProperType(s) && isProperType(t)) { if (isCompa...
327
945
1,272
<methods>public non-sealed void <init>() ,public abstract com.github.javaparser.symbolsolver.resolution.typeinference.ConstraintFormula.ReductionResult reduce(com.github.javaparser.symbolsolver.resolution.typeinference.BoundSet) <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/constraintformulas/TypeContainedByType.java
TypeContainedByType
reduce
class TypeContainedByType extends ConstraintFormula { private ResolvedType S; private ResolvedType T; @Override public ReductionResult reduce(BoundSet currentBoundSet) {<FILL_FUNCTION_BODY>} @Override public boolean equals(Object o) { if (this == o) return true; if (o == null |...
// A constraint formula of the form ‹S <= T›, where S and T are type arguments (§4.5.1), is reduced as follows: // // - If T is a type: if (isProperType(T) && !T.isWildcard()) { // - If S is a type, the constraint reduces to ‹S = T›. // // - If ...
256
531
787
<methods>public non-sealed void <init>() ,public abstract com.github.javaparser.symbolsolver.resolution.typeinference.ConstraintFormula.ReductionResult reduce(com.github.javaparser.symbolsolver.resolution.typeinference.BoundSet) <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/constraintformulas/TypeSameAsType.java
TypeSameAsType
reduce
class TypeSameAsType extends ConstraintFormula { private ResolvedType S; private ResolvedType T; public TypeSameAsType(ResolvedType s, ResolvedType t) { S = s; T = t; } @Override public ReductionResult reduce(BoundSet currentBoundSet) {<FILL_FUNCTION_BODY>} @Override p...
// A constraint formula of the form ‹S = T›, where S and T are types, is reduced as follows: if (!S.isWildcard() && !T.isWildcard()) { // - If S and T are proper types, the constraint reduces to true if S is the same as T (§4.3.4), and false // otherwise. if (is...
288
1,045
1,333
<methods>public non-sealed void <init>() ,public abstract com.github.javaparser.symbolsolver.resolution.typeinference.ConstraintFormula.ReductionResult reduce(com.github.javaparser.symbolsolver.resolution.typeinference.BoundSet) <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/constraintformulas/TypeSubtypeOfType.java
TypeSubtypeOfType
reduce
class TypeSubtypeOfType extends ConstraintFormula { private ResolvedType S; private ResolvedType T; private TypeSolver typeSolver; public TypeSubtypeOfType(TypeSolver typeSolver, ResolvedType S, ResolvedType T) { this.typeSolver = typeSolver; this.S = S; this.T = T; } @...
// A constraint formula of the form ‹S <: T› is reduced as follows: // // - If S and T are proper types, the constraint reduces to true if S is a subtype of T (§4.10), and false otherwise. if (isProperType(S) && isProperType(T)) { if (T.isAssignableBy(S)) { ...
327
1,013
1,340
<methods>public non-sealed void <init>() ,public abstract com.github.javaparser.symbolsolver.resolution.typeinference.ConstraintFormula.ReductionResult reduce(com.github.javaparser.symbolsolver.resolution.typeinference.BoundSet) <variables>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typesolvers/AarTypeSolver.java
AarTypeSolver
setParent
class AarTypeSolver implements TypeSolver { private JarTypeSolver delegate; public AarTypeSolver(String aarFile) throws IOException { this(new File(aarFile)); } public AarTypeSolver(Path aarFile) throws IOException { this(aarFile.toFile()); } public AarTypeSolver(File aarFile...
if (parent == this) throw new IllegalStateException("The parent of this TypeSolver cannot be itself."); delegate.setParent(parent);
318
40
358
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typesolvers/ClassLoaderTypeSolver.java
ClassLoaderTypeSolver
tryToSolveType
class ClassLoaderTypeSolver implements TypeSolver { private TypeSolver parent; private ClassLoader classLoader; public ClassLoaderTypeSolver(ClassLoader classLoader) { this.classLoader = classLoader; } @Override public TypeSolver getParent() { return parent; } @Overri...
if (filterName(name)) { try { // Some implementations could return null when the class was loaded through the bootstrap classloader // see https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getClassLoader-- if (classLoader == null) { ...
246
545
791
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typesolvers/MemoryTypeSolver.java
MemoryTypeSolver
toString
class MemoryTypeSolver implements TypeSolver { private TypeSolver parent; private Map<String, ResolvedReferenceTypeDeclaration> declarationMap = new HashMap<>(); @Override public String toString() {<FILL_FUNCTION_BODY>} @Override public boolean equals(Object o) { if (this == o) return...
return "MemoryTypeSolver{" + "parent=" + parent + ", declarationMap=" + declarationMap + '}';
503
38
541
<no_super_class>
javaparser_javaparser
javaparser/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/utils/SymbolSolverCollectionStrategy.java
SymbolSolverCollectionStrategy
collect
class SymbolSolverCollectionStrategy implements CollectionStrategy { private final ParserConfiguration parserConfiguration; private final CombinedTypeSolver typeSolver = new CombinedTypeSolver(new ReflectionTypeSolver(false)); public SymbolSolverCollectionStrategy() { this(new ParserConfiguration(...
ProjectRoot projectRoot = new ProjectRoot(path, parserConfiguration); try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { private Path current_root; private Path currentProjectDir; private String previousSourceDirectory; ...
213
806
1,019
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/config/Config.java
Config
parseBuffer
class Config { private static final String DEFAULT_SECTION = "default"; private static final String DEFAULT_COMMENT = "#"; private static final String DEFAULT_COMMENT_SEM = ";"; private ReentrantLock lock = new ReentrantLock(); // Section:key=value private Map<String, Map<String, String>> data...
String section = ""; int lineNum = 0; String line; while (true) { lineNum++; if ((line = buf.readLine()) != null) { if ("".equals(line)) { continue; } } else { break; } ...
1,055
575
1,630
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/effect/DefaultEffector.java
DefaultEffector
mergeEffects
class DefaultEffector implements Effector { /** * DefaultEffector is the constructor for DefaultEffector. */ public DefaultEffector() { } /** * mergeEffects merges all matching results collected by the enforcer into a single decision. */ @Override public boolean mergeEffects...
boolean result; if (expr.equals("some(where (p_eft == allow))")) { result = false; for (Effect eft : effects) { if (eft == Effect.Allow) { result = true; break; } } } else if (expr.equals...
151
386
537
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/effect/DefaultStreamEffector.java
DefaultStreamEffector
push
class DefaultStreamEffector implements StreamEffector { private final String expr; private boolean done = false; private boolean effect = false; private int explainIndex = -1; public DefaultStreamEffector(String expr) { this.expr = expr; } @Override public StreamEffectorResult ...
switch (this.expr) { case "some(where (p_eft == allow))": if (eft == Effect.Allow) { this.effect = true; explainIndex = currentIndex; this.done = true; } break; case "!some(where ...
149
361
510
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/log/DefaultLogger.java
DefaultLogger
logPolicy
class DefaultLogger implements Logger { private boolean enabled; @Override public void enableLog(boolean enable) { this.enabled = enable; } @Override public boolean isEnabled() { return enabled; } @Override public void logModel(String[][] model) { if (!enab...
if (!enabled) { return; } StringBuilder str = new StringBuilder("Policy: "); for (Map.Entry<String, String[][]> entry : policy.entrySet()) { str.append(String.format("%s : %s\n", entry.getKey(), arrayToString(entry.getValue()))); } System.out.pr...
689
99
788
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/main/EnforceResult.java
EnforceResult
toString
class EnforceResult { private boolean allow; private List<String> explain; public boolean isAllow() { return allow; } public void setAllow(boolean allow) { this.allow = allow; } public List<String> getExplain() { return explain; } public void setExplain(Li...
return "EnforceResult{" + "allow=" + allow + ", explain=" + explain + '}';
187
35
222
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/main/Frontend.java
Frontend
casbinJsGetPermissionForUser
class Frontend { public static String casbinJsGetPermissionForUser(Enforcer e, String user) {<FILL_FUNCTION_BODY>} }
Model model = e.getModel(); Map<String, Object> m = new HashMap<>(); m.put("m", model.saveModelToText().trim()); List<List<String>> policies = new ArrayList<>(); for (String ptype : model.model.get("p").keySet()) { List<List<String>> policy = model.getPolicy("p", ptype); for (List<Strin...
42
173
215
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/model/Assertion.java
Assertion
buildIncrementalRoleLinks
class Assertion { public String key; public String value; public String[] tokens; public String[] paramsTokens; public List<List<String>> policy; public Map<String, Integer> policyIndex; public RoleManager rm; public ConditionalRoleManager condRM; public int priorityIndex; privat...
this.rm = rm; int count = 0; for (int i = 0; i < value.length(); i++) { if (value.charAt(i) == '_') { count++; } } for (List<String> rule : rules) { if (count < 2) { throw new IllegalArgumentException("the numbe...
1,411
311
1,722
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/model/FunctionMap.java
FunctionMap
setAviatorEval
class FunctionMap { /** * AviatorFunction represents a function that is used in the matchers, used to get attributes in ABAC. */ public Map<String, AviatorFunction> fm; public boolean isModify = false; /** * addFunction adds an expression function. * * @param name the name of ...
if (fm.containsKey(name) && fm.get(name) instanceof CustomFunction) { ((CustomFunction) fm.get(name)).setAviatorEval(aviatorEval); }
650
55
705
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/persist/Helper.java
Helper
loadPolicyLine
class Helper { public interface loadPolicyLineHandler<T, U> { void accept(T t, U u); } public static void loadPolicyLine(String line, Model model) {<FILL_FUNCTION_BODY>} }
if ("".equals(line)) { return; } if (line.charAt(0) == '#') { return; } String[] tokens = splitCommaDelimited(line); String key = tokens[0]; String sec = key.substring(0, 1); Assertion ast = model.model.get(sec).get(key); ...
64
166
230
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/persist/file_adapter/AdapterMock.java
AdapterMock
loadPolicy
class AdapterMock implements Adapter { private String filePath; private String errorValue; public AdapterMock(String filePath) { this.filePath = filePath; } public void setMockErr(String errorToSet) { this.errorValue = errorToSet; } public Exception getMockErr() { ...
try { loadPolicyFile(model, Helper::loadPolicyLine); } catch (IOException e) { e.printStackTrace(); }
366
42
408
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/persist/file_adapter/FileAdapter.java
FileAdapter
getModelPolicy
class FileAdapter implements Adapter { private String filePath; private boolean readOnly = false; private ByteArrayInputStream byteArrayInputStream; /** * FileAdapter is the constructor for FileAdapter. * * @param filePath the path of the policy file. */ public FileAdapter(Strin...
List<String> policy = new ArrayList<>(); Optional.ofNullable(model.model.get(ptype)).ifPresent(entry -> entry.forEach((k, v) -> { List<String> p = v.policy.parallelStream().map(x -> k + ", " + Util.arrayToString(x)).collect(Collectors.toList()); policy.addAll(p); })); ...
1,254
106
1,360
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/persist/file_adapter/FilteredAdapter.java
FilteredAdapter
loadFilteredPolicy
class FilteredAdapter implements org.casbin.jcasbin.persist.FilteredAdapter { private Adapter adapter; private boolean isFiltered = true; private String filepath; public FilteredAdapter(String filepath) { adapter = new FileAdapter(filepath); this.filepath = filepath; } /** ...
if ("".equals(filepath)) { throw new CasbinAdapterException("Invalid file path, file path cannot be empty."); } if (filter == null) { adapter.loadPolicy(model); isFiltered = false; return; } if (!(filter instanceof Filter)) { ...
1,100
149
1,249
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/rbac/ConditionalRoleManager.java
ConditionalRoleManager
hasLinkHelper
class ConditionalRoleManager extends DefaultRoleManager{ public ConditionalRoleManager(int maxHierarchyLevel) { super(maxHierarchyLevel); } public ConditionalRoleManager(int maxHierarchyLevel, BiPredicate<String, String> matchingFunc, BiPredicate<String, String> domainMatchingFunc) { super(...
if (level < 0 || roles.isEmpty()) { return false; } Map<String, Role> nextRoles = new HashMap<>(); for (Role role : roles.values()) { if (targetName.equals(role.getName()) || (matchingFunc != null && match(role.getName(), targetName))) { return tr...
1,584
173
1,757
<methods>public void <init>(int) ,public void <init>(int, BiPredicate<java.lang.String,java.lang.String>, BiPredicate<java.lang.String,java.lang.String>) ,public void addDomainMatchingFunc(java.lang.String, BiPredicate<java.lang.String,java.lang.String>) ,public transient void addLink(java.lang.String, java.lang.String...
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/rbac/DomainManager.java
DomainManager
match
class DomainManager implements RoleManager { private static final String DEFAULT_DOMAIN = "casbin::default"; private Map<String, DefaultRoleManager> rmMap; private int maxHierarchyLevel; private BiPredicate<String, String> matchingFunc; private BiPredicate<String, String> domainMatchingFunc; pri...
String cacheKey = String.join("$$", str, pattern); Boolean matched = this.domainMatchingFuncCache.get(cacheKey); if (matched == null) { if (this.domainMatchingFunc != null) { matched = this.domainMatchingFunc.test(str, pattern); } else { ...
1,418
122
1,540
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/rbac/GroupRoleManager.java
GroupRoleManager
hasLink
class GroupRoleManager extends DefaultRoleManager { /** * GroupRoleManager is the constructor for creating an instance of the * GroupRoleManager implementation. * * @param maxHierarchyLevel the maximized allowed RBAC hierarchy level. */ public GroupRoleManager(int maxHierarchyLevel) { ...
if(super.hasLink(name1, name2, domain)) { return true; } // check name1's groups if (domain.length == 1) { try { List<String> groups = Optional.ofNullable(super.getRoles(name1)).orElse(new ArrayList<>()); for(String group : groups)...
165
146
311
<methods>public void <init>(int) ,public void <init>(int, BiPredicate<java.lang.String,java.lang.String>, BiPredicate<java.lang.String,java.lang.String>) ,public void addDomainMatchingFunc(java.lang.String, BiPredicate<java.lang.String,java.lang.String>) ,public transient void addLink(java.lang.String, java.lang.String...
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/rbac/LinkConditionFuncKey.java
LinkConditionFuncKey
equals
class LinkConditionFuncKey { private String roleName; private String domainName; public LinkConditionFuncKey(String roleName, String domainName) { this.roleName = roleName; this.domainName = domainName; } public String getRoleName() { return roleName; } public void...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LinkConditionFuncKey that = (LinkConditionFuncKey) o; return Objects.equals(roleName, that.roleName) && Objects.equals(domainName, that.domainName);
213
83
296
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/rbac/Role.java
Role
removeMatches
class Role { private final String name; final Map<String, Role> roles; private final Map<String, Role> users; private final Map<String, Role> matched; private final Map<String, Role> matchedBy; private final Map<LinkConditionFuncKey, Function<String[], Boolean>> linkConditionFuncMap; private...
Iterator<Map.Entry<String, Role>> iterator = this.matchedBy.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, Role> entry = iterator.next(); Role role = entry.getValue(); role.matched.remove(this.name); iterator.remove(); } ...
1,328
92
1,420
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/BuiltInFunctions.java
GenerateConditionalGFunctionClass
timeMatch
class GenerateConditionalGFunctionClass { // key:name such as g,g2 value:user-role mapping private static Map<String, Map<String, AviatorBoolean>> memorizedMap = new ConcurrentHashMap<>(); /** * GenerateConditionalGFunction is the factory method of the g(_, _[, _]) function with condi...
LocalDateTime now = LocalDateTime.now(); if (!startTime.equals("_")) { LocalDateTime start; // special process for "0000" year,LocalDateTime range is 1-999999999 if (startTime.startsWith("0000")){ start = LocalDateTime.MIN; }else { ...
1,029
297
1,326
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/Glob.java
Glob
toRegexPattern
class Glob { private static final String REGEX_META_CHARS = ".^$+{[]|()"; private static final String GLOB_META_CHARS = "\\*?[{"; /** * Creates a regex pattern from the given glob expression. * * @param globPattern the given glob expression * @return the regex pattern */ publi...
boolean inGroup = false; StringBuilder regex = new StringBuilder("^"); int i = 0; while (i < globPattern.length()) { char c = globPattern.charAt(i++); switch (c) { case '\\': // escape special characters if...
243
1,059
1,302
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/CustomFunction.java
CustomFunction
replaceTargets
class CustomFunction extends AbstractFunction { private AviatorEvaluatorInstance aviatorEval; public String replaceTargets(String exp, Map<String, Object> env) {<FILL_FUNCTION_BODY>} public AviatorEvaluatorInstance getAviatorEval() { return aviatorEval; } public void setAviatorEval(Aviat...
//Replace the first dot, because it can't be recognized by the 'reg' below. if (exp.startsWith( "r") || exp.startsWith( "p")) { exp = exp.replaceFirst("\\.","_"); } //match example: "&&r.","||r.","=r." String reg = "([| =)(&<>,+\\-*/!])((r|p)[0-9]*)\\."; exp ...
135
139
274
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/EvalFunc.java
EvalFunc
call
class EvalFunc extends CustomFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "eval"; } }
String eval = FunctionUtils.getStringValue(arg1, env); eval = replaceTargets(eval, env); return AviatorBoolean.valueOf(BuiltInFunctions.eval(eval, env, getAviatorEval()));
75
63
138
<methods>public non-sealed void <init>() ,public AviatorEvaluatorInstance getAviatorEval() ,public java.lang.String replaceTargets(java.lang.String, Map<java.lang.String,java.lang.Object>) ,public void setAviatorEval(AviatorEvaluatorInstance) <variables>private AviatorEvaluatorInstance aviatorEval
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/GlobMatchFunc.java
GlobMatchFunc
call
class GlobMatchFunc extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "globMatch"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); return AviatorBoolean.valueOf(BuiltInFunctions.globMatch(key1, key2));
83
64
147
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/IPMatchFunc.java
IPMatchFunc
call
class IPMatchFunc extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "ipMatch"; } }
String ip1 = FunctionUtils.getStringValue(arg1, env); String ip2 = FunctionUtils.getStringValue(arg2, env); return AviatorBoolean.valueOf(BuiltInFunctions.ipMatch(ip1, ip2));
82
64
146
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/KeyGet2Func.java
KeyGet2Func
call
class KeyGet2Func extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2, AviatorObject arg3) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "keyGet2"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); String pathVar = FunctionUtils.getStringValue(arg3, env); return new AviatorString(BuiltInFunctions.keyGet2Func(key1, key2, pathVar));
91
84
175
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/KeyGetFunc.java
KeyGetFunc
call
class KeyGetFunc extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "keyGet"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); return new AviatorString(BuiltInFunctions.keyGetFunc(key1, key2));
82
63
145
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/KeyMatch2Func.java
KeyMatch2Func
call
class KeyMatch2Func extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "keyMatch2"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); return AviatorBoolean.valueOf(BuiltInFunctions.keyMatch2(key1, key2));
84
65
149
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/KeyMatch3Func.java
KeyMatch3Func
call
class KeyMatch3Func extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "keyMatch3"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); return AviatorBoolean.valueOf(BuiltInFunctions.keyMatch3(key1, key2));
84
65
149
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/KeyMatch4Func.java
KeyMatch4Func
call
class KeyMatch4Func extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "keyMatch4"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); return AviatorBoolean.valueOf(BuiltInFunctions.keyMatch4(key1, key2));
84
65
149
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/KeyMatch5Func.java
KeyMatch5Func
call
class KeyMatch5Func extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "keyMatch5"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); return AviatorBoolean.valueOf(BuiltInFunctions.keyMatch5(key1, key2));
85
65
150
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/KeyMatchFunc.java
KeyMatchFunc
call
class KeyMatchFunc extends AbstractFunction { @Override public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "keyMatch"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); return AviatorBoolean.valueOf(BuiltInFunctions.keyMatch(key1, key2));
82
64
146
<no_super_class>
casbin_jcasbin
jcasbin/src/main/java/org/casbin/jcasbin/util/function/RegexMatchFunc.java
RegexMatchFunc
call
class RegexMatchFunc extends AbstractFunction { public AviatorObject call(Map<String, Object> env, AviatorObject arg1, AviatorObject arg2) {<FILL_FUNCTION_BODY>} @Override public String getName() { return "regexMatch"; } }
String key1 = FunctionUtils.getStringValue(arg1, env); String key2 = FunctionUtils.getStringValue(arg2, env); return AviatorBoolean.valueOf(BuiltInFunctions.regexMatch(key1, key2));
79
64
143
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/executor/MqThreadExecutor.java
MqThreadExecutor
mqQueue4PayOrderMchNotifyExecutor
class MqThreadExecutor { public static final String EXECUTOR_PAYORDER_MCH_NOTIFY = "mqQueue4PayOrderMchNotifyExecutor"; /* * 功能描述: * 支付结果通知到商户的异步执行器 (由于量大, 单独新建一个线程池处理, 之前的不做变动 ) * 20, 300, 10, 60 该配置: 同一时间最大并发量300,(已经验证通过, 商户都可以收到请求消息) * 缓存队列尽量减少,否则将堵塞在队列中无法执行。 corePoolSize 根据机器的配置进行添加。...
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(20); // 线程池维护线程的最少数量 executor.setMaxPoolSize(300); // 线程池维护线程的最大数量 executor.setQueueCapacity(10); // 缓存队列 executor.setThreadNamePrefix("payOrderMchNotifyExecutor-"); // rejection-po...
231
223
454
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/activemq/ActiveMQConfig.java
ActiveMQConfig
init
class ActiveMQConfig { Map<String, Destination> map = new ConcurrentHashMap<>(); public Destination getDestination(AbstractMQ mqModel){ if(map.get(mqModel.getMQName()) == null){ this.init(mqModel.getMQName(), mqModel.getMQType()); } return map.get(mqModel.getMQName()); ...
if(mqSendTypeEnum == MQSendTypeEnum.QUEUE){ map.put(mqName, new ActiveMQQueue(mqName) ); }else{ map.put(mqName, new ActiveMQTopic(mqName) ); }
272
74
346
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/activemq/ActiveMQSender.java
ActiveMQSender
send
class ActiveMQSender implements IMQSender { @Autowired private ActiveMQConfig activeMQConfig; @Autowired private JmsTemplate jmsTemplate; @Override public void send(AbstractMQ mqModel) { jmsTemplate.convertAndSend(activeMQConfig.getDestination(mqModel), mqModel.toMessage()); } ...
jmsTemplate.send(activeMQConfig.getDestination(mqModel), session -> { TextMessage tm = session.createTextMessage(mqModel.toMessage()); tm.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay * 1000); tm.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_PERIOD, 1*1000); ...
138
153
291
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/aliyunrocketmq/AliYunRocketMQFactory.java
AliYunRocketMQFactory
broadcastConsumerClient
class AliYunRocketMQFactory { public static final String defaultTag = "Default"; @Value("${aliyun-rocketmq.namesrvAddr:}") public String namesrvAddr; @Value("${aliyun-rocketmq.accessKey}") private String accessKey; @Value("${aliyun-rocketmq.secretKey}") private String secretKey; @Value...
Properties properties = new Properties(); properties.put(PropertyKeyConst.GROUP_ID, groupId); properties.put(PropertyKeyConst.AccessKey, accessKey); properties.put(PropertyKeyConst.SecretKey, secretKey); // 广播订阅方式设置 properties.put(PropertyKeyConst.MessageModel, PropertyV...
515
182
697
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/aliyunrocketmq/AliYunRocketMQSender.java
AliYunRocketMQSender
send
class AliYunRocketMQSender implements IMQSender { /** 最大延迟24小时 */ private static final int MAX_DELAY_TIME = 60 * 60 * 24; /** 最小延迟1秒 */ private static final int MIN_DELAY_TIME = 1; @Autowired private AliYunRocketMQFactory aliYunRocketMQFactory; private Producer producerClient; @Overri...
Message message = new Message(mqModel.getMQName(), AliYunRocketMQFactory.defaultTag, mqModel.toMessage().getBytes()); if (delaySeconds > 0) { long delayTime = System.currentTimeMillis() + delayTimeCorrector(delaySeconds) * 1000; // 设置消息需要被投递的时间。 message.setStartDeliv...
422
119
541
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/rabbitmq/RabbitMQBeanProcessor.java
RabbitMQBeanProcessor
delayedExchange
class RabbitMQBeanProcessor implements BeanDefinitionRegistryPostProcessor { /** bean注册器 **/ protected BeanDefinitionRegistry beanDefinitionRegistry; @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException { this.beanDefiniti...
Map<String, Object> args = new HashMap<>(); args.put("x-delayed-type", "direct"); return new CustomExchange(RabbitMQConfig.DELAYED_EXCHANGE_NAME, "x-delayed-message", true, false, args);
181
73
254
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/rabbitmq/RabbitMQConfig.java
RabbitMQConfig
init
class RabbitMQConfig { /** 全局定义延迟交换机名称 **/ public static final String DELAYED_EXCHANGE_NAME = "delayedExchange"; /** 扇形交换机前缀(activeMQ中的topic模式), 需根据queue动态拼接 **/ public static final String FANOUT_EXCHANGE_NAME_PREFIX = "fanout_exchange_"; /** 注入延迟交换机Bean **/ @Autowired @Qualifier(DELAYED_...
// 获取到所有的MQ定义 Set<Class<?>> set = ClassUtil.scanPackageBySuper(ClassUtil.getPackage(AbstractMQ.class), AbstractMQ.class); for (Class<?> aClass : set) { // 实例化 AbstractMQ amq = (AbstractMQ) ReflectUtil.newInstance(aClass); // 注册Queue === new Queue(name), ...
234
636
870
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/rabbitmq/RabbitMQSender.java
RabbitMQSender
send
class RabbitMQSender implements IMQSender { @Autowired private RabbitTemplate rabbitTemplate; @Override public void send(AbstractMQ mqModel) {<FILL_FUNCTION_BODY>} @Override public void send(AbstractMQ mqModel, int delay) { if(mqModel.getMQType() == MQSendTypeEnum.QUEUE){ ...
if(mqModel.getMQType() == MQSendTypeEnum.QUEUE){ rabbitTemplate.convertAndSend(mqModel.getMQName(), mqModel.toMessage()); }else{ // fanout模式 的 routeKEY 没意义。 this.rabbitTemplate.convertAndSend(RabbitMQConfig.FANOUT_EXCHANGE_NAME_PREFIX + mqModel.getMQName(), null, ...
282
127
409
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/rocketmq/RocketMQSender.java
RocketMQSender
getNearDelayLevel
class RocketMQSender implements IMQSender { private static final List<Integer> DELAY_TIME_LEVEL = new ArrayList<>(); static{ // 预设值的延迟时间间隔为:1s、 5s、 10s、 30s、 1m、 2m、 3m、 4m、 5m、 6m、 7m、 8m、 9m、 10m、 20m、 30m、 1h、 2h DELAY_TIME_LEVEL.add(1); DELAY_TIME_LEVEL.add(5); DELAY_TIME_LE...
// 如果包含则直接返回 if(DELAY_TIME_LEVEL.contains(delay)){ return DELAY_TIME_LEVEL.indexOf(delay) + 1; } //两个时间的绝对值 - 位置 TreeMap<Integer, Integer> resultMap = new TreeMap<>(); DELAY_TIME_LEVEL.stream().forEach(time -> resultMap.put(Math.abs(delay - time), DELAY_TIM...
671
136
807
<no_super_class>
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-oss/src/main/java/com/jeequan/jeepay/components/oss/ctrl/OssFileController.java
OssFileController
singleFileUpload
class OssFileController extends AbstractCtrl { @Autowired private IOssService ossService; /** 上传文件 (单文件上传) */ @PostMapping("/{bizType}") public ApiRes singleFileUpload(@RequestParam("file") MultipartFile file, @PathVariable("bizType") String bizType) {<FILL_FUNCTION_BODY>} }
if( file == null ) { return ApiRes.fail(ApiCodeEnum.SYSTEM_ERROR, "选择文件不存在"); } try { OssFileConfig ossFileConfig = OssFileConfig.getOssFileConfigByBizType(bizType); //1. 判断bizType 是否可用 if(ossFileConfig == null){ throw new BizEx...
104
440
544
<methods>public non-sealed void <init>() ,public java.lang.Long getAmountL(java.lang.String) ,public java.lang.String getClientIp() ,public java.lang.Long getRequiredAmountL(java.lang.String) ,public java.lang.String getUserAgent() ,public transient void handleParamAmount(java.lang.String[]) ,public Map<java.lang.Strin...
jeequan_jeepay
jeepay/jeepay-components/jeepay-components-oss/src/main/java/com/jeequan/jeepay/components/oss/model/OssFileConfig.java
OssFileConfig
isMaxSizeLimit
class OssFileConfig { /** 用户头像 **/ interface BIZ_TYPE { String AVATAR = "avatar"; /** 用户头像 **/ String IF_BG = "ifBG"; /** 接口类型卡片背景图片 **/ String CERT = "cert"; /** 接口参数 **/ } /** 图片类型后缀格式 **/ public static final Set IMG_SUFFIX = new HashSet(Arrays.asList("jpg", "png", "jpeg...
if(ALL_MAX_SIZE.equals(this.maxSize)){ //允许全部大小 return true; } return this.maxSize >= ( fileSize == null ? 0L : fileSize);
746
55
801
<no_super_class>