method2testcases stringlengths 118 6.63k |
|---|
### Question:
LDAPSSLSocketFactoryGenerator { public static Class<? extends AbstractLDAPSSLSocketFactory> createSubClass(String simpleName, final SSLSocketFactory sslSocketFactory) { final String fqcn = TARGET_PACKAGE_NAME + "." + simpleName; final byte[] classBytes = createSubClassByteCode(fqcn); try { final ClassLoad... |
### Question:
OAuth2AuthenticationProviderImpl extends AbstractAuthenticationManager<OAuth2AuthenticationProviderImpl> implements OAuth2AuthenticationProvider<OAuth2AuthenticationProviderImpl> { @Override public SaslNegotiator createSaslNegotiator(final String mechanism, final SaslSettings saslSettings, final NamedAddr... |
### 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:
OAuth2AuthenticationProviderImpl extends AbstractAuthenticationManager<OAuth2AuthenticationProviderImpl> implements OAuth2AuthenticationProvider<OAuth2AuthenticationProviderImpl> { @Override public AuthenticationResult authenticateViaAccessToken(final String accessToken, final NamedAddressSpace addressSpa... |
### 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:
PrincipalDatabaseAuthenticationManager extends AbstractAuthenticationManager<T> implements ExternalFileBasedAuthenticationManager<T> { @Override public AuthenticationResult authenticate(final String username, final String password) { try { if (_principalDatabase.verifyPassword(username, password.toCharArr... |
### 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:
AuthenticationResultCacher { public AuthenticationResult getOrLoad(final String[] credentials, final Callable<AuthenticationResult> loader) { try { if (_authenticationCache == null) { return loader.call(); } else { String credentialDigest = digestCredentials(credentials); return _authenticationCache.get(c... |
### 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:
Base64MD5PasswordFilePrincipalDatabase extends AbstractPasswordFilePrincipalDatabase<HashedUser> { @Override public boolean verifyPassword(String principal, char[] password) throws AccountNotFoundException { char[] pwd = lookupPassword(principal); if (pwd == null) { throw new AccountNotFoundException("Una... |
### Question:
UsernamePrincipal implements QpidPrincipal { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final UsernamePrincipal that = (UsernamePrincipal) o; if (!_name.equals(that._name)) { return false; } if (_authenti... |
### Question:
RolloverWatcher implements RollingPolicyDecorator.RolloverListener { public List<LogFileDetails> getLogFileDetails() { List<LogFileDetails> results = new ArrayList<>(); results.add(getFileDetails(_activeFilePath)); List<String> rolledFiles = new ArrayList<>(_rolledFiles); for (String fileName : rolledFile... |
### Question:
OAuth2Negotiator implements SaslNegotiator { @Override public AuthenticationResult handleResponse(final byte[] response) { if (_state == State.COMPLETE) { return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR, new IllegalStateException("Multiple Authentications not permitted."));... |
### Question:
RolloverWatcher implements RollingPolicyDecorator.RolloverListener { public ZippedContent getFilesAsZippedContent(Set<String> fileNames) { if (fileNames == null) { throw new IllegalArgumentException("File name cannot be null"); } Map<String, Path> paths = new TreeMap<>(); for (String name: fileNames) { Pa... |
### 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 int read() throws IOException { int count = -1; if (_current != null) { count = _current.read(); } if (count == -1 && _inputStreams.size() > 0) { if (_current != null) { _current.close(); } _current = _inputStreams.removeFirst(); count = read(); ... |
### 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:
AsynchronousMessageStoreRecoverer implements MessageStoreRecoverer { @Override public ListenableFuture<Void> recover(final QueueManagingVirtualHost<?> virtualHost) { _asynchronousRecoverer = new AsynchronousRecoverer(virtualHost); return _asynchronousRecoverer.recover(); } @Override ListenableFuture<Void... |
### 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:
BrokerLoggerStatusListener implements StatusListener { @Override public void addStatusEvent(Status status) { Throwable throwable = status.getThrowable(); if (status.getEffectiveLevel() == Status.ERROR && _errorClasses.stream().anyMatch(c -> c.isInstance(throwable))) { LOGGER.error("Unexpected error whilst... |
### Question:
AbstractConfigurationStoreUpgraderAndRecoverer { void register(StoreUpgraderPhase upgrader) { final String fromVersion = upgrader.getFromVersion(); final String toVersion = upgrader.getToVersion(); if (_upgraders.containsKey(fromVersion)) { throw new IllegalStateException(String.format( "Error in store up... |
### 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:
PreferencesRecoverer { public void recoverPreferences(ConfiguredObject<?> parent, Collection<PreferenceRecord> preferenceRecords, PreferenceStore preferencesStore) { Set<UUID> corruptedRecords = new HashSet<>(); Map<UUID, Collection<PreferenceRecord>> objectToRecordMap = new HashMap<>(); for (PreferenceRe... |
### Question:
JsonFilePreferenceStore extends AbstractJsonFileStore implements PreferenceStore { @Override public synchronized Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater) throws StoreException { if (_storeState != StoreState.CLOSED) { throw new IllegalStateException(String.format("Pre... |
### 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:
SuppressingInheritedAccessControlContextThreadFactory implements ThreadFactory { @Override public Thread newThread(final Runnable runnable) { return Subject.doAsPrivileged(_subject, new PrivilegedAction<Thread>() { @Override public Thread run() { Thread thread = _defaultThreadFactory.newThread(runnable); ... |
### 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:
UpgradeFrom5To6 extends AbstractStoreUpgrade { @Override public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, ConfiguredObject<?> parent) { reportStarting(environment, 5); upgradeMessages(environment, handler); upgradeConfiguredObjectsAndDependencies(environme... |
### 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:
BDBPreferenceStore extends AbstractBDBPreferenceStore { @Override public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater) throws StoreException { StoreState storeState = getStoreState(); if (StoreState.OPENED.equals(storeState) || StoreState.OPENING.equals(storeState)) { thro... |
### 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:
Exporter { public static ObjectMapper createObjectMapper() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setVisibility( objectMapper.getSerializationConfig().getDefaultVisibilityChecker() .withFieldVisibility(JsonAutoDetect.Visibility.ANY) .withGetterVisibility(JsonAutoDetect.Visibility.N... |
### Question:
ObjectUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static <T> T newInstance(Class<T> type, boolean createSkeleton) { try { if (type.isPrimitive() || type.isArray() || type == String.class) { return defaultValue(type); } ObjectInstantiator instantiator = getInstantiatorOf(type); T item = (T)... |
### 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:
NitriteBuilder { public Nitrite openOrCreate() { this.nitriteConfig.autoConfigure(); return new NitriteDatabase(nitriteConfig); } NitriteBuilder(); NitriteBuilder fieldSeparator(String separator); NitriteBuilder loadModule(NitriteModule module); NitriteBuilder addMigrations(Migration... migrations); Nitri... |
### 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:
ObjectUtils { public static <T> String getEntityName(Class<T> type) { if (type.isAnnotationPresent(Entity.class)) { Entity entity = type.getAnnotation(Entity.class); String name = entity.value(); if (name.contains(KEY_OBJ_SEPARATOR)) { throw new ValidationException(name + " is not a valid entity name"); }... |
### 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... |
### Question:
MappableMapper implements NitriteMapper { @Override @SuppressWarnings("unchecked") public <Source, Target> Target convert(Source source, Class<Target> type) { if (source == null) { return null; } if (isValue(source)) { return (Target) source; } else { if (Document.class.isAssignableFrom(type)) { return (T... |
### Question:
EqualsFilter 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 (collecti... |
### Question:
EqualsFilter extends IndexAwareFilter { @Override public boolean apply(Pair<NitriteId, Document> element) { Document document = element.getSecond(); Object fieldValue = document.get(getField()); return deepEquals(fieldValue, getValue()); } EqualsFilter(String field, Object value); @Override boolean apply(... |
### Question:
EqualsFilter extends IndexAwareFilter { @Override public void setIsFieldIndexed(Boolean isFieldIndexed) { if (!(getIndexer() instanceof TextIndexer && getValue() instanceof String)) { super.setIsFieldIndexed(isFieldIndexed); } } EqualsFilter(String field, Object value); @Override boolean apply(Pair<Nitrit... |
### Question:
UpdateOptions { public static UpdateOptions updateOptions(boolean insertIfAbsent) { UpdateOptions options = new UpdateOptions(); options.setInsertIfAbsent(insertIfAbsent); return options; } static UpdateOptions updateOptions(boolean insertIfAbsent); static UpdateOptions updateOptions(boolean insertIfAbse... |
### Question:
CollectionFactory { public NitriteCollection getCollection(String name, NitriteConfig nitriteConfig, boolean writeCatalogue) { notNull(nitriteConfig, "configuration is null while creating collection"); notEmpty(name, "collection name is null or empty"); Lock lock = lockService.getWriteLock(this.getClass()... |
### Question:
WriteOperations { WriteResult update(Filter filter, Document update, UpdateOptions updateOptions) { DocumentCursor cursor; if (filter == null || filter == Filter.ALL) { cursor = readOperations.find(); } else { cursor = readOperations.find(filter); } WriteResultImpl writeResult = new WriteResultImpl(); Doc... |
### Question:
WriteOperations { WriteResult remove(Filter filter, boolean justOnce) { DocumentCursor cursor; if (filter == null || filter == Filter.ALL) { cursor = readOperations.find(); } else { cursor = readOperations.find(filter); } WriteResultImpl result = new WriteResultImpl(); long count = 0; for (Document docume... |
### Question:
ReadOperations { public DocumentCursor find() { RecordStream<Pair<NitriteId, Document>> recordStream = nitriteMap.entries(); return new DocumentCursorImpl(recordStream); } ReadOperations(String collectionName,
NitriteConfig nitriteConfig,
NitriteMap<NitriteId, Documen... |
### Question:
ReadOperations { Document getById(NitriteId nitriteId) { return nitriteMap.get(nitriteId); } ReadOperations(String collectionName,
NitriteConfig nitriteConfig,
NitriteMap<NitriteId, Document> nitriteMap,
IndexOperations indexOperations); DocumentCur... |
### Question:
SortedDocumentCursor implements RecordStream<Pair<NitriteId, Document>> { @Override public Iterator<Pair<NitriteId, Document>> iterator() { Iterator<Pair<NitriteId, Document>> iterator = recordStream == null ? Collections.emptyIterator() : recordStream.iterator(); return new SortedDocumentIterator(field, ... |
### Question:
UnionStreamIterator implements Iterator<Pair<NitriteId, Document>> { @Override public boolean hasNext() { return nextItemSet || setNextEntry(); } UnionStreamIterator(RecordStream<Pair<NitriteId, Document>> lhsStream,
RecordStream<Pair<NitriteId, Document>> rhsStream); @Overr... |
### Question:
FilteredRecordStream implements RecordStream<Pair<NitriteId, Document>> { @Override public Iterator<Pair<NitriteId, Document>> iterator() { Iterator<Pair<NitriteId, Document>> iterator = recordStream == null ? Collections.emptyIterator() : recordStream.iterator(); return new FilteredIterator(iterator, fil... |
### Question:
JoinedDocumentStream implements RecordStream<Document> { @Override public String toString() { return toList().toString(); } JoinedDocumentStream(RecordStream<Pair<NitriteId, Document>> recordStream,
DocumentCursor foreignCursor,
Lookup lookup); @Override I... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.