name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
dubbo_CodecSupport_getPayload_rdh
/** * Read all payload to byte[] * * @param is * @return * @throws IOException */ public static byte[] getPayload(InputStream is) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = getBuffer(is.available()); int len; while ((len = is.read(buffer)) > ...
3.26
dubbo_CodecSupport_getNullBytesOf_rdh
/** * Get the null object serialize result byte[] of Serialization from the cache, * if not, generate it first. * * @param s * Serialization Instances * @return serialize result of null object */ public static byte[] getNullBytesOf(Serialization s) { return ConcurrentHashMapUtils.computeIfAbsent(ID_NULLBYT...
3.26
dubbo_DubboConfigBeanInitializer_prepareDubboConfigBeans_rdh
/** * Initializes there Dubbo's Config Beans before @Reference bean autowiring */private void prepareDubboConfigBeans() { logger.info("loading dubbo config beans ..."); // Make sure all these config beans are initialed and registered to ConfigManager // load application config beans loadConfigBeansOf...
3.26
dubbo_ReferenceBeanManager_transformName_rdh
// convert reference name/alias to referenceBeanName private String transformName(String referenceBeanNameOrAlias) { return referenceAliasMap.getOrDefault(referenceBeanNameOrAlias, referenceBeanNameOrAlias); }
3.26
dubbo_ReferenceBeanManager_prepareReferenceBeans_rdh
/** * Initialize all reference beans, call at Dubbo starting * * @throws Exception */ public void prepareReferenceBeans() throws Exception { initialized = true; for (ReferenceBean referenceBean : getReferences()) { initReferenceBean(referenceBean); } }
3.26
dubbo_ReferenceBeanManager_initReferenceBean_rdh
/** * NOTE: This method should only call after all dubbo config beans and all property resolvers is loaded. * * @param referenceBean * @throws Exception */ public synchronized void initReferenceBean(ReferenceBean referenceBean) throws Exception { if (referenceBean.getReferenceConfig() != null) { return...
3.26
dubbo_EdsEndpointManager_getEdsListeners_rdh
// for test static ConcurrentHashMap<String, Consumer<Map<String, EndpointResult>>> getEdsListeners() { return EDS_LISTENERS; }
3.26
dubbo_EdsEndpointManager_getEndpointListeners_rdh
// for test static ConcurrentHashMap<String, Set<EdsEndpointListener>> getEndpointListeners() { return ENDPOINT_LISTENERS; }
3.26
dubbo_NacosServiceName_isConcrete_rdh
/** * Is the concrete service name or not * * @return if concrete , return <code>true</code>, or <code>false</code> */ public boolean isConcrete() { return (isConcrete(serviceInterface) && isConcrete(version)) && isConcrete(group); }
3.26
dubbo_NacosServiceName_valueOf_rdh
/** * Build an instance of {@link NacosServiceName} * * @param url * @return */ public static NacosServiceName valueOf(URL url) { return new NacosServiceName(url); }
3.26
dubbo_NettyBackedChannelBuffer_clear_rdh
// AbstractChannelBuffer @Override public void clear() { buffer.clear(); }
3.26
dubbo_DataParseUtils_writeFormContent_rdh
/** * content-type form * * @param formData * @param outputStream * @throws Exception */ public static void writeFormContent(Map formData, OutputStream outputStream) throws Exception { outputStream.write(serializeForm(formData, Charset.defaultCharset()).getBytes());}
3.26
dubbo_DataParseUtils_serializeForm_rdh
// TODO file multipart public static String serializeForm(Map formData, Charset charset) { StringBuilder builder = new StringBuilder(); formData.forEach((name, values) -> { if (name == null) { return; } ((List) (values)).forEach(value -> { try { ...
3.26
dubbo_DataParseUtils_writeTextContent_rdh
/** * content-type text * * @param object * @param outputStream * @throws IOException */ public static void writeTextContent(Object object, OutputStream outputStream) throws IOException { outputStream.writ...
3.26
dubbo_ThreadlessExecutor_waitAndDrain_rdh
/** * Waits until there is a task, executes the task and all queued tasks (if there're any). The task is either a normal * response or a timeout response. */ public void waitAndDrain(long deadline) throws InterruptedException { throwIfInterrupted(); Runnable runnable = queue.poll(); if (runnable == null...
3.26
dubbo_ThreadlessExecutor_shutdown_rdh
/** * The following methods are still not supported */ @Override public void shutdown() { shutdownNow(); }
3.26
dubbo_AbstractRegistryFactory_createRegistryCacheKey_rdh
/** * Create the key for the registries cache. * This method may be overridden by the sub-class. * * @param url * the registration {@link URL url} * @return non-null */ protected String createRegistryCacheKey(URL url) { return url.toServiceStringWithoutResolving(); }
3.26
dubbo_ServiceAnnotationPostProcessor_buildServiceBeanDefinition_rdh
/** * Build the {@link AbstractBeanDefinition Bean Definition} * * @param serviceAnnotationAttributes * @param serviceInterface * @param refServiceBeanName * @return * @since 2.7.3 */ private AbstractBeanDefinition buildServiceBeanDefinition(Map<String, Object> serviceAnnotationAttributes, String serviceInterfa...
3.26
dubbo_ServiceAnnotationPostProcessor_processAnnotatedBeanDefinition_rdh
/** * process @DubboService at java-config @bean method * <pre class="code"> * &#064;Configuration * public class ProviderConfig { * * &#064;Bean * &#064;DubboService(group="demo", version="1.2.3") * public DemoService demoService() { * return new DemoServiceImpl(); * } * * } *...
3.26
dubbo_ServiceAnnotationPostProcessor_processScannedBeanDefinition_rdh
/** * Registers {@link ServiceBean} from new annotated {@link Service} {@link BeanDefinition} * * @param beanDefinitionHolder * @see ServiceBean * @see BeanDefinition */ private void processScannedBeanDefinition(BeanDefinitionHolder beanDefinitionHolder) { Class<?> beanClass = resolveClass(beanDefinitionHolde...
3.26
dubbo_ServiceAnnotationPostProcessor_resolveBeanNameGenerator_rdh
/** * It'd be better to use BeanNameGenerator instance that should reference * {@link ConfigurationClassPostProcessor#componentScanBeanNameGenerator}, * thus it maybe a potential problem on bean name generation. * * @param registry * {@link BeanDefinitionRegistry} * @return {@li...
3.26
dubbo_ServiceAnnotationPostProcessor_findServiceAnnotation_rdh
/** * Find the {@link Annotation annotation} of @Service * * @param beanClass * the {@link Class class} of Bean * @return <code>null</code> if not found * @since 2.7.3 */ private Annotation findServiceAnnotation(Class<?> beanClass) { return serviceAnnotationTypes.stream().map(annotationType -> ClassUtils.i...
3.26
dubbo_ServiceAnnotationPostProcessor_m0_rdh
/** * Generates the bean name of {@link ServiceBean} * * @param serviceAnnotationAttributes * @param serviceInterface * the class of interface annotated {@link Service} * @return ServiceBean@interfaceClassName#annotatedServiceBeanName * @since 2.7.3 */ private String m0(Map<String, Object> serviceAnnotationAt...
3.26
dubbo_ServiceAnnotationPostProcessor_findServiceBeanDefinitionHolders_rdh
/** * Finds a {@link Set} of {@link BeanDefinitionHolder BeanDefinitionHolders} whose bean type annotated * {@link Service} Annotation. * * @param scanner * {@link ClassPathBeanDefinitionScanner} * @param packageToScan * pachage to scan * @param registry * {@link BeanDefinitionRegistry} * @return non-nu...
3.26
dubbo_ServiceAnnotationPostProcessor_getServiceAnnotationAttributes_rdh
/** * Get dubbo service annotation class at java-config @bean method * * @return return service annotation attributes map if found, or return null if not found. */ private Map<String, Object> getServiceAnnotationAttributes(BeanDefinition beanDefinition) { if (beanDefinition instanceof AnnotatedBeanDefinition) { Ann...
3.26
dubbo_ServiceAnnotationPostProcessor_scanServiceBeans_rdh
/** * Scan and registers service beans whose classes was annotated {@link Service} * * @param packagesToScan * The base packages to scan * @param registry * {@link BeanDefinitionRegistry} */ private void scanServiceBeans(Set<String> packagesToScan, BeanDefinitionRegistry registry) { scanned = true; i...
3.26
dubbo_TripleServerStream_responsePlainTextError_rdh
/** * Error before create server stream, http plain text will be returned * * @param code * code of error * @param status * status of error */ private void responsePlainTextError(int code, TriRpcStatus status) { ChannelFuture checkResult = preCheck(); if (!checkResult.isSuccess()) { return; } Http2Header...
3.26
dubbo_TripleServerStream_supportContentType_rdh
/** * must starts from application/grpc */ private boolean supportContentType(String contentType) { if (contentType == null) { return false; } return contentType.startsWith(TripleConstant.APPLICATION_GRPC); }
3.26
dubbo_TripleServerStream_responseErr_rdh
/** * Error in create stream, unsupported config or triple protocol error. There is no return value * because stream will be reset if send trailers failed. * * @param status * status of error */private void responseErr(TriRpcStatus status) { Http2Headers trailers = new DefaultHttp2Headers().status(OK.codeAsTex...
3.26
dubbo_AbstractConfigManager_addConfig_rdh
/** * Add the dubbo {@link AbstractConfig config} * * @param config * the dubbo {@link AbstractConfig config} */ public final <T extends AbstractConfig> T addConfig(AbstractConfig config) { if (config == null) { return null; } // ignore MethodConfig if (!isSupportConfigType(config.getCl...
3.26
dubbo_AbstractConfigManager_getConfig_rdh
/** * Get config instance by id or by name * * @param cls * Config type * @param idOrName * the id or name of the config * @return */ public <T extends AbstractConfig> Optional<T> getConfig(Class<T> cls, String idOrName) { T config = getConfigById(getTagName(cls), ...
3.26
dubbo_AbstractConfigManager_getConfigIdsFromProps_rdh
/** * Search props and extract config ids of specify type. * <pre> * # properties * dubbo.registries.registry1.address=xxx * dubbo.registries.registry2.port=xxx * * # extract * Set configIds = getConfigIds(RegistryConfig.class) * * # result * configIds: ["registry1", "registry2"] * </pre> * * @param clazz...
3.26
dubbo_AbstractConfigManager_removeConfig_rdh
/** * In some scenario, we may need to add and remove ServiceConfig or ReferenceConfig dynamically. * * @param config * the config instance to remove. * @return */ public boolean removeConfig(AbstractConfig config) { if (config == null) { return false; } Map<String, AbstractConfig> configs ...
3.26
dubbo_AbstractConfigManager_addIfAbsent_rdh
/** * Add config * * @param config * @param configsMap * @return the existing equivalent config or the new adding config * @throws IllegalStateException */ private <C extends AbstractConfig> C addIfAbsent(C config, Map<String, C> configsMap) throws IllegalStateException { if ((config == null) || (configsMap == ...
3.26
dubbo_AbstractConfigManager_isNeedValidation_rdh
/** * The component configuration that does not affect the main process does not need to be verified. * * @param config * @param <T> * @return */protected <T extends AbstractConfig> boolean isNeedValidation(T config) { if (config instanceof MetadataReportConfig) { return false; } return true;}
3.26
dubbo_AbstractConfigManager_isRequired_rdh
/** * The configuration that does not affect the main process is not necessary. * * @param clazz * @param <T> * @return */ protected <T extends AbstractConfig> boolean isRequired(Class<T> clazz) { if (((((clazz == RegistryConfig.class) || (clazz == MetadataReportConfig.class)) || (clazz == MonitorConfig.cla...
3.26
dubbo_AbstractConfigManager_getConfigByName_rdh
/** * Get config by name if existed * * @param cls * @param name * @return */ protected <C extends AbstractConfig> C getConfigByName(Class<? extends C> cls, String name) { Map<String, ? extends C> configsMap = getConfigsMap(cls); if (configsMap.isEmpty()) { return null; } // try to find config...
3.26
dubbo_AbstractConfigManager_getConfigById_rdh
/** * Get config by id * * @param configType * @param id * @return */ protected <C extends AbstractConfig> C getConfigById(String configType, String id) { return ((C) (getConfigsMap(configType).get(id))); }
3.26
dubbo_JCacheFactory_createCache_rdh
/** * Takes url as an method argument and return new instance of cache store implemented by JCache. * * @param url * url of the method * @return JCache instance of cache */ @Overrideprotected Cache createCache(URL url) { return new JCache(url); }
3.26
dubbo_EnvironmentAdapter_getExtraAttributes_rdh
/** * 1. OS Environment: DUBBO_LABELS=tag=pre;key=value * 2. JVM Options: -Denv_keys = DUBBO_KEY1, DUBBO_KEY2 * * @param params * information of this Dubbo process, currently includes application name and host address. */ @Override public Map<String, String> getExtraAttributes(Map<String, String> params) { ...
3.26
dubbo_RoundRobinLoadBalance_getInvokerAddrList_rdh
/** * get invoker addr list cached for specified invocation * <p> * <b>for unit test only</b> * * @param invokers * @param invocation * @return */ protected <T> Collection<String> getInvokerAddrList(List<Invoker<T>> invokers, Invocation invocation) { String key = (invokers.get(0).getUrl().getServiceKey() +...
3.26
dubbo_Bytes_short2bytes_rdh
/** * to byte array. * * @param v * value. * @param b * byte array. */ public static void short2bytes(short v, byte[] b) { short2bytes(v, b, 0); }
3.26
dubbo_Bytes_base642bytes_rdh
/** * from base64 string. * * @param str * base64 string. * @param off * offset. * @param len * length. * @param code * base64...
3.26
dubbo_Bytes_bytes2short_rdh
/** * to short. * * @param b * byte array. * @param off * offset. * @return short. */ public static short bytes2short(byte[] b, int off) {return ((short) (((b[off + 1] & 0xff) << 0) + (b[off + 0] << 8))); }
3.26
dubbo_Bytes_zip_rdh
/** * zip. * * @param bytes * source. * @return compressed byte array. * @throws IOException */ public static byte[] zip(byte[] bytes) throws IOException { UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(); OutputStream os = new DeflaterOutputStream(bos); try { os.write...
3.26
dubbo_Bytes_m2_rdh
/** * from base64 string. * * @param str * base64 string. * @param offset * offset. * @param length * length. * @return byte array. */ public static byte[] m2(String str, int offset, int length) { return base642bytes(str, offset, length, C64); }
3.26
dubbo_Bytes_bytes2float_rdh
/** * to int. * * @param b * byte array. * @param off * offset. * @return int. */ public static float bytes2float(byte[] b, int off) { int i = ((((b[off + 3] & 0xff) << 0) + ((b[off + 2] & 0xff) << 8)) + ((b[off + 1] & 0xff) << 16)) + (b[off + 0] << 24); return Float.intBitsToFloat(i); }
3.26
dubbo_Bytes_double2bytes_rdh
/** * to byte array. * * @param v * value. * @param b * byte array. * @param off * array offset. */ public static void double2bytes(double v, byte[] b, int off) { long j = Double.doubleToLongBits(v); b[off + 7] = ((byte) (j)); b[off + 6] = ((byte) (j >>> 8)); b[off + 5] = ((byte) (...
3.26
dubbo_Bytes_bytes2base64_rdh
/** * to base64 string. * * @param bs * byte array. * @param off * offset. * @param len * length. * @param code * base64 code(0-63 is base64 char,64 is pad char). * @return base64 string. */ public static String bytes2base64(final byte[] bs, final int off, final int len, final char[] code) { if ...
3.26
dubbo_Bytes_bytes2long_rdh
/** * to long. * * @param b * byte array. * @param off * offset. * @return long. */ public static long bytes2long(byte[] b, int off) { return ((((((((b[off + 7] & 0xffL) << 0) + ((b[off + 6] & 0xffL) << 8)) + ((b[off + 5] & 0xffL) << 16)) + ((b[off + 4] & 0xffL) << 24)) + ((b[off + 3] & 0xffL)...
3.26
dubbo_Bytes_m0_rdh
/** * to byte array. * * @param v * value. * @return byte[]. */ public static byte[] m0(short v) { byte[] ret = new byte[]{ 0, 0 }; short2bytes(v, ret); return ret; }
3.26
dubbo_Bytes_int2bytes_rdh
/** * to byte array. * * @param v * value. * @param b * byte array. * @param off * array offset. */ public static void int2bytes(int v, byte[] b, int off) {b[off + 3] = ((byte) (v)); b[off + 2] = ((byte) (v >>> 8)); b[off + 1] = ((byte) (v >>> 16)); b[off + 0] = ((byte) (v >>> 24)); }
3.26
dubbo_Bytes_getMD5_rdh
/** * get md5. * * @param is * input stream. * @return MD5 byte array. */ public static byte[] getMD5(InputStream is) throws IOException { return getMD5(is, 1024 * 8); }
3.26
dubbo_Bytes_bytes2hex_rdh
/** * to hex string. * * @param bs * byte array. * @param off * offset. * @param len * length. * @return hex string. */ public static String bytes2hex(byte[] bs, int off, int len) { if (off < 0) { throw new IndexOutOfBoundsException("bytes2hex: offset < 0, offset is " + off); } if ...
3.26
dubbo_Bytes_bytes2int_rdh
/** * to int. * * @param b * byte array. * @param off * offset. * @return int. */ public static int bytes2int(byte[] b, int off) { return ((((b[off + 3] & 0xff) << 0) + ((b[off + 2] & 0xff) << 8)) + ((b[off + 1] & 0xff) << 16)) + (b[off + 0] << 24); }
3.26
dubbo_Bytes_unzip_rdh
/** * unzip. * * @param bytes * compressed byte array. * @return byte uncompressed array. * @throws IOException */ public static byte[] unzip(byte[] bytes) throws IOException { UnsafeByteArrayInputStream bis = new UnsafeByteArrayInputStream(bytes); UnsafeByteArrayOutputStream bos = new UnsafeByteArrayO...
3.26
dubbo_Bytes_m1_rdh
/** * to base64 string. * * @param b * byte array. * @return base64 string. */ public static String m1(byte[] b, int offset, int length) { return bytes2base64(b, offset, length, BASE64); }
3.26
dubbo_Bytes_hex2bytes_rdh
/** * from hex string. * * @param str * hex string. * @param off * offset. * @param len * length. * @return byte array. */ public static byte[] hex2bytes(final ...
3.26
dubbo_Bytes_copyOf_rdh
/** * byte array copy. * * @param src * src. * @param length * new length. * @return new byte array. */ public static byte[] copyOf(byte[] src, int length) { byte[] dest = new byte[length]; System.arraycopy(src, 0, dest, 0, Math.min(src.length, length)); return dest; }
3.26
dubbo_Bytes_long2bytes_rdh
/** * to byte array. * * @param v * value. * @param b * byte array. * @param off * array offset. */ public static void long2bytes(long v, byte[] b, int off) { b[off + 7] = ((byte) (v)); b[off + 6] = ((byte) (v >>> 8)); b[off + 5] = ((byte) (v >>> 16)); b[off + 4] = ((byte) (v >...
3.26
dubbo_Bytes_float2bytes_rdh
/** * to byte array. * * @param v * value. * @param b * byte array. * @param off * array offset. */ public static void float2bytes(float v, byte[] b, int off) { int i = Float.floatToIntBits(v); b[off + 3] = ((byte) (i)); b[off + 2] = ((byte) (i >>> 8));b[off + 1] = ((byte) (i >>> 16)); b[...
3.26
dubbo_Bytes_bytes2double_rdh
/** * to long. * * @param b * byte array. * @param off * offset. * @return double. */ public static double bytes2double(byte[] b, int off) { long j = ((((((((b[off + 7] & 0xffL) << 0) + ((b[off + 6] & 0xffL) << 8)) + ((b[off + 5] & 0xffL) << 16)) + ((b[off + 4] & 0xffL) << 24)) + ((b[off + 3] & 0xf...
3.26
dubbo_ModuleConfigManager_getDefaultConsumer_rdh
/** * Only allows one default ConsumerConfig */ public Optional<ConsumerConfig> getDefaultConsumer() { List<ConsumerConfig> consumerConfigs = getDefaultConfigs(getConfigsMap(getTagName(ConsumerConfig.class))); if (CollectionUtils.isNotEmpty(consumerConfigs)) { return Optional.of(consumerConfigs.ge...
3.26
dubbo_ModuleConfigManager_m0_rdh
// ServiceConfig correlative methods public void m0(ServiceConfigBase<?> serviceConfig) { addConfig(serviceConfig); }
3.26
dubbo_ModuleConfigManager_findDuplicatedInterfaceConfig_rdh
/** * check duplicated ReferenceConfig/ServiceConfig * * @param config */ private AbstractInterfaceConfig findDuplicatedInterfaceConfig(AbstractInterfaceConfig config) { String uniqueServiceName; Map<String, AbstractInterfaceConfig> configCache; if (config instan...
3.26
dubbo_ModuleConfigManager_getApplicationConfigManager_rdh
// // Delegate read application configs // public ConfigManager getApplicationConfigManager() { return f0; }
3.26
dubbo_ModuleConfigManager_getDefaultProvider_rdh
/** * Only allows one default ProviderConfig */ public Optional<ProviderConfig> getDefaultProvider() { List<ProviderConfig> providerConfigs = getDefaultConfigs(getConfigsMap(getTagName(ProviderConfig.class)));if (CollectionUtils.isNotEmpty(providerConfigs)) { return Optional.of(providerConfigs.get(0)); ...
3.26
dubbo_ModuleConfigManager_addConsumer_rdh
// ConsumerConfig correlative methods public void addConsumer(ConsumerConfig consumerConfig) { addConfig(consumerConfig); }
3.26
dubbo_ModuleConfigManager_addReference_rdh
// ReferenceConfig correlative methods public void addReference(ReferenceConfigBase<?> referenceConfig) { addConfig(referenceConfig); }
3.26
dubbo_ConcurrentHashMapUtils_computeIfAbsent_rdh
/** * A temporary workaround for Java 8 ConcurrentHashMap#computeIfAbsent specific performance issue: JDK-8161372.</br> * * @see <a href="https://bugs.openjdk.java.net/browse/JDK-8161372">https://bugs.openjdk.java.net/browse/JDK-8161372</a> */ public static <K, V> V computeIfAbsent(ConcurrentMap<K, V> map, K key, F...
3.26
dubbo_Utf8Utils_isOneByte_rdh
/** * Returns whether this is a single-byte codepoint (i.e., ASCII) with the form '0XXXXXXX'. */ private static boolean isOneByte(byte b) { return b >= 0; }
3.26
dubbo_Utf8Utils_isNotTrailingByte_rdh
/** * Returns whether the byte is not a valid continuation of the form '10XXXXXX'. */ private static boolean isNotTrailingByte(byte b) { return b > ((byte) (0xbf)); }
3.26
dubbo_Utf8Utils_isThreeBytes_rdh
/** * Returns whether this is a three-byte codepoint with the form '110XXXXX'. */ private static boolean isThreeBytes(byte b) {return b < ((byte) (0xf0)); }
3.26
dubbo_Utf8Utils_trailingByteValue_rdh
/** * Returns the actual value of the trailing byte (removes the prefix '10') for composition. */ private static int trailingByteValue(byte b) { return b & 0x3f; }
3.26
dubbo_Utf8Utils_isTwoBytes_rdh
/** * Returns whether this is a two-byte codepoint with the form '10XXXXXX'. */ private static boolean isTwoBytes(byte b) { return b < ((byte) (0xe0)); }
3.26
dubbo_ExecutorUtil_m0_rdh
/** * append thread name with url address * * @return new url with updated thread name */ public static URL m0(URL url, String defaultName) { String v3 = url.getParameter(THREAD_NAME_KEY, defaultName); v3 = (v3 + "-") + url.getAddress(); url = url.addParameter(THREAD_NAME_KEY, v3); return url; }
3.26
dubbo_ExecutorUtil_gracefulShutdown_rdh
/** * Use the shutdown pattern from: * https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html * * @param executor * the Executor to shutdown * @param timeout * the timeout in milliseconds before termination */ public static void gracefulShutdown(Executor executor, int timeout) {...
3.26
dubbo_MultiValueConverter_find_rdh
/** * Find the {@link MultiValueConverter} instance from {@link ExtensionLoader} with the specified source and target type * * @param sourceType * the source type * @param targetType * the target type * @return <code>null</code> if not found * @see ExtensionLoader#getSupportedExtensionInstances() * @since ...
3.26
dubbo_MultiValueConverter_convertIfPossible_rdh
/** * * @deprecated will be removed in 3.3.0 */@Deprecated static <T> T convertIfPossible(Object source, Class<?> multiValueType, Class<?> elementType) { Class<?> sourceType = source.getClass(); MultiValueConverter converter = find(sourceType, multiValueType); if (conver...
3.26
dubbo_ClientStreamObserver_disableAutoRequest_rdh
/** * Swaps to manual flow control where no message will be delivered to {@link StreamObserver#onNext(Object)} unless it is {@link #request request()}ed. Since {@code request()} may not be called before the call is started, a number of initial requests may be * specified. */ default void disableA...
3.26
dubbo_MergerFactory_getActualTypeArgument_rdh
/** * get merger's actual type argument (same as return type) * * @param mergerCls * @return */ private Class<?> getActualTypeArgument(Class<? extends Merger> mergerCls) { Class<?> v5 = mergerCls; while (v5 != Object.class) { Type[] interfaceTypes = v5.getGenericInterfaces(); ParameterizedType mergerType;...
3.26
dubbo_MergerFactory_getMerger_rdh
/** * Find the merger according to the returnType class, the merger will * merge an array of returnType into one * * @param returnType * the merger will return this type * @return the merger which merges an array of returnType into one, return null if not exist * @throws Illegal...
3.26
dubbo_ConfigurableMetadataServiceExporter_generateMethodConfig_rdh
/** * Generate Method Config for Service Discovery Metadata <p/> * <p> * Make {@link MetadataService} support argument callback, * used to notify {@link org.apache.dubbo.registry.client.ServiceInstance}'s * metadata change event * * @since 3.0 */ private List<MethodConfig> generateMethodConfig() { Metho...
3.26
dubbo_ConfigurableMetadataServiceExporter_setMetadataService_rdh
// for unit test public void setMetadataService(MetadataServiceDelegation metadataService) { this.metadataService = metadataService; }
3.26
dubbo_AbstractH2TransportListener_headersToMap_rdh
/** * Parse metadata to a KV pairs map. * * @param trailers * the metadata from remote * @return KV pairs map */ protected Map<String, Object> headersToMap(Http2Headers trailers, Supplier<Object> convertUpperHeaderSupplier) { if (trailers == null) { return Collections.emptyMap(); } Map<Strin...
3.26
MagicPlugin_ExprActiveSpell_acceptChange_rdh
// Eclipse detects the parent return type of this function as @NonNull // which is not correct. @SuppressWarnings("null") @Nullable @Override public Class<?>[] acceptChange(@Nonnull Changer.ChangeMode mode) { if ((mode != ChangeMode.SET) && (mode != ChangeMode.REMOVE_ALL)) return null; return new Class...
3.26
MagicPlugin_ExprActiveSpell_convert_rdh
// Eclipse detects the parent return type of this function as @NonNull // which is not correct. @SuppressWarnings("null") @Nullable @Override public String convert(final Player p) { assert false; return null; }
3.26
MagicPlugin_HeroesSpellSkill_getSkillName_rdh
/** * This code is redudant, but unfortunately it needs to be since we need to know the * skill name for the super() constructor call. */ private static String getSkillName(Heroes heroes, String spellKey) { Plugin magicPlugin = heroes.getServer().getPluginManager().getPlugin("Magic"); if ((magicPlugin == nul...
3.26
MagicPlugin_CompatibilityUtilsBase_checkChunk_rdh
/** * Take care if setting generate to false, the chunk will load but not show as loaded */ @Override public boolean checkChunk(World world, int chunkX, int chunkZ, boolean generate) { if (!world.isChunkLoaded(chunkX, chunkZ)) { loadChunk(world, chunkX, chunkZ, generate);return false; } retu...
3.26
MagicPlugin_CompatibilityUtilsBase_toMinecraftAttribute_rdh
// Taken from CraftBukkit code. protected String toMinecraftAttribute(Attribute attribute) { String bukkit = attribute.name(); int first = bukkit.indexOf('_'); int second = bukkit.indexOf('_', first + 1); StringBuilder sb = new StringBuilder(bukkit.toLowerCase(Locale.ENGLISH)); sb.setCharAt...
3.26
MagicPlugin_CompatibilityUtilsBase_loadChunk_rdh
/** * This will load chunks asynchronously if possible. * * <p>But note that it will never be truly asynchronous, it is important not to call this in a tight retry loop, * the main server thread needs to free up to actually process the async chunk loads. */ @Override public void loadChunk(World world, int x, int ...
3.26
MagicPlugin_EntityController_onEntityDeath_rdh
/** * This death handler is for mobs and players alike */ @EventHandler(priority = EventPriority.LOWEST) public void onEntityDeath(EntityDeathEvent event) { Entity entity = event.getEntity(); boolean isPlayer = entity instanceof Player;if (isPlayer) { EntityDamageEvent.DamageCause cause = (entity....
3.26
MagicPlugin_EntityController_handlePlayerDeath_rdh
/** * This death handler fires right away to close the wand inventory before other plugin * see the drops. */ public void handlePlayerDeath(Player player, Mage mage, List<ItemStack> drops, boolean isKeepInventory) { Wand wand = mage.getActiveWand(); // First, deactivate the active wand. // If...
3.26
MagicPlugin_BaseSpell_onCancelSelection_rdh
/** * Called when a material selection spell is cancelled mid-selection. */public boolean onCancelSelection() { return false; }
3.26
MagicPlugin_BaseSpell_castMessage_rdh
/* Functions to send text to player- use these to respect "quiet" and "silent" modes. */ /** * Send a message to a player when a spell is cast. * * @param message * The message to send */ @Override public void castMessage(String message) { Wand activeWand = mage.getActiveWand(); // First check wand ...
3.26
MagicPlugin_BaseSpell_initialize_rdh
/** * Used internally to initialize the Spell, do not call. * * @param instance * The spells instance */ @Override public void initialize(MageController instance) { this.controller = instance; }
3.26
MagicPlugin_BaseSpell_updateItem_rdh
// Returns non-null if the item needs an update... not sure this is needed, looks like it's just for skulls though public ItemStack updateItem(ItemStack spellItem, boolean canCast) { ItemStack needsUpdate = null; MaterialAndData disabledIcon = getDisabledIcon(); MaterialAndData spellIcon = getIcon(); String urlIcon = g...
3.26
MagicPlugin_BaseSpell_m0_rdh
// Material @Deprecated public boolean m0(Material mat) { if ((mage != null) && mage.isSuperPowered()) { return true; } if ((passthroughMaterials != null) && passthroughMaterials.testMaterial(mat)) { return true; } return (preventPassThroughMaterials == null) || (!prevent...
3.26
MagicPlugin_BaseSpell_onPlayerQuit_rdh
/** * Listener method, called on player quit for registered spells. * * @param event * The player who just quit */ public void onPlayerQuit(PlayerQuitEvent event) { }
3.26
MagicPlugin_BaseSpell_clone_rdh
// // Cloneable implementation // @Nullable @Override public Object clone() { try { return super.clone();} catch (CloneNotSupportedException ex) { return null; } }
3.26