Examples of EnhancementException


Examples of org.hibernate.bytecode.enhance.EnhancementException

          generateFieldWriter( managedCtClass, persistentField, typeDescriptor ),
          typeDescriptor
      );
    }
    catch (Exception e) {
      throw new EnhancementException(
          String.format(
              "Unable to enhance persistent attribute [%s:%s]",
              managedCtClass.getName(),
              persistentField.getName()
          ),
View Full Code Here

Examples of org.hibernate.bytecode.enhance.EnhancementException

    try {
      theField = new CtField( fieldType, fieldName, targetClass );
      targetClass.addField( theField );
    }
    catch (CannotCompileException e) {
      throw new EnhancementException(
          String.format(
              "Could not enhance class [%s] to add field [%s]",
              targetClass.getName(),
              fieldName
          ),
View Full Code Here

Examples of org.hibernate.bytecode.enhance.EnhancementException

  private void addGetter(CtClass targetClass, CtField theField, String getterName) {
    try {
      targetClass.addMethod( CtNewMethod.getter( getterName, theField ) );
    }
    catch (CannotCompileException e) {
      throw new EnhancementException(
          String.format(
              "Could not enhance entity class [%s] to add getter method [%s]",
              targetClass.getName(),
              getterName
          ),
View Full Code Here

Examples of org.hibernate.bytecode.enhance.EnhancementException

  private void addSetter(CtClass targetClass, CtField theField, String setterName) {
    try {
      targetClass.addMethod( CtNewMethod.setter( setterName, theField ) );
    }
    catch (CannotCompileException e) {
      throw new EnhancementException(
          String.format(
              "Could not enhance entity class [%s] to add setter method [%s]",
              targetClass.getName(),
              setterName
          ),
View Full Code Here

Examples of org.hibernate.bytecode.enhance.EnhancementException

        final CtMethod reader = CtNewMethod.getter( readerName, persistentField );
        managedCtClass.addMethod( reader );
        return reader;
      }
      catch (CannotCompileException e) {
        throw new EnhancementException(
            String.format(
                "Could not enhance entity class [%s] to add field reader method [%s]",
                managedCtClass.getName(),
                readerName
            ),
            e
        );
      }
    }

    // temporary solution...
    final String methodBody = typeDescriptor.buildReadInterceptionBodyFragment( fieldName )
        + " return this." + fieldName + ";";

    try {
      final CtMethod reader = CtNewMethod.make(
          Modifier.PRIVATE,
          persistentField.getType(),
          readerName,
          null,
          null,
          "{" + methodBody + "}",
          managedCtClass
      );
      managedCtClass.addMethod( reader );
      return reader;
    }
    catch (Exception e) {
      throw new EnhancementException(
          String.format(
              "Could not enhance entity class [%s] to add field reader method [%s]",
              managedCtClass.getName(),
              readerName
          ),
View Full Code Here

Examples of org.hibernate.bytecode.enhance.EnhancementException

      managedCtClass.addMethod( writer );
      return writer;
    }
    catch (Exception e) {
      throw new EnhancementException(
          String.format(
              "Could not enhance entity class [%s] to add field writer method [%s]",
              managedCtClass.getName(),
              writerName
          ),
View Full Code Here

Examples of org.hibernate.bytecode.enhance.EnhancementException

        final StackMapTable smt = MapMaker.make( classPool, methodInfo );
        methodInfo.getCodeAttribute().setAttribute( smt );
      }
      catch (BadBytecode e) {
        throw new EnhancementException(
            "Unable to perform field access transformation in method : " + methodName,
            e
        );
      }
    }
View Full Code Here

Examples of org.woped.metrics.formulaEnhancement.EnhancementException

    try {
      double value = parser.evaluator();
      // The new Formula worked well. The user should be informed
      // that he should chance the formula. Therefore we throw a EnhancementException.
      // We have to find the ID of the formula
      throw new EnhancementException(formula, value);
    } catch (RecognitionException e2) {
      // If the error appears again --> Throw an Parsing-Error
      //throw new ParsingException(e, formula);
      throw new AntlrException(e);
    }   
View Full Code Here

Examples of org.woped.metrics.formulaEnhancement.EnhancementException

    try {
      double value = parser.evaluator();
      // The new Formula worked well. The user should be informed
      // that he should chance the formula. Therefore we throw a EnhancementException.
      // We have to find the ID of the formula
      throw new EnhancementException(formula, value);
    } catch (FormulaVariableNotFoundException fvnfe) {
      // If the error appears again --> Throw the error again
      if (formula.contains(fvnfe.getVariable())) {
        int pos = formula.indexOf(fvnfe.getVariable())
            + fvnfe.getVariable().length();
View Full Code Here

Examples of org.woped.metrics.formulaEnhancement.EnhancementException

    enhancedFormula = EOFEnhancements(ncfe,enhancedFormula, mc,
        stack, doNotDisplay, syntaxCheck);
   
   
    if(originalFormula.equals(enhancedFormula)==false){
      ncfe.addError(new EnhancementException(enhancedFormula,0.0));
      throw ncfe;
    }else{
      throw ncfe;
    }
 
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.