本文整理了Java中com.persistit.Key.decode()
方法的一些代码示例,展示了Key.decode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Key.decode()
方法的具体详情如下:
包路径:com.persistit.Key
类名称:Key
方法名:decode
[英]Decodes the next key segment as an Object
, advances the index to the next key segment and returns the result.
[中]将下一个键段解码为Object
,将索引前进到下一个键段并返回结果。
代码示例来源:origin: SonarSource/sonarqube
/**
* Returns the set of keys associated with this cache.
*
* @return The set containing the keys for this cache.
*/
public Set<Object> keySet() {
try {
Set<Object> keys = new LinkedHashSet<>();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: SonarSource/sonarqube
@SuppressWarnings("rawtypes")
public Set keySet(Object firstKey, Object secondKey) {
try {
Set<Object> keys = new LinkedHashSet<>();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(firstKey);
iteratorExchange.append(secondKey);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: SonarSource/sonarqube
/**
* Returns the set of cache keys associated with this group.
* TODO implement a lazy-loading equivalent with Iterator/Iterable
*
* @return The set of cache keys for this group.
*/
@SuppressWarnings("rawtypes")
public Set keySet(Object key) {
try {
Set<Object> keys = new LinkedHashSet<>();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(key);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: SonarSource/sonarqube
@SuppressWarnings("unchecked")
@Override
public Entry<T> next() {
try {
exchange.next(keyFilter);
} catch (PersistitException e) {
throw new IllegalStateException(e);
}
if (exchange.getValue().isDefined()) {
T value = (T) exchange.getValue().get();
Key key = exchange.getKey();
Object[] array = new Object[key.getDepth()];
for (int i = 0; i < key.getDepth(); i++) {
array[i] = key.indexTo(i - key.getDepth()).decode();
}
return new Entry<>(array, value);
}
throw new NoSuchElementException();
}
代码示例来源:origin: com.akiban/akiban-persistit
/**
* Decodes the next key segment as an <code>Object</code>, advances the
* index to the next key segment and returns the result.
*
* @return The Object value, or <code>null</code> if the encoded value is
* null.
* @throws ConversionException
* if the next key segment value is not a boolean.
*/
public Object decode() {
return decode(null, null);
}
代码示例来源:origin: com.akiban/akiban-persistit
@Override
void fromKey(final Object object, final Key key) throws Exception {
final Object arg = key.decode();
_setMethod.invoke(object, new Object[] { arg });
}
代码示例来源:origin: com.akiban/akiban-persistit
void fromKey(final Object object, final Key key) throws Exception {
final Object arg = key.decode();
_field.set(object, arg);
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch
/**
* Returns the set of keys associated with this cache.
*
* @return The set containing the keys for this cache.
*/
public Set<Object> keySet() {
try {
Set<Object> keys = Sets.newLinkedHashSet();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: org.codehaus.sonar/sonar-batch
/**
* Returns the set of keys associated with this cache.
*
* @return The set containing the keys for this cache.
*/
public Set<Object> keySet() {
try {
Set<Object> keys = Sets.newLinkedHashSet();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-engine
/**
* Returns the set of keys associated with this cache.
*
* @return The set containing the keys for this cache.
*/
public Set<Object> keySet() {
try {
Set<Object> keys = new LinkedHashSet<>();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: org.codehaus.sonar/sonar-batch
@SuppressWarnings("rawtypes")
public Set keySet(Object firstKey, Object secondKey) {
try {
Set<Object> keys = Sets.newLinkedHashSet();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(firstKey);
iteratorExchange.append(secondKey);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch
@SuppressWarnings("rawtypes")
public Set keySet(Object firstKey, Object secondKey) {
try {
Set<Object> keys = Sets.newLinkedHashSet();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(firstKey);
iteratorExchange.append(secondKey);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: org.codehaus.sonar/sonar-batch
/**
* Returns the set of cache keys associated with this group.
* TODO implement a lazy-loading equivalent with Iterator/Iterable
*
* @param group The group.
* @return The set of cache keys for this group.
*/
@SuppressWarnings("rawtypes")
public Set keySet(Object key) {
try {
Set<Object> keys = Sets.newLinkedHashSet();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(key);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-engine
@SuppressWarnings("rawtypes")
public Set keySet(Object firstKey, Object secondKey) {
try {
Set<Object> keys = new LinkedHashSet<>();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(firstKey);
iteratorExchange.append(secondKey);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch
/**
* Returns the set of cache keys associated with this group.
* TODO implement a lazy-loading equivalent with Iterator/Iterable
*
* @param group The group.
* @return The set of cache keys for this group.
*/
@SuppressWarnings("rawtypes")
public Set keySet(Object key) {
try {
Set<Object> keys = Sets.newLinkedHashSet();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(key);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-engine
/**
* Returns the set of cache keys associated with this group.
* TODO implement a lazy-loading equivalent with Iterator/Iterable
*
* @return The set of cache keys for this group.
*/
@SuppressWarnings("rawtypes")
public Set keySet(Object key) {
try {
Set<Object> keys = new LinkedHashSet<>();
exchange.clear();
Exchange iteratorExchange = new Exchange(exchange);
iteratorExchange.append(key);
iteratorExchange.append(Key.BEFORE);
while (iteratorExchange.next(false)) {
keys.add(iteratorExchange.getKey().indexTo(-1).decode());
}
return keys;
} catch (Exception e) {
throw new IllegalStateException("Fail to get keys from cache " + name, e);
}
}
代码示例来源:origin: com.akiban/akiban-persistit
/**
* Returns the last (highest) key currently in this
* <code>PersistitMap</code> as determined by the <a
* href="Key.html#_keyOrdering">key ordering specification</a>.
*
* @return the last (highest) key currently in the backing store for this
* <code>PersistitMap</code>.
*
* @throws NoSuchElementException
* if this map is empty.
*/
@Override
public K lastKey() {
toRightEdge();
try {
if (_ex.traverse(Key.LT, false, -1) && (_fromKey == null || _fromKey.compareTo(_ex.getKey()) <= 0)) {
return (K) _ex.getKey().decode();
} else
throw new NoSuchElementException();
} catch (final PersistitException de) {
throw new PersistitMapException(de);
}
}
代码示例来源:origin: org.codehaus.sonar/sonar-batch
@SuppressWarnings("unchecked")
@Override
public Entry<T> next() {
try {
exchange.next(keyFilter);
} catch (PersistitException e) {
throw new IllegalStateException(e);
}
if (exchange.getValue().isDefined()) {
T value = (T) exchange.getValue().get();
Key key = exchange.getKey();
Object[] array = new Object[key.getDepth()];
for (int i = 0; i < key.getDepth(); i++) {
array[i] = key.indexTo(i - key.getDepth()).decode();
}
return new Entry<T>(array, value);
}
throw new NoSuchElementException();
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-engine
@SuppressWarnings("unchecked")
@Override
public Entry<T> next() {
try {
exchange.next(keyFilter);
} catch (PersistitException e) {
throw new IllegalStateException(e);
}
if (exchange.getValue().isDefined()) {
T value = (T) exchange.getValue().get();
Key key = exchange.getKey();
Object[] array = new Object[key.getDepth()];
for (int i = 0; i < key.getDepth(); i++) {
array[i] = key.indexTo(i - key.getDepth()).decode();
}
return new Entry<>(array, value);
}
throw new NoSuchElementException();
}
代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch
@SuppressWarnings("unchecked")
@Override
public Entry<T> next() {
try {
exchange.next(keyFilter);
} catch (PersistitException e) {
throw new IllegalStateException(e);
}
if (exchange.getValue().isDefined()) {
T value = (T) exchange.getValue().get();
Key key = exchange.getKey();
Object[] array = new Object[key.getDepth()];
for (int i = 0; i < key.getDepth(); i++) {
array[i] = key.indexTo(i - key.getDepth()).decode();
}
return new Entry<>(array, value);
}
throw new NoSuchElementException();
}
内容来源于网络,如有侵权,请联系作者删除!