Examples of FactField


Examples of org.drools.definition.type.FactField

        //each of the fields in the old definition that are also present in the
        //new definition must have the same type. If not -> Incompatible
        boolean allFieldsInOldDeclarationAreStillPresent = true;
        for (FactField oldFactField : oldFields) {
            FactField newFactField = newFieldsMap.get(oldFactField.getName());

            if (newFactField != null){
                //we can't use newFactField.getType() since it throws a NPE at this point.
                String newFactType = ((FieldDefinition)newFactField).getTypeName();

                if (!newFactType.equals( ((FieldDefinition) oldFactField).getTypeName()) ) {
                    throw new IncompatibleClassChangeError("Type Declaration "+newDeclaration.getTypeName()+"."+newFactField.getName()+" has a different"
                        + " type that its previous definition: "+newFactType
                        +" != "+oldFactField.getType().getName());
                }
            }else{
                allFieldsInOldDeclarationAreStillPresent = false;
View Full Code Here

Examples of org.drools.definition.type.FactField

    Set set = new HashSet();

    List<FactField> list = this.typeDef.getFields();
    for (FactField factField : list) {
      final FactField ff = factField;
      Map.Entry<String, Object> ent = new Map.Entry<String, Object>() {

        public String getKey() {
          return ff.getName();
        }

        public Object getValue() {
          return typeDef.get(bean, ff.getName());
        }

        public Object setValue(Object o) {
          typeDef.set(bean, ff.getName(), o);
          return o;
        }

      };
    }
View Full Code Here

Examples of org.drools.definition.type.FactField

        //Get the Fact Type for org.drools.EventA
        FactType factType = ((KnowledgePackageImp)kbuilder.getKnowledgePackages().iterator().next()).pkg.getFactType("org.drools.EventA");
        Assert.assertNotNull(factType);

        //'name' field must still be there
        FactField field = factType.getField("name");
        Assert.assertNotNull(field);

        //'duration' field must still be there
        field = factType.getField("duration");
        Assert.assertNotNull(field);
View Full Code Here

Examples of org.drools.definition.type.FactField

        assertEquals( String.class, ann.getPropertyType( "value" ) );

        assertEquals( 2, bean.getMetaData().size() );
        assertEquals( "event", bean.getMetaData().get( "role" ) );

        FactField field = bean.getField( "name" );
        assertNotNull( field );
        assertEquals( 1, field.getFieldAnnotations().size() );
        Annotation fnn = field.getFieldAnnotations().get( 0 );

        assertEquals( "org.drools.compiler.TypeDeclarationTest$FieldAnnotation", fnn.getName() );
        assertEquals( "fld", fnn.getPropertyValue( "prop" ) );
        assertEquals( String.class, fnn.getPropertyType( "prop" ) );

        assertEquals( 1, field.getMetaData().size() );
        assertTrue( field.getMetaData().containsKey( "key" ) );

    }
View Full Code Here

Examples of org.drools.definition.type.FactField

    Set set = new HashSet();

    List<FactField> list = this.typeDef.getFields();
    for (FactField factField : list) {
      final FactField ff = factField;
      Map.Entry<String, Object> ent = new Map.Entry<String, Object>() {

        public String getKey() {
          return ff.getName();
        }

        public Object getValue() {
          return typeDef.get(bean, ff.getName());
        }

        public Object setValue(Object o) {
          typeDef.set(bean, ff.getName(), o);
          return o;
        }

      };
    }
View Full Code Here

Examples of org.drools.definition.type.FactField

        //each of the fields in the old definition that are also present in the
        //new definition must have the same type. If not -> Incompatible
        boolean allFieldsInOldDeclarationAreStillPresent = true;
        for (FactField oldFactField : oldFields) {
            FactField newFactField = newFieldsMap.get(oldFactField.getName());

            if (newFactField != null){
                //we can't use newFactField.getType() since it throws a NPE at this point.
                String newFactType = ((FieldDefinition)newFactField).getTypeName();

                if (!newFactType.equals(oldFactField.getType().getCanonicalName())){
                    throw new IncompatibleClassChangeError("Type Declaration "+newDeclaration.getTypeName()+"."+newFactField.getName()+" has a different"
                        + " type that its previous definition: "+newFactType
                        +" != "+oldFactField.getType().getCanonicalName());
                }
            }else{
                allFieldsInOldDeclarationAreStillPresent = false;
View Full Code Here

Examples of org.drools.definition.type.FactField

        //each of the fields in the old definition that are also present in the
        //new definition must have the same type. If not -> Incompatible
        boolean allFieldsInOldDeclarationAreStillPresent = true;
        for (FactField oldFactField : oldFields) {
            FactField newFactField = newFieldsMap.get(oldFactField.getName());

            if (newFactField != null){
                //we can't use newFactField.getType() since it throws a NPE at this point.
                String newFactType = ((FieldDefinition)newFactField).getTypeName();

                if (!newFactType.equals(oldFactField.getType().getCanonicalName())){
                    throw new IncompatibleClassChangeError("Type Declaration "+newDeclaration.getTypeName()+"."+newFactField.getName()+" has a different"
                        + " type that its previous definition: "+newFactType
                        +" != "+oldFactField.getType().getCanonicalName());
                }
            }else{
                allFieldsInOldDeclarationAreStillPresent = false;
View Full Code Here

Examples of org.drools.definition.type.FactField

        //each of the fields in the old definition that are also present in the
        //new definition must have the same type. If not -> Incompatible
        boolean allFieldsInOldDeclarationAreStillPresent = true;
        for (FactField oldFactField : oldFields) {
            FactField newFactField = newFieldsMap.get(oldFactField.getName());

            if (newFactField != null){
                //we can't use newFactField.getType() since it throws a NPE at this point.
                String newFactType = ((FieldDefinition)newFactField).getTypeName();

                if (!newFactType.equals(oldFactField.getType().getName())){
                    throw new IncompatibleClassChangeError("Type Declaration "+newDeclaration.getTypeName()+"."+newFactField.getName()+" has a different"
                        + " type that its previous definition: "+newFactType
                        +" != "+oldFactField.getType().getName());
                }
            }else{
                allFieldsInOldDeclarationAreStillPresent = false;
View Full Code Here

Examples of org.drools.definition.type.FactField

        //each of the fields in the old definition that are also present in the
        //new definition must have the same type. If not -> Incompatible
        boolean allFieldsInOldDeclarationAreStillPresent = true;
        for (FactField oldFactField : oldFields) {
            FactField newFactField = newFieldsMap.get(oldFactField.getName());

            if (newFactField != null){
                //we can't use newFactField.getType() since it throws a NPE at this point.
                String newFactType = ((FieldDefinition)newFactField).getTypeName();

                if (!newFactType.equals(oldFactField.getType().getCanonicalName())){
                    throw new IncompatibleClassChangeError("Type Declaration "+newDeclaration.getTypeName()+"."+newFactField.getName()+" has a different"
                        + " type that its previous definition: "+newFactType
                        +" != "+oldFactField.getType().getCanonicalName());
                }
            }else{
                allFieldsInOldDeclarationAreStillPresent = false;
View Full Code Here

Examples of org.drools.definition.type.FactField

            if ( type.getName().equals( "org.drools.test.definitions.Person" ) ) {
                assertEquals( 2, type.getFields().size() );
            } else if (type.getName().equals( "org.drools.test.definitions.Foo" ) ) {
                assertEquals( "org.drools.test.definitions.Person", type.getSuperClass() );

                FactField fld = type.getField( "bar" );
                assertEquals( 3, fld.getIndex() );
                assertEquals( String.class, fld.getType() );
            } else {
                fail("Unexpected fact type " + type);
            }
        }
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.