com.googlecode.objectify.Key.getName()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中com.googlecode.objectify.Key.getName()方法的一些代码示例,展示了Key.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Key.getName()方法的具体详情如下:
包路径:com.googlecode.objectify.Key
类名称:Key
方法名:getName

Key.getName介绍

暂无

代码示例

代码示例来源:origin: com.threewks.thundr/thundr-gae

@Override
  public String from(Key<E> from) {
    return from.getName();
  }
};

代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine

@Override
public String toString() {
  return segment.getName() + "[" + id + "]";
}

代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine

@Override
public String toString() {
  return index.getName() + "->" + name;
}

代码示例来源:origin: com.threewks.thundr/thundr-gae

@Override
  public UUID from(Key<E> from) {
    return UUID.fromString(from.getName());
  }
};

代码示例来源:origin: com.googlecode.cedar-common/objectify

@Override
  protected Map<S, T> wrap(Map<Key<T>, T> base) throws Exception
  {
    Map<S, T> result = new LinkedHashMap<S, T>(base.size() * 2);
    
    for (Map.Entry<Key<T>, T> entry: base.entrySet())
    {
      Object mapKey = entry.getKey().getName() != null ? entry.getKey().getName() : entry.getKey().getId();
      result.put((S)mapKey, entry.getValue());
    }
    
    return result;
  }
};

代码示例来源:origin: instacount/appengine-counter

/**
 * Helper method to compute the shard number index from an instance of {@link Key} of type {@link CounterShardData}.
 * This method assumes that the "name" field of a counter shard key will end in a dash, followed by the shard
 * index.
 *
 * @param counterShardDataKey
 * @return
 */
public static Integer computeShardIndex(final Key<CounterShardData> counterShardDataKey) {
  Preconditions.checkNotNull(counterShardDataKey);
  final String key = counterShardDataKey.getName();
  int lastDashIndex = key.lastIndexOf("-");
  final String shardIndexAsString = key.substring((lastDashIndex + 1), key.length());
  return Integer.valueOf(shardIndexAsString);
}

代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine

@Override
  public LuceneIndex newInstance(Key<LuceneIndex> key) {
    return new LuceneIndex(key.getName());
  }
}

代码示例来源:origin: instacount/appengine-counter

/**
 * Param-based Constructor
 *
 * @param counterShardDataKey
 */
public CounterShardData(final Key<CounterShardData> counterShardDataKey)
{
  Preconditions.checkNotNull(counterShardDataKey);
  setId(counterShardDataKey.getName());
}

代码示例来源:origin: bedatadriven/activityinfo

public ResourceId getFormId() {
  return ResourceId.valueOf(formKey.getName());
}

代码示例来源:origin: bedatadriven/activityinfo

public ResourceId getFormId() {
  return ResourceId.valueOf(formKey.getName());
}

代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine

public SegmentHunk newHunk() {
  hunkCount++;
  log.debug("Created Hunk '{}-{}-{}'.", index.getName(), name, hunkCount);
  return new SegmentHunk(getKey(), hunkCount);
}

代码示例来源:origin: instacount/appengine-counter

/**
 * Create a {@link Key Key<CounterShardData>}. Keys for this entity are not "parented" so that they can be added
 * under high volume load in a given application. Note that CounterData will be in a namespace specific.
 *
 * @param counterDataKey
 * @param shardNumber
 * @return
 */
public static Key<CounterShardData> key(final Key<CounterData> counterDataKey, final int shardNumber)
{
  // Preconditions checked by #constructCounterShardIdentifier
  return Key.create(CounterShardData.class,
    constructCounterShardIdentifier(counterDataKey.getName(), shardNumber));
}

代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine

/**
 * Method used for testing purpose useful for printing segment information.
 * @param segment The segment to print
 * @param name The name of the hunk to print
 * @param index The index of the hunk to print
 */
protected void logSegment(Segment segment, String name, int index) {
  Objectify objectify = ofy();
  final SegmentHunk hunk = objectify.load().key(newSegmentHunkKey(name, index)).now();
  hunk.bytes = Arrays.copyOfRange(hunk.bytes, 0, (int) (hunk.bytes.length % (segment.length / hunk.id)));
  log.info("Hunk '{}-{}-{}' with length {}, Value={}", 
      indexKey.getName(), name, hunk.id, hunk.bytes.length, new String(hunk.bytes));
}
/*

代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine

@Override
public String[] listAll() {
  final Objectify objectify = ofy();
  final List<Key<Segment>> keys = objectify.load().type(Segment.class).ancestor(indexKey).keys().list();
  String[] names = new String[keys.size()];
  int i = 0;
  for (Key<Segment> name : keys)
    names[i++] = name.getName();
  return names;
}
/**

代码示例来源:origin: instacount/appengine-counter

@Test
public void getterTest() throws Exception
{
  final Key<CounterData> counterDataKey = CounterData.key(TEST_COUNTER1);
  final Key<CounterShardData> counterShardDataKey = CounterShardData.key(counterDataKey, 0);
  final UUID uuid = UUID.randomUUID();
  final CounterShardOperationData counterShardOperationData = new CounterShardOperationData(counterShardDataKey,
    uuid, CounterOperationType.INCREMENT, 1L);
  assertThat(counterShardOperationData.getMutationAmount(), is(1L));
  assertThat(counterShardOperationData.getCounterShardDataKey(), is(counterShardDataKey));
  assertThat(counterShardOperationData.getId(), is(uuid.toString()));
  assertThat(
    counterShardOperationData.getCreationDateTime().isBefore(DateTime.now(DateTimeZone.UTC).plusSeconds(10)),
    is(true));
  // TypedKey
  assertThat(counterShardOperationData.getTypedKey().getName(), is(uuid.toString()));
  assertThat(counterShardOperationData.getTypedKey().getParent().getName(), is(counterShardDataKey.getName()));
  // RawKey
  assertThat(counterShardOperationData.getKey().getName(), is(uuid.toString()));
}

相关文章