All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.objectify.impl.translate.CreateContext Maven / Gradle / Ivy

There is a newer version: 6.1.2
Show newest version
package com.googlecode.objectify.impl.translate;

import com.google.cloud.datastore.FullEntity;
import com.googlecode.objectify.ObjectifyFactory;
import com.googlecode.objectify.impl.Path;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/** 
 * The context while creating translator factories. Tracks important state as we navigate the class graph.
 * 
 * @author Jeff Schnitzer 
 */
@RequiredArgsConstructor
public class CreateContext
{
	/** */
	@Getter
	private final ObjectifyFactory factory;

	/**
	 * Get the relevant translator, creating it if necessary.
	 */
	public  Translator getTranslator(final TypeKey

tk, final CreateContext ctx, final Path path) { return factory.getTranslators().get(tk, ctx, path); } /** * Get the populator for the specified class. This requires looking up the * translator for that class and then getting the populator from it. * * @param clazz is the class we want a populator for. */ @SuppressWarnings("unchecked") public

Populator

getPopulator(final Class

clazz, final Path path) { if (clazz == null || clazz.equals(Object.class)) { return (Populator

)NullPopulator.INSTANCE; } else { final ClassTranslator

classTranslator = (ClassTranslator

)this.>getTranslator(new TypeKey<>(clazz), this, path); return classTranslator.getPopulator(); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy