method2testcases stringlengths 118 3.08k |
|---|
### Question:
RollingPolicyDecorator implements RollingPolicy { @Override public void start() { ScanTask task = createScanTaskAndCancelInProgress(); _decorated.start(); _executorService.execute(task); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorService executorServi... |
### Question:
InternalMessageMutator implements ServerMessageMutator<InternalMessage> { @Override public byte getPriority() { return _priority; } InternalMessageMutator(final InternalMessage message, final MessageStore messageStore); @Override void setPriority(final byte priority); @Override byte getPriority(); @Overri... |
### Question:
InternalMessageMutator implements ServerMessageMutator<InternalMessage> { @Override public InternalMessage create() { final InternalMessageHeader messageHeader = _message.getMessageHeader(); final InternalMessageHeader newHeader = new InternalMessageHeader(new HashMap<>(messageHeader.getHeaderMap()), mess... |
### Question:
UUIDGenerator { public static UUID generateQueueUUID(String queueName, String virtualHostName) { return createUUID(Queue.class.getName(), virtualHostName, queueName); } static UUID generateRandomUUID(); static UUID generateExchangeUUID(String exchangeName, String virtualHostName); static UUID generateQue... |
### Question:
UUIDGenerator { public static UUID generateExchangeUUID(String exchangeName, String virtualHostName) { return createUUID(Exchange.class.getName(), virtualHostName, exchangeName); } static UUID generateRandomUUID(); static UUID generateExchangeUUID(String exchangeName, String virtualHostName); static UUID... |
### Question:
UUIDGenerator { public static UUID generateVhostUUID(String virtualHostName) { return createUUID(VirtualHost.class.getName(), virtualHostName); } static UUID generateRandomUUID(); static UUID generateExchangeUUID(String exchangeName, String virtualHostName); static UUID generateQueueUUID(String queueName... |
### Question:
UUIDGenerator { public static UUID generateVhostAliasUUID(String virtualHostName, String portName) { return createUUID(VirtualHostAlias.class.getName(), virtualHostName, portName); } static UUID generateRandomUUID(); static UUID generateExchangeUUID(String exchangeName, String virtualHostName); static UU... |
### Question:
UUIDGenerator { public static UUID generateUserUUID(String authenticationProviderName, String userName) { return createUUID(User.class.getName(), authenticationProviderName, userName); } static UUID generateRandomUUID(); static UUID generateExchangeUUID(String exchangeName, String virtualHostName); stati... |
### Question:
ConfiguredObjectJacksonModule extends SimpleModule { public static ObjectMapper newObjectMapper(final boolean forPersistence) { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(forPersistence ? PERSISTENCE_INSTANCE : INSTANCE); return objectMapper; } private ConfiguredObj... |
### Question:
RollingPolicyDecorator implements RollingPolicy { @Override public void stop() { _decorated.stop(); synchronized (_publishResultsLock) { if (_currentScanTask != null) { _currentScanTask.cancel(); } _previousScanResults = null; } } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listen... |
### Question:
ArrivalTimeFilterFactory implements MessageFilterFactory { @Override public MessageFilter newInstance(final List<String> arguments) { if(arguments == null || arguments.size() != 1) { throw new IllegalArgumentException(String.format("Cannot create a %s filter from these arguments: %s", getType(), arguments... |
### Question:
JMSSelectorFilter implements MessageFilter { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final JMSSelectorFilter that = (JMSSelectorFilter) o; return getSelector().equals(that.getSelector()); } JMSSelector... |
### Question:
ExchangeMessages { public static LogMessage DELETED() { String rawMessage = _messages.getString("DELETED"); final String message = rawMessage; return new LogMessage() { @Override public String toString() { return message; } @Override public String getLogHierarchy() { return DELETED_LOG_HIERARCHY; } @Overr... |
### Question:
ExchangeMessages { public static LogMessage DISCARDMSG(String param1, String param2) { String rawMessage = _messages.getString("DISCARDMSG"); final Object[] messageArguments = {param1, param2}; MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); final String message = formatter.format... |
### Question:
RollingPolicyDecorator implements RollingPolicy { @Override public boolean isStarted() { return _decorated.isStarted(); } RollingPolicyDecorator(RollingPolicyBase decorated, RolloverListener listener, ScheduledExecutorService executorService); @Override void rollover(); @Override String getActiveFileName(... |
### Question:
VirtualHostMessages { public static LogMessage CREATED(String param1) { String rawMessage = _messages.getString("CREATED"); final Object[] messageArguments = {param1}; MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); final String message = formatter.format(messageArguments); return... |
### Question:
VirtualHostMessages { public static LogMessage CLOSED(String param1) { String rawMessage = _messages.getString("CLOSED"); final Object[] messageArguments = {param1}; MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); final String message = formatter.format(messageArguments); return n... |
### Question:
AppenderUtils { static void validateMaxFileSize(final int maxFileSize) { if (maxFileSize < 1) { throw new IllegalConfigurationException(String.format("Maximum file size must be at least 1. Cannot set to %d.", maxFileSize)); } } static void configureRollingFileAppender(FileLoggerSettings fileLoggerSetting... |
### Question:
ManagementConsoleMessages { public static LogMessage STARTUP(String param1) { String rawMessage = _messages.getString("STARTUP"); final Object[] messageArguments = {param1}; MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); final String message = formatter.format(messageArguments); ... |
### Question:
ManagementConsoleMessages { public static LogMessage READY(String param1) { String rawMessage = _messages.getString("READY"); final Object[] messageArguments = {param1}; MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); final String message = formatter.format(messageArguments); retu... |
### Question:
MessageStoreMessages { public static LogMessage CREATED() { String rawMessage = _messages.getString("CREATED"); final String message = rawMessage; return new LogMessage() { @Override public String toString() { return message; } @Override public String getLogHierarchy() { return CREATED_LOG_HIERARCHY; } @O... |
### Question:
QpidLoggerTurboFilter extends TurboFilter { public static void uninstall(LoggerContext context) { context.getTurboFilterList().remove(new QpidLoggerTurboFilter()); } QpidLoggerTurboFilter(); @Override FilterReply decide(final Marker marker,
final Logger logger,
... |
### Question:
MessageStoreMessages { public static LogMessage CLOSED() { String rawMessage = _messages.getString("CLOSED"); final String message = rawMessage; return new LogMessage() { @Override public String toString() { return message; } @Override public String getLogHierarchy() { return CLOSED_LOG_HIERARCHY; } @Over... |
### Question:
MessageStoreMessages { public static LogMessage RECOVERY_START() { String rawMessage = _messages.getString("RECOVERY_START"); final String message = rawMessage; return new LogMessage() { @Override public String toString() { return message; } @Override public String getLogHierarchy() { return RECOVERY_STAR... |
### Question:
TrustStoreMessageSource extends AbstractSystemMessageSource { @Override public <T extends ConsumerTarget<T>> Consumer<T> addConsumer(final T target, final FilterManager filters, final Class<? extends ServerMessage> messageClass, final String consumerName, final EnumSet<ConsumerOption> options, final Integ... |
### Question:
AESKeyFileEncrypter implements ConfigurationSecretEncrypter { @Override public String encrypt(final String unencrypted) { byte[] unencryptedBytes = unencrypted.getBytes(StandardCharsets.UTF_8); try { byte[] ivbytes = new byte[AES_INITIALIZATION_VECTOR_LENGTH]; _random.nextBytes(ivbytes); Cipher cipher = C... |
### Question:
GroupPrincipal implements QpidPrincipal { @Override public String getName() { return _groupName; } GroupPrincipal(final String groupName, final ConfiguredObject<?> origin); @Override String getName(); boolean addMember(Principal user); boolean removeMember(Principal user); boolean isMember(Principal membe... |
### Question:
GroupPrincipal implements QpidPrincipal { public boolean addMember(Principal user) { throw new UnsupportedOperationException(msgException); } GroupPrincipal(final String groupName, final ConfiguredObject<?> origin); @Override String getName(); boolean addMember(Principal user); boolean removeMember(Princi... |
### Question:
GroupPrincipal implements QpidPrincipal { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final GroupPrincipal that = (GroupPrincipal) o; if (!_groupName.equals(that._groupName)) { return false; } return _orig... |
### Question:
FileGroupDatabase implements GroupDatabase { @Override public Set<String> getAllGroups() { return Collections.unmodifiableSet(_groupToUserMap.keySet()); } FileGroupDatabase(FileBasedGroupProvider<?> groupProvider); @Override Set<String> getAllGroups(); synchronized void setGroupFile(String groupFile); @Ov... |
### Question:
StartupAppender extends AppenderBase<ILoggingEvent> { public synchronized void replayAccumulatedEvents(Appender<ILoggingEvent> appender) { for (ILoggingEvent event: _accumulatedLoggingEvents) { appender.doAppend(event); } } StartupAppender(); synchronized void replayAccumulatedEvents(Appender<ILoggingEven... |
### Question:
FileGroupDatabase implements GroupDatabase { public synchronized void setGroupFile(String groupFile) throws IOException { File file = new File(groupFile); if (!file.canRead()) { throw new FileNotFoundException(groupFile + " cannot be found or is not readable"); } readGroupFile(groupFile); } FileGroupDatab... |
### Question:
VirtualHostLogEventExcludingFilter extends Filter<ILoggingEvent> implements LogBackLogInclusionRule { @Override public FilterReply decide(ILoggingEvent event) { if (!_brokerLogger.isVirtualHostLogEventExcluded() || !subjectContainsVirtualHostPrincipal()) { return FilterReply.NEUTRAL; } return FilterReply.... |
### Question:
SimpleAuthenticationManager extends AbstractAuthenticationManager<SimpleAuthenticationManager> implements PasswordCredentialManagingAuthenticationProvider<SimpleAuthenticationManager> { @Override public List<String> getMechanisms() { return Collections.unmodifiableList(Arrays.asList(PLAIN_MECHANISM, CRAM_... |
### Question:
SimpleAuthenticationManager extends AbstractAuthenticationManager<SimpleAuthenticationManager> implements PasswordCredentialManagingAuthenticationProvider<SimpleAuthenticationManager> { @Override public AuthenticationResult authenticate(String username, String password) { if (_users.containsKey(username))... |
### Question:
AnonymousAuthenticationManager extends AbstractAuthenticationManager<AnonymousAuthenticationManager> { @Override public List<String> getMechanisms() { return Collections.singletonList(MECHANISM_NAME); } @ManagedObjectFactoryConstructor protected AnonymousAuthenticationManager(final Map<String, Object> at... |
### Question:
AnonymousAuthenticationManager extends AbstractAuthenticationManager<AnonymousAuthenticationManager> { @Override public SaslNegotiator createSaslNegotiator(final String mechanism, final SaslSettings saslSettings, final NamedAddressSpace addressSpace) { if(MECHANISM_NAME.equals(mechanism)) { return new Ano... |
### Question:
RolloverWatcher implements RollingPolicyDecorator.RolloverListener { @Override public void onRollover(Path baseFolder, String[] relativeFileNames) { _rolledFiles = Collections.unmodifiableCollection(Arrays.asList(relativeFileNames)); _baseFolder = baseFolder; } RolloverWatcher(final String activeFileName)... |
### Question:
KerberosAuthenticationManager extends AbstractAuthenticationManager<KerberosAuthenticationManager> { @Override public SaslNegotiator createSaslNegotiator(final String mechanism, final SaslSettings saslSettings, final NamedAddressSpace addressSpace) { if(GSSAPI_MECHANISM.equals(mechanism)) { final String s... |
### Question:
KerberosAuthenticationManager extends AbstractAuthenticationManager<KerberosAuthenticationManager> { public AuthenticationResult authenticate(String authorizationHeader) { return _authenticator.authenticate(authorizationHeader); } @ManagedObjectFactoryConstructor protected KerberosAuthenticationManager(f... |
### Question:
PrincipalDatabaseAuthenticationManager extends AbstractAuthenticationManager<T> implements ExternalFileBasedAuthenticationManager<T> { public void initialise() { try { _principalDatabase.open(new File(_path)); } catch (FileNotFoundException e) { throw new IllegalConfigurationException("Exception opening p... |
### Question:
PrincipalDatabaseAuthenticationManager extends AbstractAuthenticationManager<T> implements ExternalFileBasedAuthenticationManager<T> { @Override public SaslNegotiator createSaslNegotiator(final String mechanism, final SaslSettings saslSettings, final NamedAddressSpace addressSpace) { return _principalData... |
### Question:
RolloverWatcher implements RollingPolicyDecorator.RolloverListener { public PathContent getFileContent(String fileName) { if (fileName == null) { throw new IllegalArgumentException("File name cannot be null"); } Path path = getPath(fileName); return new PathContent(path, getContentType(fileName)); } Rollo... |
### Question:
PrincipalDatabaseAuthenticationManager extends AbstractAuthenticationManager<T> implements ExternalFileBasedAuthenticationManager<T> { @Override protected void onCreate() { super.onCreate(); File passwordFile = new File(_path); if (!passwordFile.exists()) { try { Path path = new FileHelper().createNewFile... |
### Question:
PrincipalDatabaseAuthenticationManager extends AbstractAuthenticationManager<T> implements ExternalFileBasedAuthenticationManager<T> { @Override protected ListenableFuture<Void> onDelete() { return doAfterAlways(closeChildren(), () -> { File file = new File(_path); if (file.exists() && file.isFile()) { fi... |
### Question:
AuthenticatedPrincipal implements QpidPrincipal { public static AuthenticatedPrincipal getAuthenticatedPrincipalFromSubject(final Subject authSubject) { return getAuthenticatedPrincipalFromSubject(authSubject, false); } AuthenticatedPrincipal(Principal wrappedPrincipal); static AuthenticatedPrincipal getC... |
### Question:
AuthenticatedPrincipal implements QpidPrincipal { public static AuthenticatedPrincipal getOptionalAuthenticatedPrincipalFromSubject(final Subject authSubject) { return getAuthenticatedPrincipalFromSubject(authSubject, true); } AuthenticatedPrincipal(Principal wrappedPrincipal); static AuthenticatedPrincip... |
### Question:
AuthenticatedPrincipal implements QpidPrincipal { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof AuthenticatedPrincipal)) { return false; } AuthenticatedPrincipal other = (AuthenticatedPrincipal) obj; return _wrappedPrincipal.equals(other._wrappedPrinc... |
### Question:
RolloverWatcher implements RollingPolicyDecorator.RolloverListener { public String getContentType(String fileName) { String fileNameLower = fileName.toLowerCase(); if (fileNameLower.endsWith(".gz")) { return "application/x-gzip"; } else if (fileNameLower.endsWith(".zip")) { return "application/x-zip"; } e... |
### Question:
PlainPasswordFilePrincipalDatabase extends AbstractPasswordFilePrincipalDatabase<PlainUser> { @Override public boolean verifyPassword(String principal, char[] password) throws AccountNotFoundException { char[] pwd = lookupPassword(principal); if (pwd == null) { throw new AccountNotFoundException("Unable t... |
### Question:
AnonymousNegotiator implements SaslNegotiator { @Override public AuthenticationResult handleResponse(final byte[] response) { if (_isComplete) { return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR, new IllegalStateException( "Multiple Authentications not permitted.")); } else {... |
### Question:
SubjectCreator { public SubjectAuthenticationResult authenticate(SaslNegotiator saslNegotiator, byte[] response) { AuthenticationResult authenticationResult = saslNegotiator.handleResponse(response); if(authenticationResult.getStatus() == AuthenticationStatus.SUCCESS) { return createResultWithGroups(authe... |
### Question:
SubjectCreator { Set<Principal> getGroupPrincipals(Principal userPrincipal) { Set<Principal> principals = new HashSet<Principal>(); for (GroupProvider groupProvider : _groupProviders) { Set<Principal> groups = groupProvider.getGroupPrincipalsForUser(userPrincipal); if (groups != null) { principals.addAll(... |
### Question:
CompositeInputStream extends InputStream { @Override public void close() throws IOException { IOException ioException = null; try { if (_current != null) { try { _current.close(); _current = null; } catch (IOException e) { ioException = e; } } for (InputStream is : _inputStreams) { try { is.close(); } cat... |
### Question:
ConnectionPrincipalStatisticsImpl implements ConnectionPrincipalStatistics { @Override public int getConnectionCount() { return _connectionCount; } ConnectionPrincipalStatisticsImpl(final int connectionCount, final List<Long> latestConnectionCreatedTimes); @Override int getConnectionCount(); @Override int... |
### Question:
ConnectionPrincipalStatisticsImpl implements ConnectionPrincipalStatistics { @Override public int getConnectionFrequency() { return _latestConnectionCreatedTimes.size(); } ConnectionPrincipalStatisticsImpl(final int connectionCount, final List<Long> latestConnectionCreatedTimes); @Override int getConnecti... |
### Question:
ConnectionPrincipalStatisticsImpl implements ConnectionPrincipalStatistics { List<Long> getLatestConnectionCreatedTimes() { return _latestConnectionCreatedTimes; } ConnectionPrincipalStatisticsImpl(final int connectionCount, final List<Long> latestConnectionCreatedTimes); @Override int getConnectionCount(... |
### Question:
ConnectionPrincipalStatisticsImpl implements ConnectionPrincipalStatistics { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ConnectionPrincipalStatisticsImpl that = (ConnectionPrincipalStatisticsImpl) o... |
### Question:
ConnectionPrincipalStatisticsImpl implements ConnectionPrincipalStatistics { @Override public int hashCode() { int result = _connectionCount; result = 31 * result + _latestConnectionCreatedTimes.hashCode(); return result; } ConnectionPrincipalStatisticsImpl(final int connectionCount, final List<Long> late... |
### Question:
ConnectionPrincipalStatisticsCheckingTask extends HouseKeepingTask { @Override public void execute() { _connectionPrincipalStatisticsRegistry.reevaluateConnectionStatistics(); } ConnectionPrincipalStatisticsCheckingTask(final QueueManagingVirtualHost virtualHost,
... |
### Question:
CacheFactory { public static <K, V> Cache<K, V> getCache(final String cacheName, final Cache<K, V> defaultCache) { Cache<K, V> cache = defaultCache; Subject subject = Subject.getSubject(AccessController.getContext()); if (subject != null) { VirtualHostPrincipal principal = QpidPrincipal.getSingletonPrinci... |
### Question:
RolloverWatcher implements RollingPolicyDecorator.RolloverListener { public ZippedContent getAllFilesAsZippedContent() { Set<String> fileNames = new HashSet<>(_rolledFiles); fileNames.add(getDisplayName(_activeFilePath)); return getFilesAsZippedContent(fileNames); } RolloverWatcher(final String activeFile... |
### Question:
HouseKeepingTask implements Runnable { @Override final public void run() { String originalThreadName = Thread.currentThread().getName(); Thread.currentThread().setName(_name); try { AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { try { execute(); } catch (Con... |
### Question:
VirtualHostPropertiesNode extends AbstractSystemMessageSource { @Override public <T extends ConsumerTarget<T>> Consumer<T> addConsumer(final T target, final FilterManager filters, final Class<? extends ServerMessage> messageClass, final String consumerName, final EnumSet<ConsumerOption> options, final Int... |
### Question:
PrincipalLogEventFilter extends Filter<ILoggingEvent> implements LogBackLogInclusionRule { @Override public FilterReply decide(ILoggingEvent event) { Subject subject = Subject.getSubject(AccessController.getContext()); if (subject != null && subject.getPrincipals().contains(_principal)) { return FilterRep... |
### Question:
JsonFileConfigStore extends AbstractJsonFileStore implements DurableConfigurationStore { @Override public void init(ConfiguredObject<?> parent) { assertState(State.CLOSED); _parent = parent; _classNameMapping = generateClassNameMap(_parent.getModel(), _rootClass); FileBasedSettings fileBasedSettings = (Fi... |
### Question:
JsonFilePreferenceStore extends AbstractJsonFileStore implements PreferenceStore { @Override public synchronized void updateOrCreate(final Collection<PreferenceRecord> preferenceRecords) { if (_storeState != StoreState.OPENED) { throw new IllegalStateException("PreferenceStore is not opened"); } if (prefe... |
### Question:
JsonFilePreferenceStore extends AbstractJsonFileStore implements PreferenceStore { @Override public synchronized void replace(final Collection<UUID> preferenceRecordsToRemove, final Collection<PreferenceRecord> preferenceRecordsToAdd) { if (_storeState != StoreState.OPENED) { throw new IllegalStateExcepti... |
### Question:
UpgraderHelper { public static Map<String, String> renameContextVariables(final Map<String, String> context, final Map<String, String> oldToNewNameMapping) { final Map<String, String> newContext = new HashMap<>(context); oldToNewNameMapping.forEach((oldName, newName) -> { if (newContext.containsKey(oldNam... |
### Question:
AbstractConsumerTarget implements ConsumerTarget<T> { @Override final public boolean close() { if (_state.compareAndSet(State.OPEN, State.CLOSED)) { setNotifyWorkDesired(false); List<MessageInstanceConsumer> consumers = new ArrayList<>(_consumers); _consumers.clear(); for (MessageInstanceConsumer consumer... |
### Question:
AbstractConsumerTarget implements ConsumerTarget<T> { @Override public void notifyWork() { @SuppressWarnings("unchecked") final T target = (T) this; getSession().notifyWork(target); } protected AbstractConsumerTarget(final boolean isMultiQueue,
final AMQPConnection<?>... |
### Question:
UpgradeFrom8To9 extends AbstractStoreUpgrade { @Override public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, final ConfiguredObject<?> parent) { reportStarting(environment, 8); DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setTransactional(true); d... |
### Question:
Upgrader { void upgrade(final int fromVersion, final int toVersion) throws StoreException { try { @SuppressWarnings("unchecked") Class<StoreUpgrade> upgradeClass = (Class<StoreUpgrade>) Class.forName("org.apache.qpid.server.store.berkeleydb.upgrade." + "UpgradeFrom"+fromVersion+"To"+toVersion); Constructo... |
### Question:
CompositeFilter extends Filter<ILoggingEvent> { @Override public FilterReply decide(ILoggingEvent event) { FilterReply reply = DENY; for(Filter<ILoggingEvent> filter : _filterList) { FilterReply filterReply = filter.decide(event); if (filterReply == DENY) { reply = filterReply; break; } if (filterReply ==... |
### Question:
Upgrader { public void upgradeIfNecessary() { boolean isEmpty = _environment.getDatabaseNames().isEmpty(); DatabaseConfig dbConfig = new DatabaseConfig(); dbConfig.setTransactional(true); dbConfig.setAllowCreate(true); Database versionDb = null; try { versionDb = _environment.openDatabase(null, VERSION_DB... |
### Question:
DatabaseTemplate { public void run(DatabaseRunnable databaseRunnable) { DatabaseCallable<Void> callable = runnableToCallable(databaseRunnable); call(callable); } DatabaseTemplate(Environment environment, String sourceDatabaseName, Transaction transaction); DatabaseTemplate(Environment environment, String... |
### Question:
CompositeFilter extends Filter<ILoggingEvent> { public void removeLogInclusionRule(LogBackLogInclusionRule logInclusionRule) { Iterator<Filter<ILoggingEvent>> it = _filterList.iterator(); while(it.hasNext()) { Filter f = it.next(); if (f.getName().equals(logInclusionRule.getName())) { _filterList.remove(f... |
### Question:
ObjectUtils { public static boolean isValueType(Class<?> retType) { if (retType.isPrimitive() && retType != void.class) return true; if (Number.class.isAssignableFrom(retType)) return true; if (Boolean.class == retType) return true; if (Character.class == retType) return true; if (String.class == retType)... |
### Question:
ObjectUtils { public static boolean isCompatibleTypes(Class<?> type1, Class<?> type2) { if (type1.equals(type2)) return true; if (type1.isAssignableFrom(type2)) return true; if (type1.isPrimitive()) { Class<?> wrapperType = toWrapperType(type1); return isCompatibleTypes(wrapperType, type2); } else if (typ... |
### Question:
ObjectUtils { @SuppressWarnings("unchecked") public static <T extends Serializable> T deepCopy(T oldObj) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(bos)) { oos.writeObject(oldObj); oos.flush(); try (ObjectInputStream ois = new ObjectInpu... |
### Question:
Numbers { public static int compare(Number x, Number y) { if (isSpecial(x) || isSpecial(y)) { return Double.compare(x.doubleValue(), y.doubleValue()); } else { return toBigDecimal(x).compareTo(toBigDecimal(y)); } } private Numbers(); static int compare(Number x, Number y); static Object castNumber(Object... |
### Question:
DocumentUtils { public static boolean isRecent(Document recent, Document older) { if (Objects.deepEquals(recent.getRevision(), older.getRevision())) { return recent.getLastModifiedSinceEpoch() >= older.getLastModifiedSinceEpoch(); } return recent.getRevision() > older.getRevision(); } private DocumentUti... |
### Question:
DocumentUtils { public static Filter createUniqueFilter(Document document) { return Filter.byId(document.getId()); } private DocumentUtils(); static boolean isRecent(Document recent, Document older); static Filter createUniqueFilter(Document document); static Document skeletonDocument(NitriteMapper nitri... |
### Question:
DocumentUtils { public static <T> Document skeletonDocument(NitriteMapper nitriteMapper, Class<T> type) { if (nitriteMapper.isValueType(type)) { return Document.createDocument(); } T dummy = newInstance(type, true); Document document = nitriteMapper.convert(dummy, Document.class); return removeValues(docu... |
### Question:
DocumentUtils { public static boolean isSimilar(Document document, Document other, String... fields) { boolean result = true; if (document == null && other != null) return false; if (document != null && other == null) return false; if (document == null) return true; for (String field : fields) { result = ... |
### Question:
ThreadPoolManager { public static ExecutorService getThreadPool(int size, String threadName) { ExecutorService threadPool = Executors.newFixedThreadPool(size, threadFactory(threadName)); threadPools.add(threadPool); return threadPool; } static ExecutorService workerPool(); static ExecutorService getThrea... |
### Question:
LockService { public synchronized Lock getReadLock(String name) { if (lockRegistry.containsKey(name)) { ReentrantReadWriteLock rwLock = lockRegistry.get(name); return rwLock.readLock(); } ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock(); lockRegistry.put(name, rwLock); return rwLock.readLock()... |
### Question:
LockService { public synchronized Lock getWriteLock(String name) { if (lockRegistry.containsKey(name)) { ReentrantReadWriteLock rwLock = lockRegistry.get(name); return rwLock.writeLock(); } ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock(); lockRegistry.put(name, rwLock); return rwLock.writeLoc... |
### Question:
NotEqualsFilter extends IndexAwareFilter { @Override @SuppressWarnings("rawtypes") protected Set<NitriteId> findIndexedIdSet() { Set<NitriteId> idSet = new LinkedHashSet<>(); if (getIsFieldIndexed()) { if (getValue() == null || getValue() instanceof Comparable) { if (getIndexer() instanceof ComparableInde... |
### Question:
NotEqualsFilter extends IndexAwareFilter { @Override protected Set<NitriteId> findIdSet(NitriteMap<NitriteId, Document> collection) { Set<NitriteId> idSet = new LinkedHashSet<>(); if (getOnIdField() && getValue() instanceof String) { NitriteId nitriteId = NitriteId.createId((String) getValue()); if (!coll... |
### Question:
NotEqualsFilter extends IndexAwareFilter { @Override public boolean apply(Pair<NitriteId, Document> element) { Document document = element.getSecond(); Object fieldValue = document.get(getField()); return !deepEquals(fieldValue, getValue()); } protected NotEqualsFilter(String field, Object value); @Overr... |
### Question:
NotEqualsFilter extends IndexAwareFilter { @Override public void setIsFieldIndexed(Boolean isFieldIndexed) { if (!(getIndexer() instanceof TextIndexer && getValue() instanceof String)) { super.setIsFieldIndexed(isFieldIndexed); } } protected NotEqualsFilter(String field, Object value); @Override boolean ... |
### Question:
RegexFilter extends FieldBasedFilter { @Override public boolean apply(Pair<NitriteId, Document> element) { Document document = element.getSecond(); Object fieldValue = document.get(getField()); if (fieldValue != null) { if (fieldValue instanceof String) { Matcher matcher = pattern.matcher((String) fieldVa... |
### Question:
NitriteBuilder { public NitriteBuilder fieldSeparator(String separator) { this.nitriteConfig.fieldSeparator(separator); return this; } NitriteBuilder(); NitriteBuilder fieldSeparator(String separator); NitriteBuilder loadModule(NitriteModule module); NitriteBuilder addMigrations(Migration... migrations); ... |
### Question:
FluentFilter { public Filter eq(Object value) { return new EqualsFilter(field, value); } private FluentFilter(); static FluentFilter where("$"); static FluentFilter where(String field); Filter eq(Object value); Filter notEq(Object value); Filter gt(Comparable<?> value); Filter gte(Comparable<?> value); F... |
### Question:
FluentFilter { public Filter notEq(Object value) { return new NotEqualsFilter(field, value); } private FluentFilter(); static FluentFilter where("$"); static FluentFilter where(String field); Filter eq(Object value); Filter notEq(Object value); Filter gt(Comparable<?> value); Filter gte(Comparable<?> val... |
### Question:
FluentFilter { public Filter text(String value) { return new TextFilter(field, value); } private FluentFilter(); static FluentFilter where("$"); static FluentFilter where(String field); Filter eq(Object value); Filter notEq(Object value); Filter gt(Comparable<?> value); Filter gte(Comparable<?> value); F... |
### Question:
FluentFilter { public Filter regex(String value) { return new RegexFilter(field, value); } private FluentFilter(); static FluentFilter where("$"); static FluentFilter where(String field); Filter eq(Object value); Filter notEq(Object value); Filter gt(Comparable<?> value); Filter gte(Comparable<?> value);... |
### Question:
TextFilter extends StringFilter { @Override protected Set<NitriteId> findIndexedIdSet() { Set<NitriteId> idSet = new LinkedHashSet<>(); if (getIsFieldIndexed()) { if (getIndexer() instanceof TextIndexer) { TextIndexer textIndexer = (TextIndexer) getIndexer(); idSet = textIndexer.findText(getCollectionName... |
### Question:
EqualsFilter extends IndexAwareFilter { @Override @SuppressWarnings("rawtypes") protected Set<NitriteId> findIndexedIdSet() { Set<NitriteId> idSet = new LinkedHashSet<>(); if (getIsFieldIndexed()) { if (getValue() == null || getValue() instanceof Comparable) { if (getIndexer() instanceof ComparableIndexer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.