Package org.objectweb.speedo.metadata

Examples of org.objectweb.speedo.metadata.SpeedoField


                + "  / embeddedValue = " + m.embeddedValue
        );
        return m;
    }
    private Object treatMapKey(Node node, Object mo) throws SpeedoException {
        SpeedoField f = (SpeedoField) mo;
        SpeedoColumn col = null;
        Node n = node.getAttributes().getNamedItem("column");
        if (n != null) {
            col = new SpeedoColumn();
            col.name = n.getNodeValue();
            //in the same table than map value
            if (f.columns != null && f.columns.length > 0) {
                col.table = f.columns[0].table;
            }
        }
        if (!(f.jdoTuple instanceof SpeedoMap)) {
            throw new SpeedoException(
                    "key element must be used for map field only: "
                    + f.getSourceDesc());
        }
        SpeedoMap m = (SpeedoMap) f.jdoTuple;
        if (col != null) {
            m.keyColumns = col;
        }
View Full Code Here


            m.keyColumns = col;
        }
        return m;
    }
    private Object treatMapValue(Node node, Object mo) throws SpeedoException {
        SpeedoField f = (SpeedoField) mo;
        if (!(f.jdoTuple instanceof SpeedoMap)) {
            throw new SpeedoException(
                    "Value element must be used for map field only: "
                    + f.getSourceDesc());
        }
        Node n = node.getAttributes().getNamedItem("column");
        if (n != null) {
          SpeedoColumn col = null;
          if (f.columns == null || f.columns.length == 0) {
              //create the new meta object for the column description
              col = new SpeedoColumn();
              // column definition of the value is the hold by SpeedoField meta
              // object.
              f.addColumn(col);
              //Table will be defined later
          } else {
              col = f.columns[0];
          }
            col.name = n.getNodeValue();
View Full Code Here

            col.name = n.getNodeValue();
        }
        return f.jdoTuple;
    }
    private Object treatCollection(Node node, Object mo) throws SpeedoException {
        SpeedoField f = (SpeedoField) mo;
        SpeedoCollection co = (SpeedoCollection) f.jdoTuple;
        if (co == null) {
            co = new SpeedoCollection();
        }
        f.jdoTuple = co;
View Full Code Here

            );
        }
        return co;
    }
    private Object treatXXXElement(Node node, Object mo) throws SpeedoException {
        SpeedoField f = (SpeedoField) mo;
        Node n = node.getAttributes().getNamedItem("column");
        SpeedoColumn col = null;
        if (n != null) {
            col = new SpeedoColumn();
            col.name = n.getNodeValue();
View Full Code Here

            SpeedoJoinColumn sjc = new SpeedoJoinColumn();
            sjc.column = c;
            j.columns.add(sjc);
            logger.log(BasicLevel.DEBUG, "add column " + c.name + " to a join");
        } else if (mo instanceof SpeedoField) { //class.field.column
            SpeedoField f = (SpeedoField) mo;
            f.addColumn(c);
            logger.log(BasicLevel.DEBUG, "add column " + c.name + " to the field " + f.name);
        } else if (mo instanceof SpeedoMap) {
            SpeedoMap m = (SpeedoMap) mo;
            String parentNodeName = node.getParentNode().getNodeName();
          if ("key".equals(parentNodeName)) {
View Full Code Here

               final String desc,
               final Object value,
               final Attribute attrs) {
    boolean keepfield = (access & Constants.ACC_STATIC) != 0;
        if (!keepfield) {
            SpeedoField sf = (SpeedoField) clazz.fields.get(name);
            keepfield = sf == null;
            if (!keepfield) {
                keepfield = sf.persistenceStatus == SpeedoField.NONE;
            }
        }
View Full Code Here

     * @return the corresponding SpeedoField if it exists, null either
     */
    SpeedoField fetchJDOField(final String name, final String className) {
        SpeedoClass c = smi.getSpeedoClass(className);
        if (c != null) {
          SpeedoField speedoField = null;
          //try to find the field in the current class
          // and in its parents (if any)
          while (speedoField == null && c != null) {
            speedoField = (SpeedoField) c.fields.get(name);
            c = c.getSuper();
View Full Code Here

        public void visitFieldInsn(final int opcode,
                                   final String owner,
                                   final String name,
                                   final String desc) {
      SpeedoField field = cam.fetchJDOField(name, owner.replace('/', '.'));
      char c = desc.charAt(0);
          int fieldSize = (c == 'D' || c == 'J' ? 2 : 1);
          //Calculate if the field type is reference to a persistence object
          // (use an accessor) or primitive field (direct access)
          // primitive fields or java.lang.* or java.math.*
 
View Full Code Here

        //t.f1 = this.f1
        boolean hasLongOrDouble = false;
        SpeedoClass current = speedoClass;
        while(current != null) {
          for(Iterator it = current.fields.values().iterator(); it.hasNext();) {
              SpeedoField sp = (SpeedoField) it.next();
              if (sp.primaryKey) {
                  hasLongOrDouble |= sp.type.charAt(0) == 'D'
                        || sp.type.charAt(0) == 'J';
                  logger.log(BasicLevel.DEBUG, "add code: this." + sp.name + " = t." + sp.name);
                  _cv.visitVarInsn(Constants.ALOAD, 1); //Can be a long|double value
View Full Code Here

        public void visitFieldInsn(final int opcode,
                                   final String owner,
                                   final String name,
                                   final String desc) {
            if (opcode == Constants.PUTFIELD) {
                SpeedoField field = fetchField(name, owner.replace('/', '.'));
                if (field != null) {
                    String setterName = NamingRules.setterName(field);
                    String setterDesc = "(" + desc + ")V";
                    cv.visitMethodInsn(
                            Constants.INVOKEVIRTUAL,
                            owner,
                            setterName,
                            setterDesc);
                    return;
                }
            } else if (opcode == Constants.GETFIELD) {
                SpeedoField field = fetchField(name, owner.replace('/', '.'));
                if (field != null) {
                    String getterName = NamingRules.getterName(
                            field.moClass,
                            field.name);
                    String getterDesc = "()" + desc;
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.metadata.SpeedoField

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.