Package com.sun.jdo.spi.persistence.support.sqlstore.query.util.type

Examples of com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.FieldInfo


     * Uses jdoGetField for object of a persistence capable class and reflection otherwise.
     */
    protected static Object getFieldValue (ClassType classType, Object object, String fieldName)
    {
        Object value = null;
        FieldInfo fieldInfo = classType.getFieldInfo(fieldName);
        if (classType.isPersistenceCapable())
        {
            PersistenceCapable pc = (PersistenceCapable)object;
            int index = fieldInfo.getFieldNumber();
            StateManager stateManager = pc.jdoGetStateManager();
           
            if (stateManager != null)
            {
                // call stateManager.prepareGetField to allow the stateManager
                // to mediate the field access
                stateManager.prepareGetField(index);
            }
            value = pc.jdoGetField(index);
        }
        else
        {
            // non persistence capable class => use reflection
            try
            {
                value = fieldInfo.getField().get(object);
            }
            catch (IllegalAccessException e)
            {
                throw new JDOFatalUserException(
                    I18NHelper.getMessage(messages, "jqlc.codegeneration.fieldaccess.illegal"//NOI18N
View Full Code Here


    if ( inputState.guessing==0 ) {
     
      // Calculate the value of the static field at compile time
      // and treat it as constant value.
      ClassType classType = (ClassType)t.getJQLType();
      FieldInfo fieldInfo = classType.getFieldInfo(i.getText());
      try
      {
      value = fieldInfo.getField().get(null);
      s_AST.setType(VALUE);
      s_AST.setValue(value);
      s_AST.setFirstChild(null);
      }
      catch (IllegalAccessException e)
View Full Code Here

            // left expression is of a class type
            ClassType classType = (ClassType)exprType;
            if (args == null)
            {
                // no paranethesis specified => field access
                FieldInfo fieldInfo = classType.getFieldInfo(name);
                if (fieldInfo == null)
                {
                    errorMsg.error(ident.getLine(), ident.getColumn(),
                                   I18NHelper.getMessage(messages, "jqlc.semantic.generic.unknownfield"//NOI18N
                                                         ident.getText(), exprType.getName()));
View Full Code Here

        {  
            ident.setType(PARAMETER);
        }
        else if (def instanceof Field)
        {
            FieldInfo fieldInfo = ((Field)def).getFieldInfo();
            JQLAST fieldAccessAST = ident;
            JQLAST identAST = new JQLAST(ident);
            if (fieldInfo.isStatic())
            {
                JQLAST typeNameAST = new JQLAST(TYPENAME, candidateClass.getName(), candidateClass);
                ident = analyseStaticFieldAccess(fieldAccessAST, typeNameAST,
                                                 identAST, candidateClass, fieldInfo);
            }
View Full Code Here

                I18NHelper.getMessage(messages,
                    "jqlc.semantic.analysecollectioncall.nonvariable")); //NOI18N
        }
        else
        {
            FieldInfo collectionFieldInfo = getCollectionField(collection);
            if (collectionFieldInfo == null)
            {
                errorMsg.unsupported(collection.getLine(), collection.getColumn()
                    I18NHelper.getMessage(messages,
                        "jqlc.semantic.analysecollectioncall.unsupportedcollectionexpr", //NOI18N
                    collection.getText()));
            }
            else if (!collectionFieldInfo.isRelationship())
            {
                // check compatibilty of collection element type and type of variable
                errorMsg.error(collection.getLine(), collection.getColumn(),
                    I18NHelper.getMessage(messages,
                        "jqlc.semantic.analysecollectioncall.relationshipexpected", //NOI18N
                        collectionFieldInfo.getName()));
            }
            Type variableType = firstArg.getJQLType();
            Type elementType = collectionFieldInfo.getAssociatedClass();
            if (!elementType.isCompatibleWith(variableType))
            {
                errorMsg.error(collection.getLine(), collection.getColumn(),
                    I18NHelper.getMessage(messages,
                        "jqlc.semantic.analysecollectioncall.typemismatch", //NOI18N
View Full Code Here

   
    // init symbol table with field names of the candidate class
    FieldInfo[] fieldInfos = candidateClass.getFieldInfos();
    for (int i = 0; i < fieldInfos.length; i++)
    {
    FieldInfo fieldInfo = fieldInfos[i];
    symtab.declare(fieldInfo.getName(), new Field(fieldInfo));
    }
   
    candidateClass_AST = (JQLAST)currentAST.root;
    returnAST = candidateClass_AST;
    _retTree = _t;
View Full Code Here

TOP

Related Classes of com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.FieldInfo

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.