google-app-engine


Share class between endpoint and Objectify with different field subset


Say this is my classes
#Entity
public class Library{
...
}
#Entity
public class Book{
#Load
#Parent
#ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
private Ref<Library> libraryRef;
#Ignore
private Library library;
}
I want to send List<Book> to the "android" client: I don't want the android client to get libraryRef but I want the client to get library
Here is the data access method I have now
public static List< Book > getAllBooks(){
return OfyService.ofy().load().type(Book.class).list();
}
My endpoint will just return List<Book> to android. I believe I have accomplished the first part: make sure datastore does not store library but libraryRef. But how do I accomplish the second part: make sure the client gets library?
I am sure it is not yet loaded. How do I make sure it is loaded? Do I have to use my own for-loop for iteration?
My advice for anyone working with code shared between client and server is to make a clean separation between your API objects and your domain objects. It's a little more work up front to make DTOs but it makes your whole system more flexible - if you want to change your domain objects, you don't risk breaking a zillion mobile phone apps that are on a slow (or nonexistant) upgrade cycle.

Related Links

Use a subdomain instead of https://storage.googleapis.com
App Engine Flexible to Cloud Storage Network Unreachable
Google Cloud Search API - is there a limit to number of document puts per second?
Stackdriver Analysis report unavailable error
Dependencies not installing from lib directory in google app engine
what is uri / server error
GAE : What is the preferred way of ensuring an outside task really finishes?
WebRTC app.yaml file does not exists
collection_name for ndb.KeyProperty
Is there any way to access Firebase from an App Engine servlet without using manual scaling or the flexible environment?
Why does Google Cloud SQL (using JDBC) take longer to insert records from Google App Engine than from my personal computer?
How do I track Google account logins on python GAE?
Delete and Rename events in google drive
App Engine - How to Clear Cookie
How do I get the path to the Cloud SDK directory using the gcloud command?
Cannot reach Endpoint method with cURL

Categories

HOME
shell
kentico
porting
hyperlink
c++11
mjml
socket.io
switch-statement
scripting
telegram-bot
vert.x
character
modal-dialog
p2p
fhir
text-mining
x-cart
naivebayes
comsol
eip
event-sourcing
imessage
production
articulate-storyline
ember-cli
roslyn
visual-studio-extensions
gmock
expressionengine3
fractions
paperjs
errbot
jaws
sqsh
volatile
sql-server-2000
instantiation
mnist
numpy-broadcasting
sql-server-ce
xdocreport
password-protection
chef-solo
mcustomscrollbar
wmp
preloader
angular-http
spring-integration-sftp
lightning
remedy
amq
bbpress
java-websocket
custom-lists
windows-azure-queues
avspeechsynthesizer
omniauth-facebook
riot
boost-serialization
html-to-pdf
fink
beanstalk
grass
mobiledoc-kit
asyncdisplaykit
libvlc
wiredep
ess
flock
pax-exam
amiga
dronekit-android
rdflib
nutiteq
device-tree
imagefilter
cbind
cancellation
alternate
terminate
menubar
mt4j
embedded-fonts
inputmismatchexception
windows-98
saleslogix
azman
jsr286
listactivity
creole
dataform
objective-j
opml
glui
visualj#
fault-tolerance
image-capture

Resources

Encrypt Message