proj_name stringclasses 26
values | relative_path stringlengths 42 165 | class_name stringlengths 3 46 | func_name stringlengths 2 44 | masked_class stringlengths 80 7.9k | func_body stringlengths 76 5.98k | len_input int64 30 1.88k | len_output int64 25 1.43k | total int64 73 2.03k | initial_context stringclasses 74
values |
|---|---|---|---|---|---|---|---|---|---|
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-protobuf/src/main/java/com/jarvis/cache/serializer/protobuf/HeapByteBufUtil.java | HeapByteBufUtil | setIntLE | class HeapByteBufUtil {
static byte getByte(byte[] memory, int index) {
return memory[index];
}
static short getShort(byte[] memory, int index) {
return (short) (memory[index] << 8 | memory[index + 1] & 0xFF);
}
static short getShortLE(byte[] memory, int index) {
return (s... |
memory[index] = (byte) value;
memory[index + 1] = (byte) (value >>> 8);
memory[index + 2] = (byte) (value >>> 16);
memory[index + 3] = (byte) (value >>> 24);
| 1,590 | 74 | 1,664 | |
jitsi_jitsi | jitsi/modules/plugin/otr/src/main/java/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java | OtrMetaContactMenu | createOtrContactMenus | class OtrMetaContactMenu
extends AbstractPluginComponent
implements ActionListener,
PopupMenuListener
{
/**
* The last known <tt>MetaContact</tt> to be currently selected and to be
* depicted by this instance and the <tt>OtrContactMenu</tt>s it contains.
*/
private MetaCon... |
JMenu menu = getMenu();
// Remove any existing OtrContactMenu items.
menu.removeAll();
// Create the new OtrContactMenu items.
if (metaContact != null)
{
Iterator<Contact> contacts = metaContact.getContacts();
if (metaContact.getContactCount() ... | 1,403 | 437 | 1,840 | /**
* Provides an abstract base implementation of <code>PluginComponent</code> in order to take care of the implementation boilerplate and let implementers focus on the specifics of their plug-in.
* @author Lyubomir Marinov
*/
public abstract class AbstractPluginComponent implements PluginComponent {
/**
* The ... |
docker-java_docker-java | docker-java/docker-java-api/src/main/java/com/github/dockerjava/api/model/Device.java | Device | parse | class Device extends DockerObject implements Serializable {
private static final long serialVersionUID = 1L;
@JsonProperty("CgroupPermissions")
private String cGroupPermissions = "";
@JsonProperty("PathOnHost")
private String pathOnHost = null;
@JsonProperty("PathInContainer")
private Str... |
String src = "";
String dst = "";
String permissions = "rwm";
final String[] arr = deviceStr.trim().split(":");
// java String.split() returns wrong length, use tokenizer instead
switch (new StringTokenizer(deviceStr, ":").countTokens()) {
case 3: {
... | 686 | 297 | 983 | /**
* @see DockerObjectAccessor
*/
public abstract class DockerObject {
HashMap<String,Object> rawValues=new HashMap<>();
@JsonAnyGetter public Map<String,Object> getRawValues();
}
|
subhra74_snowflake | snowflake/muon-app/src/main/java/muon/app/ui/components/session/utilpage/services/ServiceTableCellRenderer.java | ServiceTableCellRenderer | getTableCellRendererComponent | class ServiceTableCellRenderer extends JLabel implements TableCellRenderer {
public ServiceTableCellRenderer() {
setText("HHH");
setBorder(new EmptyBorder(5, 5, 5, 5));
setOpaque(true);
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value... |
setText(value == null ? "" : value.toString());
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());
return this;
| 124 | 71 | 195 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java | AspectJExpressionPointcutAdvisor | getPointcut | class AspectJExpressionPointcutAdvisor implements PointcutAdvisor {
private AspectJExpressionPointcut pointcut;
private Advice advice;
private String expression;
public void setExpression(String expression) {
this.expression = expression;
}
@Override
public Pointcut getPointcut() {<FILL_FUNCTION_BODY>}
... |
if (pointcut == null) {
pointcut = new AspectJExpressionPointcut(expression);
}
return pointcut;
| 135 | 38 | 173 | |
Pay-Group_best-pay-sdk | best-pay-sdk/src/main/java/com/lly835/bestpay/service/impl/wx/WxPayMicroServiceImpl.java | WxPayMicroServiceImpl | pay | class WxPayMicroServiceImpl extends WxPayServiceImpl {
/**
* 微信付款码支付
* 提交支付请求后微信会同步返回支付结果。
* 当返回结果为“系统错误 {@link WxPayConstants#SYSTEMERROR}”时,商户系统等待5秒后调用【查询订单API {@link WxPayServiceImpl#query(OrderQueryRequest)}】,查询支付实际交易结果;
* 当返回结果为“正在支付 {@link WxPayConstants#USERPAYING}”时,商户系统可设置间隔时间(建议10秒)重新... |
WxPayUnifiedorderRequest wxRequest = new WxPayUnifiedorderRequest();
wxRequest.setOutTradeNo(request.getOrderId());
wxRequest.setTotalFee(MoneyUtil.Yuan2Fen(request.getOrderAmount()));
wxRequest.setBody(request.getOrderName());
wxRequest.setOpenid(request.getOpenid());
w... | 218 | 535 | 753 | /**
* Created by 廖师兄 2017-07-02 13:40
*/
@Slf4j public class WxPayServiceImpl extends BestPayServiceImpl {
protected WxPayConfig wxPayConfig;
protected final Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).client(new OkHttpCli... |
pmd_pmd | pmd/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/multithreading/DoubleCheckedLockingRule.java | DoubleCheckedLockingRule | visit | class DoubleCheckedLockingRule extends AbstractJavaRule {
@Override
protected @NonNull RuleTargetSelector buildTargetSelector() {
return RuleTargetSelector.forTypes(ASTMethodDeclaration.class);
}
@Override
public Object visit(ASTMethodDeclaration node, Object data) {<FILL_FUNCTION_BODY>}
... |
if (node.isVoid() || node.getResultTypeNode() instanceof ASTPrimitiveType || node.getBody() == null) {
return data;
}
List<ASTReturnStatement> rsl = node.descendants(ASTReturnStatement.class).toList();
if (rsl.size() != 1) {
return data;
}
ASTRet... | 389 | 574 | 963 | |
subhra74_snowflake | snowflake/muon-app/src/main/java/muon/app/ui/laf/AppSkinDark.java | AppSkinDark | initDefaultsDark | class AppSkinDark extends AppSkin {
/**
*
*/
public AppSkinDark() {
initDefaultsDark();
}
private void initDefaultsDark() {<FILL_FUNCTION_BODY>}
} |
Color selectionColor = new Color(3, 155, 229);
Color controlColor = new Color(40, 44, 52);
Color textColor = new Color(230, 230, 230);
Color selectedTextColor = new Color(230, 230, 230);
Color infoTextColor = new Color(180, 180, 180);
Color borderColor = new Color(24, 26, 31);
Color treeTextColo... | 77 | 1,434 | 1,511 | /**
* @author subhro
*/
public abstract class AppSkin {
protected UIDefaults defaults;
protected NimbusLookAndFeel laf;
/**
*/
public AppSkin();
private void initDefaults();
/**
* @return the laf
*/
public NimbusLookAndFeel getLaf();
protected Font loadFonts();
protected Font loadFontAwesomeFo... |
spring-cloud_spring-cloud-gateway | spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/filter/ReactiveLoadBalancerClientFilter.java | ReactiveLoadBalancerClientFilter | choose | class ReactiveLoadBalancerClientFilter implements GlobalFilter, Ordered {
private static final Log log = LogFactory.getLog(ReactiveLoadBalancerClientFilter.class);
/**
* Order of filter.
*/
public static final int LOAD_BALANCER_CLIENT_FILTER_ORDER = 10150;
private final LoadBalancerClientFactory clientFactor... |
ReactorLoadBalancer<ServiceInstance> loadBalancer = this.clientFactory.getInstance(serviceId,
ReactorServiceInstanceLoadBalancer.class);
if (loadBalancer == null) {
throw new NotFoundException("No loadbalancer available for " + serviceId);
}
supportedLifecycleProcessors.forEach(lifecycle -> lifecycle.on... | 1,522 | 117 | 1,639 | |
PlexPt_chatgpt-java | chatgpt-java/src/main/java/com/plexpt/chatgpt/Images.java | Images | init | class Images {
/**
* keys
*/
private String apiKey;
private List<String> apiKeyList;
/**
* 自定义api host使用builder的方式构造client
*/
@Builder.Default
private String apiHost = Api.DEFAULT_API_HOST;
private Api apiClient;
private OkHttpClient okHttpClient;
/**
* 超时 默... |
OkHttpClient.Builder client = new OkHttpClient.Builder();
client.addInterceptor(chain -> {
Request original = chain.request();
String key = apiKey;
if (apiKeyList != null && !apiKeyList.isEmpty()) {
key = RandomUtil.randomEle(apiKeyList);
... | 571 | 512 | 1,083 | |
orientechnologies_orientdb | orientdb/core/src/main/java/com/orientechnologies/orient/core/index/ORuntimeKeyIndexDefinition.java | ORuntimeKeyIndexDefinition | toCreateIndexDDL | class ORuntimeKeyIndexDefinition<T> extends OAbstractIndexDefinition {
private static final long serialVersionUID = -8855918974071833818L;
private transient OBinarySerializer<T> serializer;
@SuppressWarnings("unchecked")
public ORuntimeKeyIndexDefinition(final byte iId) {
super();
serializer =
... |
return "create index `" + indexName + "` " + indexType + ' ' + "runtime " + serializer.getId();
| 996 | 34 | 1,030 | /**
* Abstract index definiton implementation.
* @author Luca Garulli (l.garulli--(at)--orientdb.com)
*/
public abstract class OAbstractIndexDefinition implements OIndexDefinition {
protected OCollate collate=new ODefaultCollate();
private boolean nullValuesIgnored=true;
protected ODocument document;
protec... |
zhkl0228_unidbg | unidbg/unidbg-ios/src/main/java/com/github/unidbg/hook/HookLoader.java | HookLoader | load | class HookLoader extends BaseHook {
private static final Log log = LogFactory.getLog(HookLoader.class);
public static HookLoader load(Emulator<?> emulator) {<FILL_FUNCTION_BODY>}
private final Symbol _hook_objc_msgSend;
private final Symbol _hook_dispatch_async;
private HookLoader(Emulator<?> em... |
Substrate.getInstance(emulator); // load substrate first
FishHook.getInstance(emulator); // load fishhook
HookLoader loader = emulator.get(HookLoader.class.getName());
if (loader == null) {
loader = new HookLoader(emulator);
emulator.set(HookLoader.class.getName... | 1,034 | 98 | 1,132 | public abstract class BaseHook implements IHook {
protected final Emulator<?> emulator;
protected final Module module;
public BaseHook( Emulator<?> emulator, String libName);
protected Pointer createReplacePointer( final ReplaceCallback callback, final Pointer backup, boolean enablePostCall);
protected L... |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/support/data/WordDataTree.java | WordDataTree | initWordData | class WordDataTree implements IWordData {
/**
* 根节点
*/
private WordDataTreeNode root;
@Override
public synchronized void initWordData(Collection<String> collection) {<FILL_FUNCTION_BODY>}
@Override
public WordContainsTypeEnum contains(StringBuilder stringBuilder,
... |
WordDataTreeNode newRoot = new WordDataTreeNode();
for(String word : collection) {
if(StringUtil.isEmpty(word)) {
continue;
}
WordDataTreeNode tempNode = newRoot;
char[] chars = word.toCharArray();
for (char c : chars) {
... | 577 | 240 | 817 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/context/support/AbstractXmlApplicationContext.java | AbstractXmlApplicationContext | loadBeanDefinitions | class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {<FILL_FUNCTION_BODY>}
protected abstract String[] getConfigLocations();
} |
XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
String[] configLocations = getConfigLocations();
if (configLocations != null) {
beanDefinitionReader.loadBeanDefinitions(configLocations);
}
| 60 | 71 | 131 | /**
* @author derekyi
* @date 2020/11/28
*/
public abstract class AbstractRefreshableApplicationContext extends AbstractApplicationContext {
private DefaultListableBeanFactory beanFactory;
/**
* 创建beanFactory并加载BeanDefinition
* @throws BeansException
*/
protected final void refreshBeanFactory() throws Bea... |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java | ApplicationContextAwareProcessor | postProcessBeforeInitialization | class ApplicationContextAwareProcessor implements BeanPostProcessor {
private final ApplicationContext applicationContext;
public ApplicationContextAwareProcessor(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@Override
public Object postProcessBeforeInitialization(Ob... |
if (bean instanceof ApplicationContextAware) {
((ApplicationContextAware) bean).setApplicationContext(applicationContext);
}
return bean;
| 120 | 41 | 161 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/TypeUtil.java | TypeUtil | buildClass | class TypeUtil {
public static JClass resolveType(JClassContainer _package, String typeDefinition) {
try {
FieldDeclaration fieldDeclaration = (FieldDeclaration) JavaParser.parseBodyDeclaration(typeDefinition + " foo;");
ClassOrInterfaceType c = (ClassOrInterfaceType) ((ReferenceTy... |
final String packagePrefix = (c.getScope() != null) ? c.getScope().toString() + "." : "";
JClass _class = _package.owner().ref(packagePrefix + c.getName());
for (int i = 0; i < arrayCount; i++) {
_class = _class.array();
}
List<Type> typeArgs = c.getTypeArgs();
... | 177 | 418 | 595 | |
PlayEdu_PlayEdu | PlayEdu/playedu-common/src/main/java/xyz/playedu/common/util/RedisDistributedLock.java | RedisDistributedLock | releaseLock | class RedisDistributedLock {
private final StringRedisTemplate redisTemplate;
private final ThreadLocal<String> lockValue = new ThreadLocal<>();
public RedisDistributedLock(StringRedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
public boolean tryLock(String key, long e... |
String value = lockValue.get();
if (value == null) {
return false;
}
DefaultRedisScript<Boolean> script =
new DefaultRedisScript<>(
"if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del',"
... | 197 | 161 | 358 | |
logfellow_logstash-logback-encoder | logstash-logback-encoder/src/main/java/net/logstash/logback/composite/GlobalCustomFieldsJsonProvider.java | GlobalCustomFieldsJsonProvider | setCustomFieldsNode | class GlobalCustomFieldsJsonProvider<Event extends DeferredProcessingAware> extends AbstractJsonProvider<Event> implements JsonFactoryAware {
/**
* The un-parsed custom fields string to use to initialize customFields
* when the formatter is started.
*/
private String customFields;
/**
... |
if (isStarted()) {
throw new IllegalStateException("Configuration cannot be changed while the provider is started");
}
this.customFieldsNode = customFields;
this.customFields = null;
| 1,017 | 55 | 1,072 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/MinimumMaximumRule.java | MinimumMaximumRule | isApplicableType | class MinimumMaximumRule implements Rule<JFieldVar, JFieldVar> {
private final RuleFactory ruleFactory;
protected MinimumMaximumRule(RuleFactory ruleFactory) {
this.ruleFactory = ruleFactory;
}
@Override
public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar fie... |
try {
Class<?> fieldClass = Class.forName(field.type().boxify().fullName());
// Support Strings and most number types except Double and Float, per docs on DecimalMax/Min annotations
return String.class.isAssignableFrom(fieldClass) ||
(Number.class.isAssig... | 387 | 142 | 529 | |
subhra74_snowflake | snowflake/muon-jediterm/src/main/java/com/jediterm/terminal/model/hyperlinks/TextProcessing.java | TextProcessing | doProcessHyperlinks | class TextProcessing {
private static final Logger LOG = Logger.getLogger(TextProcessing.class);
private final List<HyperlinkFilter> myHyperlinkFilter;
private TextStyle myHyperlinkColor;
private HyperlinkStyle.HighlightMode myHighlightMode;
private TerminalTextBuffer myTerminalTextBuffer;
public TextPro... |
myTerminalTextBuffer.lock();
try {
int updatedLineInd = findLineInd(buffer, updatedLine);
if (updatedLineInd == -1) {
// When lines arrive fast enough, the line might be pushed to the history buffer already.
updatedLineInd = findHistoryLineInd(myTerminalTextBuffer.getHistoryBuffer()... | 663 | 528 | 1,191 | |
obsidiandynamics_kafdrop | kafdrop/src/main/java/kafdrop/model/ConsumerPartitionVO.java | ConsumerPartitionVO | toString | class ConsumerPartitionVO {
private final String groupId;
private final String topic;
private final int partitionId;
private long offset;
private long size;
private long firstOffset;
public ConsumerPartitionVO(String groupId, String topic, int partitionId) {
this.groupId = groupId;
this.topic = t... |
return ConsumerPartitionVO.class.getSimpleName() + " [groupId=" + groupId +
", topic=" + topic + ", partitionId=" + partitionId + ", offset=" + offset +
", size=" + size + ", firstOffset=" + firstOffset + "]";
| 358 | 73 | 431 | |
joelittlejohn_jsonschema2pojo | jsonschema2pojo/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PatternRule.java | PatternRule | isApplicableType | class PatternRule implements Rule<JFieldVar, JFieldVar> {
private RuleFactory ruleFactory;
public PatternRule(RuleFactory ruleFactory) {
this.ruleFactory = ruleFactory;
}
@Override
public JFieldVar apply(String nodeName, JsonNode node, JsonNode parent, JFieldVar field, Schema currentSchem... |
try {
Class<?> fieldClass = Class.forName(field.type().boxify().fullName());
return String.class.isAssignableFrom(fieldClass);
} catch (ClassNotFoundException ignore) {
return false;
}
| 249 | 66 | 315 | |
qiujiayu_AutoLoadCache | AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-api/src/main/java/com/jarvis/cache/serializer/CompressorSerializer.java | CompressorSerializer | serialize | class CompressorSerializer implements ISerializer<Object> {
private static final int DEFAULT_COMPRESSION_THRESHOLD = 16384;
private int compressionThreshold = DEFAULT_COMPRESSION_THRESHOLD;
private final ISerializer<Object> serializer;
private final ICompressor compressor;
public CompressorSeri... |
if (null == obj) {
return null;
}
byte[] data = serializer.serialize(obj);
byte flag = 0;
if (data.length > compressionThreshold) {
data = compressor.compress(new ByteArrayInputStream(data));
flag = 1;
}
byte[] out = new byte[d... | 633 | 130 | 763 | |
logfellow_logstash-logback-encoder | logstash-logback-encoder/src/main/java/net/logstash/logback/mask/RegexValueMasker.java | RegexValueMasker | mask | class RegexValueMasker implements ValueMasker {
private final Pattern pattern;
private final Object mask;
/**
* @param regex the regex used to identify values to mask
* @param mask the value to write for values that match the regex (can contain back references to capture groups in the regex)
... |
if (o instanceof CharSequence) {
Matcher matcher = pattern.matcher((CharSequence) o);
if (mask instanceof String) {
String replaced = matcher.replaceAll((String) mask);
if (replaced != o) {
return replaced;
}
... | 254 | 102 | 356 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java | TokenAuthenticationFilter | doFilterInternal | class TokenAuthenticationFilter extends OncePerRequestFilter {
private final SecurityProperties securityProperties;
private final GlobalExceptionHandler globalExceptionHandler;
private final OAuth2TokenApi oauth2TokenApi;
@Override
@SuppressWarnings("NullableProblems")
protected void doFilte... |
String token = SecurityFrameworkUtils.obtainAuthorization(request,
securityProperties.getTokenHeader(), securityProperties.getTokenParameter());
if (StrUtil.isNotEmpty(token)) {
Integer userType = WebFrameworkUtils.getLoginUserType(request);
try {
... | 692 | 265 | 957 | |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckEmail.java | WordCheckEmail | isStringCondition | class WordCheckEmail extends AbstractConditionWordCheck {
/**
* @since 0.3.0
*/
private static final IWordCheck INSTANCE = new WordCheckEmail();
public static IWordCheck getInstance() {
return INSTANCE;
}
@Override
protected Class<? extends IWordCheck> getSensitiveCheckClass... |
int bufferLen = stringBuilder.length();
//x@a.cn
if(bufferLen < 6) {
return false;
}
if(bufferLen > WordConst.MAX_EMAIL_LEN) {
return false;
}
String string = stringBuilder.toString();
return RegexUtil.isEmail(string);
| 226 | 92 | 318 | /**
* 抽象实现策略
* @author binbin.hou
* @since 0.3.2
*/
@ThreadSafe public abstract class AbstractConditionWordCheck extends AbstractWordCheck {
/**
* 当前字符串是否符合规范
* @param mappingChar 当前字符
* @param index 下标
* @param checkContext 校验文本
* @return 结果
* @since 0.3.2
*/
protected abstract boolean isCharCondition... |
PlayEdu_PlayEdu | PlayEdu/playedu-common/src/main/java/xyz/playedu/common/context/FCtx.java | FCtx | put | class FCtx {
private static final ThreadLocal<LinkedHashMap<String, Object>> THREAD_LOCAL =
new ThreadLocal<>();
private static final String KEY_USER_ID = "user_id";
private static final String KEY_USER = "user";
private static final String KEY_JWT_JTI = "jwt_jti";
public FCtx() {}
... |
LinkedHashMap<String, Object> hashMap = THREAD_LOCAL.get();
if (hashMap == null) {
hashMap = new LinkedHashMap<>();
}
hashMap.put(key, val);
THREAD_LOCAL.set(hashMap);
| 357 | 72 | 429 | |
subhra74_snowflake | snowflake/muon-app/src/main/java/muon/app/ui/components/session/files/view/TableCellLabelRenderer.java | TableCellLabelRenderer | getTableCellRendererComponent | class TableCellLabelRenderer implements TableCellRenderer {
private JPanel panel;
private JLabel textLabel;
private JLabel iconLabel;
private JLabel label;
private int height;
private Color foreground;
public TableCellLabelRenderer() {
foreground = App.SKIN.getInfoTextForeground();
panel = new JPa... |
FolderViewTableModel folderViewModel = (FolderViewTableModel) table.getModel();
int r = table.convertRowIndexToModel(row);
int c = table.convertColumnIndexToModel(column);
FileInfo ent = folderViewModel.getItemAt(r);
panel.setBackground(isSelected ? table.getSelectionBackground() : table.getBackgr... | 660 | 517 | 1,177 | |
Pay-Group_best-pay-sdk | best-pay-sdk/src/main/java/com/lly835/bestpay/service/impl/WxEncryptAndDecryptServiceImpl.java | WxEncryptAndDecryptServiceImpl | decrypt | class WxEncryptAndDecryptServiceImpl extends AbstractEncryptAndDecryptServiceImpl {
/**
* 密钥算法
*/
private static final String ALGORITHM = "AES";
/**
* 加解密算法/工作模式/填充方式
*/
private static final String ALGORITHM_MODE_PADDING = "AES/ECB/PKCS5Padding";
/**
* 加密
*
* @par... |
Security.addProvider(new BouncyCastleProvider());
SecretKeySpec aesKey = new SecretKeySpec(DigestUtils.md5Hex(key).toLowerCase().getBytes(), ALGORITHM);
Cipher cipher = null;
try {
cipher = Cipher.getInstance(ALGORITHM_MODE_PADDING);
} catch (NoSuchAlgorithmException... | 272 | 261 | 533 | /**
* Created by 廖师兄 2018-05-30 16:21
*/
abstract class AbstractEncryptAndDecryptServiceImpl implements EncryptAndDecryptService {
/**
* 加密
* @param key
* @param data
* @return
*/
@Override public Object encrypt( String key, String data);
/**
* 解密
* @param key
* @param data
* @return
*/
@Overri... |
subhra74_snowflake | snowflake/muon-jediterm/src/main/java/com/jediterm/terminal/TerminalStarter.java | TerminalStarter | close | class TerminalStarter implements TerminalOutputStream {
private static final Logger LOG = Logger.getLogger(TerminalStarter.class);
private final Emulator myEmulator;
private final Terminal myTerminal;
private final TerminalDataStream myDataStream;
private final TtyConnector myTtyConnector;
private final... |
execute(() -> {
try {
myTtyConnector.close();
}
catch (Exception e) {
LOG.error("Error closing terminal", e);
}
finally {
myEmulatorExecutor.shutdown();
}
});
| 807 | 70 | 877 | |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java | CglibSubclassingInstantiationStrategy | instantiate | class CglibSubclassingInstantiationStrategy implements InstantiationStrategy {
/**
* 使用CGLIB动态生成子类
*
* @param beanDefinition
* @return
* @throws BeansException
*/
@Override
public Object instantiate(BeanDefinition beanDefinition) throws BeansException {<FILL_FUNCTION_BODY>}
} |
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(beanDefinition.getBeanClass());
enhancer.setCallback((MethodInterceptor) (obj, method, argsTemp, proxy) -> proxy.invokeSuper(obj,argsTemp));
return enhancer.create();
| 93 | 80 | 173 | |
Pay-Group_best-pay-sdk | best-pay-sdk/src/main/java/com/lly835/bestpay/utils/NameValuePairUtil.java | NameValuePairUtil | convert | class NameValuePairUtil {
/**
* 将Map转换为List<{@link NameValuePair}>.
*
* @param map
* @return
*/
public static List<NameValuePair> convert(Map<String, String> map) {<FILL_FUNCTION_BODY>}
} |
List<NameValuePair> nameValuePairs = new ArrayList<>();
map.forEach((key, value) -> {
nameValuePairs.add(new BasicNameValuePair(key, value));
});
return nameValuePairs;
| 85 | 64 | 149 | |
jitsi_jitsi | jitsi/modules/plugin/ircaccregwizz/src/main/java/net/java/sip/communicator/plugin/ircaccregwizz/IrcAccRegWizzActivator.java | IrcAccRegWizzActivator | getIrcProtocolProviderFactory | class IrcAccRegWizzActivator extends DependentActivator
{
/**
* OSGi bundle context.
*/
static BundleContext bundleContext;
public IrcAccRegWizzActivator()
{
super(
ResourceManagementService.class,
UIService.class
);
}
/**
* Start the IRC ... |
ServiceReference<?>[] serRefs = null;
String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL + "=IRC)";
try
{
serRefs = bundleContext.getServiceReferences(
ProtocolProviderFactory.class.getName(), osgiFilter);
}
catch (InvalidSyntaxExcep... | 397 | 134 | 531 | /**
* Bundle activator that will start the bundle when the requested dependent services are available.
*/
public abstract class DependentActivator implements BundleActivator, ServiceTrackerCustomizer<Object,Object> {
private static final Map<BundleActivator,Set<Class<?>>> openTrackers=Collections.synchronizedMap(n... |
orientechnologies_orientdb | orientdb/core/src/main/java/com/orientechnologies/common/util/OClassLoaderHelper.java | OClassLoaderHelper | lookupProviderWithOrientClassLoader | class OClassLoaderHelper {
/**
* Switch to the OrientDb classloader before lookups on ServiceRegistry for implementation of the
* given Class. Useful under OSGI and generally under applications where jars are loaded by
* another class loader
*
* @param clazz the class to lookup foor
* @return an It... |
final ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(orientClassLoader);
try {
return ServiceLoader.load(clazz).iterator();
} catch (Exception e) {
OLogManager.instance().warn(null, "Cannot lookup in service regist... | 206 | 134 | 340 | |
zhkl0228_unidbg | unidbg/backend/hypervisor/src/main/java/com/github/unidbg/arm/backend/hypervisor/ExceptionVisitor.java | ExceptionVisitor | breakRestorerVisitor | class ExceptionVisitor {
public abstract boolean onException(Hypervisor hypervisor, int ec, long address);
static ExceptionVisitor breakRestorerVisitor(final BreakRestorer breakRestorer) {<FILL_FUNCTION_BODY>}
} |
return new ExceptionVisitor() {
@Override
public boolean onException(Hypervisor hypervisor, int ec, long address) {
breakRestorer.install(hypervisor);
return false;
}
};
| 66 | 61 | 127 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/WebpackMojo.java | WebpackMojo | execute | class WebpackMojo extends AbstractFrontendMojo {
/**
* Webpack arguments. Default is empty (runs just the "webpack" command).
*/
@Parameter(property = "frontend.webpack.arguments")
private String arguments;
/**
* Files that should be checked for changes, in addition to the srcdir files.... |
if (shouldExecute()) {
factory.getWebpackRunner().execute(arguments, environmentVariables);
if (outputdir != null) {
getLog().info("Refreshing files after webpack: " + outputdir);
buildContext.refresh(outputdir);
}
} else {
... | 467 | 105 | 572 | public abstract class AbstractFrontendMojo extends AbstractMojo {
@Component protected MojoExecution execution;
/**
* Whether you should skip while running in the test phase (default is false)
*/
@Parameter(property="skipTests",required=false,defaultValue="false") protected Boolean skipTests;
/**
* Set thi... |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/internal/model/source/selector/TargetTypeSelector.java | TargetTypeSelector | getMatchingMethods | class TargetTypeSelector implements MethodSelector {
private final TypeUtils typeUtils;
public TargetTypeSelector( TypeUtils typeUtils ) {
this.typeUtils = typeUtils;
}
@Override
public <T extends Method> List<SelectedMethod<T>> getMatchingMethods(List<SelectedMethod<T>> methods,
... |
SelectionCriteria criteria = context.getSelectionCriteria();
TypeMirror qualifyingTypeMirror = criteria.getQualifyingResultType();
if ( qualifyingTypeMirror != null && !criteria.isLifecycleCallbackRequired() ) {
List<SelectedMethod<T>> candidatesWithQualifyingTargetType =
... | 103 | 215 | 318 | |
logfellow_logstash-logback-encoder | logstash-logback-encoder/src/main/java/net/logstash/logback/composite/loggingevent/MessageJsonProvider.java | MessageJsonProvider | writeTo | class MessageJsonProvider extends AbstractFieldJsonProvider<ILoggingEvent> implements FieldNamesAware<LogstashFieldNames> {
public static final String FIELD_MESSAGE = "message";
private Pattern messageSplitPattern = null;
public MessageJsonProvider() {
setFieldName(FIELD_MESSAGE);
}
... |
if (messageSplitPattern != null) {
String[] multiLineMessage = messageSplitPattern.split(event.getFormattedMessage());
JsonWritingUtils.writeStringArrayField(generator, getFieldName(), multiLineMessage);
} else {
JsonWritingUtils.writeStringField(generator, getFieldN... | 646 | 90 | 736 | |
obsidiandynamics_kafdrop | kafdrop/src/main/java/kafdrop/config/MessageFormatConfiguration.java | MessageFormatProperties | init | class MessageFormatProperties {
private MessageFormat format;
private MessageFormat keyFormat;
@PostConstruct
public void init() {<FILL_FUNCTION_BODY>}
public MessageFormat getFormat() {
return format;
}
public void setFormat(MessageFormat format) {
this.format = format;
}... |
// Set a default message format if not configured.
if (format == null) {
format = MessageFormat.DEFAULT;
}
if (keyFormat == null) {
keyFormat = format; //fallback
}
| 139 | 59 | 198 | |
elunez_eladmin | eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MonitorServiceImpl.java | MonitorServiceImpl | getCpuInfo | class MonitorServiceImpl implements MonitorService {
private final DecimalFormat df = new DecimalFormat("0.00");
@Override
public Map<String,Object> getServers(){
Map<String, Object> resultMap = new LinkedHashMap<>(8);
try {
SystemInfo si = new SystemInfo();
Operati... |
Map<String,Object> cpuInfo = new LinkedHashMap<>();
cpuInfo.put("name", processor.getProcessorIdentifier().getName());
cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU");
cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心");
cpuInfo.put("coreN... | 1,312 | 719 | 2,031 | |
PlexPt_chatgpt-java | chatgpt-java/src/main/java/com/plexpt/chatgpt/util/SseHelper.java | SseHelper | complete | class SseHelper {
public void complete(SseEmitter sseEmitter) {<FILL_FUNCTION_BODY>}
public void send(SseEmitter sseEmitter, Object data) {
try {
sseEmitter.send(data);
} catch (Exception e) {
}
}
} |
try {
sseEmitter.complete();
} catch (Exception e) {
}
| 95 | 31 | 126 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/storage/index/Snap.java | Snap | getSnappedPoint | class Snap {
public static final int INVALID_NODE = -1;
private final GHPoint queryPoint;
private double queryDistance = Double.MAX_VALUE;
private int wayIndex = -1;
private int closestNode = INVALID_NODE;
private EdgeIteratorState closestEdge;
private GHPoint3D snappedPoint;
private Pos... |
if (snappedPoint == null)
throw new IllegalStateException("Calculate snapped point before!");
return snappedPoint;
| 1,844 | 36 | 1,880 | |
google_truth | truth/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/DiffResult.java | SingularField | printContents | class SingularField extends RecursableDiffEntity.WithResultCode
implements ProtoPrintable {
/** The type information for this field. May be absent if result code is {@code IGNORED}. */
abstract Optional<SubScopeId> subScopeId();
/** The display name for this field. May include an array-index specifie... |
if (!includeMatches && isMatched()) {
return;
}
fieldPrefix = newFieldPrefix(fieldPrefix, fieldName());
switch (result()) {
case ADDED:
sb.append("added: ").append(fieldPrefix).append(": ");
if (actual().get() instanceof Message) {
sb.append("\n"... | 739 | 531 | 1,270 | |
mapstruct_mapstruct | mapstruct/processor/src/main/java/org/mapstruct/ap/internal/model/IterableCreation.java | IterableCreation | getImportTypes | class IterableCreation extends ModelElement {
private final Type resultType;
private final Parameter sourceParameter;
private final MethodReference factoryMethod;
private final boolean canUseSize;
private final boolean loadFactorAdjustment;
private IterableCreation(Type resultType, Parameter s... |
Set<Type> types = new HashSet<>();
if ( factoryMethod == null && resultType.getImplementationType() != null ) {
types.addAll( resultType.getImplementationType().getImportTypes() );
}
if ( isEnumSet() ) {
types.add( getEnumSetElementType() );
// The r... | 477 | 114 | 591 | /**
* Base class of all model elements. Implements the {@link Writable} contract to write model elements into source codefiles.
* @author Gunnar Morling
*/
public abstract class ModelElement extends FreeMarkerWritable {
/**
* Returns a set containing those {@link Type}s referenced by this model element for wh... |
Kong_unirest-java | unirest-java/unirest-modules-jackson/src/main/java/kong/unirest/modules/jackson/JacksonElement.java | JacksonElement | getAsInt | class JacksonElement<T extends JsonNode> implements JsonEngine.Element {
protected T element;
JacksonElement(T element){
this.element = element;
}
static JsonEngine.Element wrap(JsonNode node) {
if(node == null || node.isNull()){
return new JacksonPrimitive(NullNode.getInst... |
if(!element.isIntegralNumber()) {
throw new NumberFormatException("Not a number");
}
return element.asInt();
| 978 | 38 | 1,016 | |
PlayEdu_PlayEdu | PlayEdu/playedu-common/src/main/java/xyz/playedu/common/service/impl/AdminPermissionServiceImpl.java | AdminPermissionServiceImpl | allSlugs | class AdminPermissionServiceImpl extends ServiceImpl<AdminPermissionMapper, AdminPermission>
implements AdminPermissionService {
@Override
public HashMap<String, Integer> allSlugs() {<FILL_FUNCTION_BODY>}
@Override
public List<AdminPermission> listOrderBySortAsc() {
return list(query()... |
List<AdminPermission> data = list();
HashMap<String, Integer> map = new HashMap<>();
for (AdminPermission permission : data) {
map.put(permission.getSlug(), permission.getId());
}
return map;
| 351 | 65 | 416 | |
javamelody_javamelody | javamelody/javamelody-core/src/main/java/net/bull/javamelody/MonitoringTargetInterceptor.java | MonitoringTargetInterceptor | getRequestName | class MonitoringTargetInterceptor extends MonitoringInterceptor {
private static final long serialVersionUID = 1L;
@Override
protected String getRequestName(InvocationContext context) {<FILL_FUNCTION_BODY>}
} |
final Method method = context.getMethod();
final Object target = context.getTarget();
return target.getClass().getSimpleName() + '.' + method.getName();
| 64 | 51 | 115 | /**
* Intercepteur pour EJB 3 (Java EE 5+). Il est destiné à un compteur pour les statistiques d'exécutions de méthodes sur les "façades métiers" ( @ {@link Stateless}, @ {@link Stateful} ou @{@link MessageDriven} ).Il peut être paramétré dans le fichier ejb-jar.xml pour certains ejb ou pour tous les ejb, ou alors pa... |
DerekYRC_mini-spring | mini-spring/src/main/java/org/springframework/context/support/ConversionServiceFactoryBean.java | ConversionServiceFactoryBean | registerConverters | class ConversionServiceFactoryBean implements FactoryBean<ConversionService>, InitializingBean {
private Set<?> converters;
private GenericConversionService conversionService;
@Override
public void afterPropertiesSet() throws Exception {
conversionService = new DefaultConversionService();
registerConverters(... |
if (converters != null) {
for (Object converter : converters) {
if (converter instanceof GenericConverter) {
registry.addConverter((GenericConverter) converter);
} else if (converter instanceof Converter<?, ?>) {
registry.addConverter((Converter<?, ?>) converter);
} else if (converter instan... | 193 | 170 | 363 | |
orientechnologies_orientdb | orientdb/core/src/main/java/com/orientechnologies/orient/core/index/OIndexes.java | OIndexes | createIndexEngine | class OIndexes {
private static Set<OIndexFactory> FACTORIES = null;
private static final Set<OIndexFactory> DYNAMIC_FACTORIES =
Collections.synchronizedSet(new HashSet<>());
private static ClassLoader orientClassLoader = OIndexes.class.getClassLoader();
private OIndexes() {}
/**
* Cache a set of ... |
final OIndexFactory factory =
findFactoryByAlgorithmAndType(metadata.getAlgorithm(), metadata.getIndexType());
return factory.createIndexEngine(storage, metadata);
| 1,621 | 48 | 1,669 | |
YunaiV_ruoyi-vue-pro | ruoyi-vue-pro/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/mq/rabbitmq/TenantRabbitMQInitializer.java | TenantRabbitMQInitializer | postProcessAfterInitialization | class TenantRabbitMQInitializer implements BeanPostProcessor {
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {<FILL_FUNCTION_BODY>}
} |
if (bean instanceof RabbitTemplate) {
RabbitTemplate rabbitTemplate = (RabbitTemplate) bean;
rabbitTemplate.addBeforePublishPostProcessors(new TenantRabbitMQMessagePostProcessor());
}
return bean;
| 59 | 65 | 124 | |
jitsi_jitsi | jitsi/modules/impl/protocol-sip/src/main/java/net/java/sip/communicator/impl/protocol/sip/SipApplicationData.java | SipApplicationData | getApplicationData | class SipApplicationData
{
/**
* Key service.
*/
public static final String KEY_SERVICE = "service";
/**
* Key subscriptions.
*/
public static final String KEY_SUBSCRIPTIONS = "subscriptions";
/**
* Key user request.
*/
public static final String KEY_USER_REQUEST ... |
if (container == null)
{
logger.debug("container is null");
return null;
}
if (key == null)
{
logger.warn("key is null");
return null;
}
SipApplicationData appData = getSipApplicationData(container);
if (ap... | 1,271 | 103 | 1,374 | |
graphhopper_graphhopper | graphhopper/core/src/main/java/com/graphhopper/routing/ev/MaxLength.java | MaxLength | create | class MaxLength {
public static final String KEY = "max_length";
/**
* Currently enables to store 0.1 to max=0.1*2⁷m and infinity. If a value is
* between the maximum and infinity it is assumed to use the maximum value.
*/
public static DecimalEncodedValue create() {<FILL_FUNCTION_BODY>}
} |
return new DecimalEncodedValueImpl(KEY, 7, 0, 0.1, false, false, true);
| 97 | 32 | 129 | |
subhra74_snowflake | snowflake/muon-app/src/main/java/muon/app/ui/components/session/utilpage/portview/SocketTableModel.java | SocketTableModel | getValueAt | class SocketTableModel extends AbstractTableModel {
private String columns[] = {"Process", "PID", "Host", "Port"};
private List<SocketEntry> list = new ArrayList<>();
public void addEntry(SocketEntry e) {
list.add(e);
fireTableDataChanged();
}
public void addEntries(List<S... |
SocketEntry e = list.get(rowIndex);
switch (columnIndex) {
case 0:
return e.getApp();
case 1:
return e.getPid();
case 2:
return e.getHost();
case 3:
return e.getPort();
... | 329 | 107 | 436 | |
graphhopper_graphhopper | graphhopper/web-bundle/src/main/java/com/graphhopper/http/TypeGPXFilter.java | TypeGPXFilter | filter | class TypeGPXFilter implements ContainerRequestFilter {
@Override
public void filter(ContainerRequestContext rc) {<FILL_FUNCTION_BODY>}
} |
String maybeType = rc.getUriInfo().getQueryParameters().getFirst("type");
if (maybeType != null && maybeType.equals("gpx")) {
rc.getHeaders().putSingle(HttpHeaders.ACCEPT, "application/gpx+xml");
}
| 45 | 72 | 117 | |
eirslett_frontend-maven-plugin | frontend-maven-plugin/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/InstallNodeAndPnpmMojo.java | InstallNodeAndPnpmMojo | execute | class InstallNodeAndPnpmMojo extends AbstractFrontendMojo {
/**
* Where to download Node.js binary from. Defaults to https://nodejs.org/dist/
*/
@Parameter(property = "nodeDownloadRoot", required = false)
private String nodeDownloadRoot;
/**
* Where to download pnpm binary from. Default... |
ProxyConfig proxyConfig = MojoUtils.getProxyConfig(session, decrypter);
// Use different names to avoid confusion with fields `nodeDownloadRoot` and
// `pnpmDownloadRoot`.
//
// TODO: Remove the `downloadRoot` config (with breaking change) to simplify download root
// re... | 762 | 371 | 1,133 | public abstract class AbstractFrontendMojo extends AbstractMojo {
@Component protected MojoExecution execution;
/**
* Whether you should skip while running in the test phase (default is false)
*/
@Parameter(property="skipTests",required=false,defaultValue="false") protected Boolean skipTests;
/**
* Set thi... |
houbb_sensitive-word | sensitive-word/src/main/java/com/github/houbb/sensitive/word/support/allow/WordAllows.java | WordAllows | init | class WordAllows {
private WordAllows(){}
/**
* 责任链
* @param wordAllow 允许
* @param others 其他
* @return 结果
* @since 0.0.13
*/
public static IWordAllow chains(final IWordAllow wordAllow,
final IWordAllow... others) {
return new WordAl... |
pipeline.addLast(wordAllow);
if(ArrayUtil.isNotEmpty(others)) {
for(IWordAllow other : others) {
pipeline.addLast(other);
}
}
| 194 | 55 | 249 | |
Pay-Group_best-pay-sdk | best-pay-sdk/src/main/java/com/lly835/bestpay/service/impl/BestPayServiceImpl.java | BestPayServiceImpl | payBank | class BestPayServiceImpl implements BestPayService {
/**
* TODO 重构
* 暂时先再引入一个config
*/
private WxPayConfig wxPayConfig;
private AliPayConfig aliPayConfig;
public void setWxPayConfig(WxPayConfig wxPayConfig) {
this.wxPayConfig = wxPayConfig;
}
public void setAliPayConfig... |
if (request.getPayTypeEnum().getPlatform() == BestPayPlatformEnum.WX) {
WxPayServiceImpl wxPayService = new WxPayServiceImpl();
wxPayService.setWxPayConfig(this.wxPayConfig);
return wxPayService.payBank(request);
} else if (request.getPayTypeEnum().getPlatform() == B... | 1,273 | 167 | 1,440 | |
Kong_unirest-java | unirest-java/unirest/src/main/java/kong/unirest/core/Headers.java | Headers | equals | class Headers {
private static final long serialVersionUID = 71310341388734766L;
private List<Header> headers = new ArrayList<>();
public Headers() {
}
public Headers(Collection<Entry> entries) {
entries.forEach(e -> add(e.name, e.value));
}
/**
* Add a header element
*... |
if (this == o) { return true;}
if (o == null || getClass() != o.getClass()) { return false; }
Headers headers1 = (Headers) o;
return Objects.equals(headers, headers1.headers);
| 1,694 | 65 | 1,759 | |
ainilili_ratel | ratel/landlords-client/src/main/java/org/nico/ratel/landlords/client/event/ClientEventListener_CODE_GAME_OVER.java | ClientEventListener_CODE_GAME_OVER | call | class ClientEventListener_CODE_GAME_OVER extends ClientEventListener {
@Override
public void call(Channel channel, String data) {<FILL_FUNCTION_BODY>}
} |
Map<String, Object> map = MapHelper.parser(data);
SimplePrinter.printNotice("\nPlayer " + map.get("winnerNickname") + "[" + map.get("winnerType") + "]" + " won the game");
if (map.containsKey("scores")){
List<Map<String, Object>> scores = Noson.convert(map.get("scores"), new NoType<List<Map<String, Object>>>... | 46 | 416 | 462 | public abstract class ClientEventListener {
public abstract void call( Channel channel, String data);
public final static Map<ClientEventCode,ClientEventListener> LISTENER_MAP=new HashMap<>();
private final static String LISTENER_PREFIX="org.nico.ratel.landlords.client.event.ClientEventListener_";
protected s... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 3