本文整理汇总了Java中com.googlecode.objectify.ObjectifyFactory类的典型用法代码示例。如果您正苦于以下问题:Java ObjectifyFactory类的具体用法?Java ObjectifyFactory怎么用?Java ObjectifyFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectifyFactory类属于com.googlecode.objectify包,在下文中一共展示了ObjectifyFactory类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initOfyOnce
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
/**
* Performs static initialization for Objectify to register types and do other setup.
*
* <p>This method is non-idempotent, so it should only be called exactly once, which is achieved
* by calling it from this class's static initializer block.
*/
private static void initOfyOnce() {
// Set an ObjectifyFactory that uses our extended ObjectifyImpl.
// The "false" argument means that we are not using the v5-style Objectify embedded entities.
com.googlecode.objectify.ObjectifyService.setFactory(new ObjectifyFactory(false) {
@Override
public Objectify begin() {
return new SessionKeyExposingObjectify(this);
}
@Override
protected AsyncDatastoreService createRawAsyncDatastoreService(DatastoreServiceConfig cfg) {
// In the unit test environment, wrap the Datastore service in a proxy that can be used to
// examine the number of requests sent to Datastore.
AsyncDatastoreService service = super.createRawAsyncDatastoreService(cfg);
return RegistryEnvironment.get().equals(RegistryEnvironment.UNITTEST)
? new RequestCapturingAsyncDatastoreService(service)
: service;
}});
// Translators must be registered before any entities can be registered.
registerTranslators();
registerEntityClasses(EntityClasses.ALL_CLASSES);
}
示例2: before
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
@Before
public void before() {
helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()).setUp();
// Clear out the factory so that it requires re-registration on each test method.
// Otherwise, static registration of types in one method would persist across methods.
initOfy();
factory = ObjectifyService.factory();
ObjectifyService.setFactory(new ObjectifyFactory(false));
}
示例3: setUpBeforeClass
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() {
// Reset the Factory so that all translators work properly.
ObjectifyService.setFactory(new ObjectifyFactory());
ObjectifyService.register(Game.class);
// Mock out the firebase config
FirebaseChannel.firebaseConfigStream = new ByteArrayInputStream(
String.format("databaseURL: \"%s\"", FIREBASE_DB_URL).getBytes());
}
示例4: setUpBeforeClass
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() {
// Reset the Factory so that all translators work properly.
ObjectifyService.setFactory(new ObjectifyFactory());
ObjectifyService.register(Game.class);
// Mock out the firebase config
FirebaseChannel.firebaseConfigStream =
new ByteArrayInputStream(String.format("databaseURL: \"%s\"", FIREBASE_DB_URL).getBytes());
}
示例5: init
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
@Override
public void init(final ObjectifyFactory fact, final Field field)
{
Preconditions.checkNotNull(fact);
Preconditions.checkNotNull(field);
// Store off the field for use in the matches method.
this.field = field;
}
示例6: before
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
@Before
public void before() throws NoSuchFieldException
{
this.fact = new ObjectifyFactory();
this.numShardsField = CounterData.class.getDeclaredField("numShards");
this.counterStatusField = CounterData.class.getDeclaredField("counterStatus");
this.counterDescriptionField = CounterData.class.getDeclaredField("description");
this.counterCountField = CounterGroupData.class.getDeclaredField("eventuallyConsistentCount");
this.counterData = new CounterData("testCounterName", 3);
}
示例7: addTranslators
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
@Override
protected void addTranslators(ObjectifyFactory factory) {
for (TranslatorFactory translatorFactory : ApplicationModule.objectifyTranslatorFactories()) {
factory.getTranslators().add(translatorFactory);
}
}
示例8: addDefaultTranslators
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
public static void addDefaultTranslators() {
// register Objectify converter to convert between java.uil.Date and org.joda.time.DateTime
ObjectifyFactory objectifyFactory = ObjectifyService.factory();
JodaTimeTranslators.add(objectifyFactory);
objectifyFactory.getTranslators().add(new UUIDTranslatorFactory());
}
示例9: addTranslators
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
protected void addTranslators(ObjectifyFactory factory) {
}
示例10: newObjectifyFactory
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
protected ObjectifyFactory newObjectifyFactory() {
return new ObjectifyFactory();
}
示例11: factory
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
public static ObjectifyFactory factory() {
return ObjectifyService.factory();
}
示例12: factory
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
public static ObjectifyFactory factory() {
return ObjectifyService.factory();
}
示例13: factory
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
/** Returns the wrapped Objectify's ObjectifyFactory. */
public ObjectifyFactory factory() {
return ofy().factory();
}
示例14: SessionKeyExposingObjectify
import com.googlecode.objectify.ObjectifyFactory; //导入依赖的package包/类
public SessionKeyExposingObjectify(ObjectifyFactory factory) {
super(factory);
}