Examples of MetaField


Examples of com.alvazan.orm.impl.meta.data.MetaField

    DboColumnMeta metaFieldDbo = typeInfo.getColumnInfo();
    String colFamily = metaFieldDbo.getOwner().getColumnFamily();
    String columnName = metaFieldDbo.getColumnName();
    MetaClass metaClass = metaInfo.getMetaClass(colFamily);
    MetaField metaField = metaClass.getMetaFieldByCol(targetSubclass, columnName);
   
    Field field = metaField.getField();
    Class fieldType = field.getType();
    //Are actual type will never be a primitive because of autoboxing.  When the param
    //is passed in, it becomes an Long, Integer, etc. so we need to convert here
    Class objectFieldType = DboColumnMeta.convertIfPrimitive(fieldType);
    if(value!=null){
      Class actualType = value.getClass();

      if(!objectFieldType.isAssignableFrom(actualType)){
        throw new TypeMismatchException("value [" + value
            + "] is not the correct type for the parameter='"+name+"' from inspecting the Entity.  Type should be=["
            + fieldType + "]");
      }    
    }
 
    byte[] data = metaField.translateValue(value);
   
    indexQuery.setParameter(name, data);
    return this;
  }
View Full Code Here

Examples of com.alvazan.orm.impl.meta.data.MetaField

    String colNameOrig = embedded.columnNamePrefix();
    String colName = field.getName();
    if(!"".equals(colNameOrig))
      colName = colNameOrig;
   
    MetaField metaField;
    if(type.isAnnotationPresent(NoSqlEmbeddable.class)) {
      MetaAbstractClass<?> fkMeta = metaInfo.findOrCreate(type);
      MetaEmbeddedEntity temp = metaEmbeddedProvider.get();
      temp.setup(t, field, colName, fkMeta);
      metaField = temp;
View Full Code Here

Examples of com.alvazan.orm.impl.meta.data.MetaField

      return;
   
    if(processIdFieldWorks(metaClass, metaDbo, field))
      return;
   
    MetaField metaField;
    if(field.isAnnotationPresent(NoSqlManyToOne.class))
      metaField = inspectorField.processManyToOne(metaDbo, field);
    else if(field.isAnnotationPresent(NoSqlOneToOne.class))
      metaField = inspectorField.processOneToOne(metaDbo, field);
    else if(field.isAnnotationPresent(NoSqlManyToMany.class))
View Full Code Here

Examples of com.alvazan.orm.impl.meta.data.MetaField

    DboColumnMeta metaFieldDbo = typeInfo.getColumnInfo();
    String colFamily = metaFieldDbo.getOwner().getColumnFamily();
    String columnName = metaFieldDbo.getColumnName();
    MetaClass metaClass = metaInfo.getMetaClass(colFamily);
    MetaField metaField = metaClass.getMetaFieldByCol(targetSubclass, columnName);
   
    Field field = metaField.getField();
    Class fieldType = field.getType();
    //Are actual type will never be a primitive because of autoboxing.  When the param
    //is passed in, it becomes an Long, Integer, etc. so we need to convert here
    Class objectFieldType = ConverterUtil.convertIfPrimitive(fieldType);
    if(value!=null){
      Class actualType = value.getClass();

      if(!objectFieldType.isAssignableFrom(actualType)){
        throw new TypeMismatchException("value [" + value
            + "] is not the correct type for the parameter='"+name+"' from inspecting the Entity.  Type should be=["
            + fieldType + "]");
      }    
    }
 
    byte[] data = metaField.translateValue(value);
   
    indexQuery.setParameter(name, data);
    return this;
  }
View Full Code Here

