Examples of ClassFieldAccessorStore


Examples of org.drools.core.base.ClassFieldAccessorStore

        JavaDialectRuntimeData data = new JavaDialectRuntimeData();
        data.write( JavaDialectRuntimeData.convertClassToResourcePath( classDef.getClassName() ),
                       d );
        ClassLoader classLoader = new PackageClassLoader(data, ClassLoaderUtil.getClassLoader( null, getClass(), false ));
       
        ClassFieldAccessorStore store = new ClassFieldAccessorStore();
        store.setClassFieldAccessorCache( new ClassFieldAccessorCache( classLoader ) );
        store.setEagerWire( true );
       
        Class clazz = classLoader.loadClass( classDef.getClassName() );
        classDef.setDefinedClass( clazz );
       
        return clazz;
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore

                    
        data.write( JavaDialectRuntimeData.convertClassToResourcePath( classDef.getClassName() ),
                       d );
        classLoader = new PackageClassLoader(data, ClassLoaderUtil.getClassLoader( null, getClass(), false ));
       
        this.store = new ClassFieldAccessorStore();
        store.setClassFieldAccessorCache( new ClassFieldAccessorCache( classLoader ) );
        store.setEagerWire( true );
       
        Class clazz = classLoader.loadClass( classDef.getClassName() );
        classDef.setDefinedClass( clazz );
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore

        this.ruleFlows = Collections.emptyMap();
        this.globals = Collections.emptyMap();
        this.factTemplates = Collections.emptyMap();
        this.functions = Collections.emptyMap();
        this.dialectRuntimeRegistry = new DialectRuntimeRegistry();
        this.classFieldAccessorStore = new ClassFieldAccessorStore();
        this.entryPointsIds = Collections.emptySet();
        this.windowDeclarations = Collections.emptyMap();
    }
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore

        this.ruleFlows = Collections.emptyMap();
        this.globals = Collections.emptyMap();
        this.factTemplates = Collections.emptyMap();
        this.functions = Collections.emptyMap();
        this.dialectRuntimeRegistry = new DialectRuntimeRegistry();
        this.classFieldAccessorStore = new ClassFieldAccessorStore();
        this.entryPointsIds = Collections.emptySet();
        this.windowDeclarations = Collections.emptyMap();
        this.resourceTypePackages = Collections.emptyMap();
    }
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore


    public ClassDefinition buildClassDefinition(Class<?> klazz, Class<?> wrapperClass) throws IOException {
        ClassFieldInspector inspector = new ClassFieldInspector( klazz );

        ClassFieldAccessorStore store = getClassFieldAccessorStore();

        ClassDefinition def;
        if ( ! klazz.isInterface() ) {
            String className = wrapperClass.getName();
            String superClass = wrapperClass != klazz ? klazz.getName() : klazz.getSuperclass().getName();
            String[] interfaces = new String[ klazz.getInterfaces().length + 1 ];
            for ( int j = 0; j <  klazz.getInterfaces().length; j++ ) {
                interfaces[ j ] = klazz.getInterfaces()[ j ].getName();
            }
            interfaces[ interfaces.length - 1 ] = CoreWrapper.class.getName();
            def = new ClassDefinition( className, superClass, interfaces );
            def.setDefinedClass( wrapperClass );

            Traitable tbl = wrapperClass.getAnnotation( Traitable.class );
            def.setTraitable( true, tbl != null && tbl.logical() );
            Map<String, Field> fields = inspector.getFieldTypesField();
            for ( Field f : fields.values() ) {
                if ( f != null ) {
                    FieldDefinition fld = new FieldDefinition();
                    fld.setName( f.getName() );
                    fld.setTypeName( f.getType().getName() );
                    fld.setInherited( true );
                    ClassFieldAccessor accessor = store.getAccessor( def.getDefinedClass().getName(),
                                                                     fld.getName() );
                    fld.setReadWriteAccessor( accessor );

                    def.addField( fld );
                }
            }
        } else {
            String className = klazz.getName();
            String superClass = Object.class.getName();
            String[] interfaces = new String[ klazz.getInterfaces().length ];
            for ( int j = 0; j <  klazz.getInterfaces().length; j++ ) {
                interfaces[ j ] = klazz.getInterfaces()[ j ].getName();
            }
            def = new ClassDefinition( className, superClass, interfaces );
            def.setDefinedClass( klazz );

            Map<String, Method> properties = inspector.getGetterMethods();
            for ( String key : properties.keySet() ) {
                Method m = properties.get( key );
                if ( m != null && m.getDeclaringClass() != TraitType.class && m.getDeclaringClass() != Thing.class && inspector.getSetterMethods().containsKey( key ) ) {
                    FieldDefinition fld = new FieldDefinition();
                    fld.setName( getterToFieldName( m.getName() ) );
                    fld.setTypeName( m.getReturnType().getName() );
                    fld.setInherited( true );
                    ClassFieldAccessor accessor = store.getAccessor( def.getDefinedClass().getName(),
                                                                     fld.getName() );
                    fld.setReadWriteAccessor( accessor );

                    def.addField( fld );
                }
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore

            ClassNotFoundException,
            NoSuchMethodException,
            InvocationTargetException,
            NoSuchFieldException {
        ClassDefinition cd = type.getTypeClassDef();
        ClassFieldAccessorStore store = pkgRegistry.getPackage().getClassFieldAccessorStore();
        for ( FieldDefinition attrDef : cd.getFieldsDefinitions() ) {
            ClassFieldAccessor accessor = store.getAccessor( cd.getDefinedClass().getName(),
                                                             attrDef.getName() );
            attrDef.setReadWriteAccessor( accessor );
        }
    }
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore

    public StandaloneTraitFactory( ProjectClassLoader classLoader, KieComponentFactory factory, VirtualPropertyMode mode ) {
        this.classLoader = classLoader;
        this.kieComponentFactory = factory;
        this.registry = kieComponentFactory.getTraitRegistry();
        this.store = new ClassFieldAccessorStore();
            this.store.setClassFieldAccessorCache( new ClassFieldAccessorCache( this.classLoader ) );
        this.encoder = new HierarchyEncoderImpl();

        encoder.encode( Thing.class, Collections.emptyList() );
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore

        if ( traitPackage == null ) {
            traitPackage = new KnowledgePackageImpl( pack );
            traitPackage.setClassFieldAccessorCache( kBase.getClassFieldAccessorCache() );
            kBase.getPackagesMap().put( pack, traitPackage );
        }
        ClassFieldAccessorStore store = traitPackage.getClassFieldAccessorStore();
        return store;
    }
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore


    public ClassDefinition buildClassDefinition(Class<?> klazz, Class<?> wrapperClass) throws IOException {
        ClassFieldInspector inspector = new ClassFieldInspector( klazz );

        ClassFieldAccessorStore store = getClassFieldAccessorStore();

        ClassDefinition def;
        if ( ! klazz.isInterface() ) {
            String className = wrapperClass.getName();
            String superClass = wrapperClass != klazz ? klazz.getName() : klazz.getSuperclass().getName();
            String[] interfaces = new String[ klazz.getInterfaces().length + 1 ];
            for ( int j = 0; j <  klazz.getInterfaces().length; j++ ) {
                interfaces[ j ] = klazz.getInterfaces()[ j ].getName();
            }
            interfaces[ interfaces.length - 1 ] = CoreWrapper.class.getName();
            def = new ClassDefinition( className, superClass, interfaces );
            def.setDefinedClass( wrapperClass );

            Traitable tbl = wrapperClass.getAnnotation( Traitable.class );
            def.setTraitable( true, tbl != null && tbl.logical() );
            Map<String, Field> fields = inspector.getFieldTypesField();
            for ( Field f : fields.values() ) {
                if ( f != null ) {
                    FieldDefinition fld = new FieldDefinition();
                    fld.setName( f.getName() );
                    fld.setTypeName( f.getType().getName() );
                    fld.setInherited( true );
                    ClassFieldAccessor accessor = store.getAccessor( def.getDefinedClass().getName(),
                                                                     fld.getName() );
                    fld.setReadWriteAccessor( accessor );

                    def.addField( fld );
                }
            }
        } else {
            String className = klazz.getName();
            String superClass = Object.class.getName();
            String[] interfaces = new String[ klazz.getInterfaces().length ];
            for ( int j = 0; j <  klazz.getInterfaces().length; j++ ) {
                interfaces[ j ] = klazz.getInterfaces()[ j ].getName();
            }
            def = new ClassDefinition( className, superClass, interfaces );
            def.setDefinedClass( klazz );

            Map<String, Method> properties = inspector.getGetterMethods();
            for ( Method m : properties.values() ) {
                if ( m != null && m.getDeclaringClass() != TraitType.class && m.getDeclaringClass() != Thing.class ) {
                    FieldDefinition fld = new FieldDefinition();
                    fld.setName( getterToFieldName( m.getName() ) );
                    fld.setTypeName( m.getReturnType().getName() );
                    fld.setInherited( true );
                    ClassFieldAccessor accessor = store.getAccessor( def.getDefinedClass().getName(),
                                                                     fld.getName() );
                    fld.setReadWriteAccessor( accessor );

                    def.addField( fld );
                }
View Full Code Here

Examples of org.drools.core.base.ClassFieldAccessorStore

        this.ruleFlows = Collections.emptyMap();
        this.globals = Collections.emptyMap();
        this.factTemplates = Collections.emptyMap();
        this.functions = Collections.emptyMap();
        this.dialectRuntimeRegistry = new DialectRuntimeRegistry();
        this.classFieldAccessorStore = new ClassFieldAccessorStore();
        this.entryPointsIds = Collections.emptySet();
        this.windowDeclarations = Collections.emptyMap();
    }
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.