/src/com/google/appengine/datanucleus/annotations/UnownedHandler.java

http://datanucleus-appengine.googlecode.com/ · Java · 32 lines · 11 code · 2 blank · 19 comment · 0 complexity · 64f919ac4bd98b256542c3f18c301e0f MD5 · raw file

  1. /*
  2. * Copyright (C) 2011 Google Inc
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.google.appengine.datanucleus.annotations;
  17. import org.datanucleus.ClassLoaderResolver;
  18. import org.datanucleus.metadata.AbstractMemberMetaData;
  19. import org.datanucleus.metadata.annotations.AnnotationObject;
  20. import org.datanucleus.metadata.annotations.MemberAnnotationHandler;
  21. /**
  22. * Handler for the {@link Unowned} annotation when applied to a field/property of a persistable class.
  23. * Adds the metadata extension "gae.unowned" as "true" for the member in question.
  24. */
  25. public class UnownedHandler implements MemberAnnotationHandler
  26. {
  27. public void processMemberAnnotation(AnnotationObject ann, AbstractMemberMetaData mmd, ClassLoaderResolver clr) {
  28. mmd.addExtension("gae.unowned", "true");
  29. }
  30. }