Examples of com.cloudhopper.commons.util.annotation.MetaField

                // is this field marked as a MetaField?
                if (f.isAnnotationPresent(MetaField.class)) {

                    // get the annotation
                    MetaField metaField = f.getAnnotation(MetaField.class);

                    // create the new counter info object we'll store
                    // now, this class may actually still represent a class we want to recursively search
                    // we'll create the new info object for now, but this may change
                    MetaFieldInfo info = new MetaFieldInfo();
                   
                    // save the field name
                    info.fieldName = f.getName();
                    // save the field class
                    info.fieldClass = f.getType();
                    // save the level
                    info.level = metaField.level();

                    // is there an annotated name? if not we'll default to the field name
                    info.name = preFieldName + (!metaField.name().equals("") && !ignoreAnnotatedName ? metaField.name() : f.getName()) + postFieldName;

                    // default the recursive pre field names
                    String recursivePreFieldName = preFieldName + f.getName() + ".";
                    String recursivePostFieldName = "";
                   
                    // if this had an actual name, not using the field name, slightly diff format
                    if (!metaField.name().equals("") && !ignoreAnnotatedName) {
                        // only add [ and ] if this is not the first
                        if (!preFieldName.equals("")) {
                            recursivePreFieldName = preFieldName + metaField.name() + "][";
                            recursivePostFieldName = "]";
                        } else {
                            recursivePreFieldName = metaField.name() + "[";
                            recursivePostFieldName = "]";
                        }
                    }

                    // required to read private variables
                    f.setAccessible(true);

                    // read the actual value if the obj isn't null
                    if (obj != null) {
                        // get the actual value
                        try {
                            info.actualValue = f.get(obj);
                        } catch (Exception e) {
                            logger.error("impossible case if run outside of an applet");
                        }

                        //
                        // handle "unwrapping" objects -- AtomicReference
                        //
                        if (info.actualValue != null && f.getType().equals(AtomicReference.class)) {
                            //logger.debug("AtomicReference found, going to unwrap it");
                            AtomicReference ref = (AtomicReference)info.actualValue;
                            // get the actual underlying value
                            info.actualValue = ref.get();
                            // if not null, we can get its type too
                            if (info.actualValue != null) {
                                info.fieldClass = info.actualValue.getClass();
                            }
                        }
                       
                    } else {
                        info.actualValue = null;
                    }

                    // get a proper string value of this counter
                    if (info.actualValue == null) {
                        info.value = stringForNullValues;
                    } else {
                        info.value = info.actualValue.toString();
                    }
                   
                    // add our annotated description
                    info.description = metaField.description();

                    // if this is recursive, we need to check of the subvalues are actually wanted instead...
                    // if the actual value is null though, we know the sub-values are null...
                    if (recursive) {
                        // see if there are any MetaFields in the sub-object
View Full Code Here

Examples of com.draagon.meta.MetaField

          throw new IllegalArgumentException( "Malformed template field name parameter [" + param + "]" );

        if ( type.length() == 0 )
          throw new IllegalArgumentException( "Malformed template field type parameter [" + param + "]" );

        MetaField mf = null;
        if ( type.equals( "int" ))
          mf = new IntegerField();
        else if ( type.equals( "long" ))
          mf = new LongField();
        else if ( type.equals( "short" ))
          mf = new ShortField();
        else if ( type.equals( "byte" ))
          mf = new ByteField();
        else if ( type.equals( "boolean" ))
          mf = new BooleanField();
        else if ( type.equals( "float" ))
          mf = new FloatField();
        else if ( type.equals( "double" ))
          mf = new DoubleField();
        else if ( type.equals( "date" ))
          mf = new DateField();
        else
          mf = new StringField();

        mf.setName( field );

        mc.addMetaField( mf );
      }

      return mc;
View Full Code Here

Examples of org.jboss.errai.codegen.framework.meta.MetaField

              ctx.recordObjectHash(hash, newInstance);
            }

            for (MemberMapping mapping : definition.getWritableMemberMappings()) {
              if (mapping.getBindingMember() instanceof MetaField) {
                MetaField f = (MetaField) mapping.getBindingMember();
                setProperty(newInstance, f.asField(),
                        ctx.demarshall(mapping.getType().asClass(), oMap.get(mapping.getKey())));
              }
              else {
                Method m = ((MetaMethod) mapping.getBindingMember()).asMethod();
                m.invoke(newInstance, DataConversion.convert(
View Full Code Here

Examples of org.jboss.errai.codegen.framework.meta.MetaField

      if (!hasEncoded) {
        sb.append(",");
        hasEncoded = true;
      }

      MetaField metaField = MetaClassFactory.get(field);
      MetaClass targetType = GenUtil.getPrimitiveWrapper(metaField.getType());

      if (!context.hasProvidedOrGeneratedMarshaller(targetType.getFullyQualifiedName())) {
        throw new NoAvailableMarshallerException(targetType.getFullyQualifiedName());
      }
View Full Code Here

Examples of org.jboss.errai.codegen.framework.meta.MetaField

    super(decoratesWith);
  }

  @Override
  public Statement generateDecorator(InjectableInstance<ReplyTo> injectableInstance) {
    final MetaField field = injectableInstance.getField();
    final ReplyTo context = field.getAnnotation(ReplyTo.class);

     return Stmt.nestedCall(injectableInstance.getValueStatement())
             .invoke("setReplyTo", context.value());
  }
View Full Code Here

Examples of org.jboss.errai.codegen.framework.meta.MetaField

    super(decoratesWith);
  }

  @Override
  public Statement generateDecorator(InjectableInstance<ToSubject> injectableInstance) {
    final MetaField field = injectableInstance.getField();
    final ToSubject context = field.getAnnotation(ToSubject.class);

    return Stmt.nestedCall(injectableInstance.getValueStatement())
            .invoke("setToSubject", context.value());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.