Package siena

Examples of siena.ClassInfo


  }

 
  public void update(Object obj) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
   
    String domain = SdbMappingUtils.getDomainName(clazz, prefix);
   
    try {
      checkDomain(domain);
View Full Code Here


  }
 
  @Override
  public void save(Object obj) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
    Field idField = info.getIdField();
   
    //Entity entity;
    Object idVal = Util.readField(obj, idField);
    // id with null value means insert
    if(idVal == null){
View Full Code Here

    List<Object> entities2Insert = new ArrayList<Object>();
    List<Object> entities2Update = new ArrayList<Object>();

    for(Object obj:objects){
      Class<?> clazz = obj.getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
      Field idField = info.getIdField();
     
      Object idVal = Util.readField(obj, idField);
      // id with null value means insert
      if(idVal == null){
        entities2Insert.add(obj);
View Full Code Here

    else throw new SienaException("Field " + idField.getName() + " is not an @Id field");
  }
 
  public static Key getKey(Object obj) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
   
    try {
      Field idField = info.getIdField();
      Object value = Util.readField(obj, idField);
      // TODO verify that returning NULL is not a bad thing
      if(value == null) return null;
     
      Class<?> type = idField.getType();
View Full Code Here

    }
  }
 
  public static Key getKeyFromParent(Object obj, Key parentKey, ClassInfo parentInfo, Field parentField) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
   
    try {
      Field idField = info.getIdField();
      Object value = Util.readField(obj, idField);
      // TODO verify that returning NULL is not a bad thing
      if(value == null) return null;
     
      Class<?> type = idField.getType();
View Full Code Here

 
  public static Key makeKeyFromId(Class<?> clazz, Object idVal) {
    if(idVal == null)
      throw new SienaException("makeKeyFromId with Id null");
   
    ClassInfo info = ClassInfo.getClassInfo(clazz);
   
    try {
      Field idField = info.getIdField();
     
      if(idField.isAnnotationPresent(Id.class)){
        Id id = idField.getAnnotation(Id.class);
        switch(id.value()) {
        case NONE:
View Full Code Here

    }
  }

  public static void fillModelAndKey(Object obj, Entity entity) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
   
    Field id = info.getIdField();
    Class<?> fieldClass = id.getType();
    Key key = entity.getKey();
    if (key != null) {
      setIdFromKey(id, obj, key);
    }
View Full Code Here

    return new HBaseQuery<T>(clazz);
  }

  public void delete(Object obj) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
    try {
      HTable table = new HTable(config, info.tableName);
      Field id = ClassInfo.getIdField(clazz);
      id.setAccessible(true);
      Delete d = new Delete(Bytes.toBytes(id.get(obj).toString()));
View Full Code Here

    }
  }

  public void get(Object obj) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
    try {
      HTable table = new HTable(config, info.tableName);
      Field id = ClassInfo.getIdField(clazz);
      id.setAccessible(true);
     
View Full Code Here

    return pm.createOne(clazz);
  }

  @Override
  public void get(Object obj) {
    ClassInfo ci = ClassInfo.getClassInfo(obj.getClass());
    LifeCycleUtils.executeMethods(LifeCyclePhase.PRE_FETCH, ci, obj);
    pm.get(obj);
    LifeCycleUtils.executeMethods(LifeCyclePhase.POST_FETCH, ci, obj);
  }
View Full Code Here

TOP

Related Classes of siena.ClassInfo

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.