Package com.googlecode.objectify.annotation

Examples of com.googlecode.objectify.annotation.Subclass


    super(loader);

    this.actual = new com.google.appengine.api.datastore.Query(Key.getKind(clazz));

    // If this is a polymorphic subclass, add an extra filter
    Subclass sub = clazz.getAnnotation(Subclass.class);
    if (sub != null) {
      String discriminator = sub.name().length() > 0 ? sub.name() : clazz.getSimpleName();
      this.addFilter(FilterOperator.EQUAL.of(ClassTranslator.DISCRIMINATOR_INDEX_PROPERTY, discriminator));
    }

    this.classRestriction = clazz;
  }
View Full Code Here


    this.declaredClass = declaredClass;
    this.creator = creator;
    this.populator = populator;

    Subclass sub = declaredClass.getAnnotation(Subclass.class);
    if (sub != null) {
      discriminator = (sub.name().length() > 0) ? sub.name() : declaredClass.getSimpleName();
      addIndexedDiscriminators(declaredClass);
    } else {
      discriminator = null;
    }
  }
View Full Code Here

    if (clazz == Object.class)
      return;

    this.addIndexedDiscriminators(clazz.getSuperclass());

    Subclass sub = clazz.getAnnotation(Subclass.class);
    if (sub != null && sub.index()) {
      String disc = (sub.name().length() > 0) ? sub.name() : clazz.getSimpleName();
      this.indexedDiscriminators.add(disc);
    }
  }
View Full Code Here

   * to translate an instance of the subclass, we will forward to the correct translator.
   */
  public void registerSubclass(ClassTranslator<? extends P> translator) {
    byDiscriminator.put(translator.getDiscriminator(), translator);

    Subclass sub = translator.getDeclaredClass().getAnnotation(Subclass.class);
    for (String alsoLoad: sub.alsoLoad())
      byDiscriminator.put(alsoLoad, translator);

    byClass.put(translator.getDeclaredClass(), translator);
  }
View Full Code Here

TOP

Related Classes of com.googlecode.objectify.annotation.Subclass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.