Codota Logo
ClassFieldAccessorStore.getReader
Code IndexAdd Codota to your IDE (free)

How to use
getReader
method
in
org.drools.core.base.ClassFieldAccessorStore

Best Java code snippets using org.drools.core.base.ClassFieldAccessorStore.getReader (Showing top 20 results out of 315)

Refine searchRefine arrow

  • Test.<init>
  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: org.drools/drools-core

@Test
public void testLong() throws Exception {
  final ClassFieldReader ext = store.getReader( TestBean.class,
                         "longField" );
  final TestBean bean = new TestBean();
  assertEquals( 424242,
         ((Number) ext.getValue( null,
                     bean )).longValue() );
}
origin: org.drools/drools-core

@Test
public void testMultipleInterfaces() throws Exception {
  final ConcreteChild obj = new ConcreteChild();
  final ClassFieldReader ext = store.getReader( InterfaceChild.class,
                         "foo" );
  assertEquals( 42,
         ((Number) ext.getValue( null,
                     obj )).intValue() );
}
origin: org.drools/drools-core

@Test
public void testAbstract() throws Exception {
  final ClassFieldReader ext = store.getReader( TestAbstract.class,
                         "something" );
  final TestAbstract obj = new TestAbstractImpl();
  assertEquals( "foo",
         (String) ext.getValue( null,
                     obj ) );
}
origin: org.drools/drools-core

@Test
public void testInherited() throws Exception {
  final InternalReadAccessor ex = store.getReader( BeanInherit.class,
                           "text" );
  assertEquals( "hola",
         ex.getValue( null,
                new BeanInherit() ) );
}
origin: org.drools/drools-core

@Test
public void testInterface() throws Exception {
  final TestInterface obj = new TestInterfaceImpl();
  final ClassFieldReader ext = store.getReader( TestInterface.class,
                         "something" );
  assertEquals( "foo",
         (String) ext.getValue( null,
                     obj ) );
}
origin: org.drools/drools-core

@Test
public void testSelfReference() throws Exception {
  final InternalReadAccessor ex = store.getReader( BeanInherit.class,
                           "this" );
  final TestBean bean = new TestBean();
  assertEquals( bean,
         ex.getValue( null,
                bean ) );
}
origin: org.drools/drools-core

@Test
public void testInherited() throws Exception {
  final ClassFieldReader ext = store.getReader( BeanInherit.class,
                         "text" );
  final BeanInherit obj = new BeanInherit();
  assertEquals( "hola",
         (String) ext.getValue( null,
                     obj ) );
}
origin: org.drools/drools-core

@Test
public void testInterface() throws Exception {
  final InternalReadAccessor ex = store.getReader( TestInterface.class,
                           "something" );
  assertEquals( 1,
         ex.getIndex() );
  assertEquals( "foo",
         ex.getValue( null,
                new TestInterfaceImpl() ) );
}
origin: org.drools/drools-core

@Test
public void testNonExistentField() throws Exception {
  final Object[] objArray = new Object[1];
  final TestBean obj = new TestBean();
  obj.setBlah( false );
  obj.setSomething( "no" );
  obj.setObjArray( objArray );
  ClassFieldReader ext = store.getReader( TestBean.class,
                      "xyz" );
  assertNull(ext);
}
origin: org.drools/drools-core

@Test
public void testAbstract() throws Exception {
  final InternalReadAccessor ex = store.getReader( TestAbstract.class,
                           "something" );
  assertEquals( 2,
         ex.getIndex() );
  assertEquals( "foo",
         ex.getValue( null,
                new TestAbstractImpl() ) );
}
origin: org.drools/drools-core

@Test
public void testBasic() throws Exception {
  final Object[] objArray = new Object[1];
  final TestBean obj = new TestBean();
  obj.setBlah( false );
  obj.setSomething( "no" );
  obj.setObjArray( objArray );
  final ClassFieldReader ext = store.getReader( TestBean.class,
                         "blah" );
  assertEquals( false,
         ((Boolean) ext.getValue( null,
                      obj )).booleanValue() );
  final ClassFieldReader ext2 = store.getReader( TestBean.class,
                          "fooBar" );
  assertEquals( "fooBar",
         ext2.getValue( null,
                 obj ) );
  final ClassFieldReader ext3 = store.getReader( TestBean.class,
                          "objArray" );
  assertEquals( objArray,
         ext3.getValue( null,
                 obj ) );
}
origin: org.drools/drools-core

  @Test
  public void testIsNullValue() {
    assertFalse( this.reader.isNullValue( null,
                           this.bean ) );

    ClassFieldAccessorStore store = new ClassFieldAccessorStore();
    store.setClassFieldAccessorCache( new ClassFieldAccessorCache( Thread.currentThread().getContextClassLoader() ) );
    store.setEagerWire( true );

    InternalReadAccessor nullExtractor = store.getReader( TestBean.class,
                               "nullAttr" );
    assertTrue( nullExtractor.isNullValue( null,
                           this.bean ) );

  }
}
origin: org.drools/drools-compiler

@Test
public void testInvokerGenerationSinglePattern() {
  final String className = "accumulate0";
                                     store.getReader( Person.class,
                                              "name" ),
                                     null ), new Declaration( "age",
                                                  store.getReader( Person.class,
                                                          "age" ),
                                                  null )};
                                  new PatternExtractor( new ClassObjectType( Cheese.class ) ),
                                  null ), new Declaration( "price",
                                              store.getReader( Cheese.class,
                                                       "price" ),
                                              null )};
origin: org.drools/drools-compiler

@Test
public void testMethodGeneration() {
  final String className = "accumulate0";
                                  new PatternExtractor( new ClassObjectType( Cheese.class ) ),
                                  null ), new Declaration( "price",
                                              store.getReader( Cheese.class,
                                                       "price" ),
                                              null )};
origin: org.drools/drools-compiler

@Test
public void testInvokerGenerationMultiPattern() {
  final String className = "accumulate0";
                                     store.getReader( Person.class,
                                              "name" ),
                                     null ), new Declaration( "age",
                                                  store.getReader( Person.class,
                                                          "age" ),
                                                  null )};
origin: org.drools/drools-core

@Test
public void testGetFieldValue() {
  final InternalReadAccessor extractor = store.getReader( Cheese.class,
                              "type" );
  final Pattern pattern = new Pattern( 5,
                     new ClassObjectType( Cheese.class ) );
  // Bind the extractor to a decleration 
  // Declarations know the pattern they derive their value from 
  final Declaration declaration = new Declaration( "typeOfCheese",
                           extractor,
                           pattern );
  // Create some facts
  final Cheese cheddar = new Cheese( "cheddar",
                    5 );
  // Check we can extract Declarations correctly
  assertEquals( "cheddar",
         declaration.getValue( null,
                    cheddar ) );
}
origin: org.drools/drools-core

@Test
public void testEmptyIterator() {
  final InternalReadAccessor extractor = store.getReader( Cheese.class,
                              "type" );
  final Pattern pattern = new Pattern( 0,
                     new ClassObjectType( Cheese.class ) );
  final Declaration declaration = new Declaration( "typeOfCheese",
                           extractor,
                           pattern );
  final FieldIndex fieldIndex = new FieldIndex( extractor,
                         declaration,
                         MvelConstraint.INDEX_EVALUATOR );
  final TupleIndexHashTable map = new TupleIndexHashTable( new FieldIndex[]{fieldIndex}, false );
  final Cheese stilton = new Cheese( "stilton",
                    55 );
  final InternalFactHandle stiltonHandle = new DefaultFactHandle( 2,
                                  stilton );
  assertNull( map.getFirst( new LeftTupleImpl( stiltonHandle, null, true ) ) );
}
origin: org.drools/drools-core

@Test
public void testDeclaration() {
  final InternalReadAccessor extractor = store.getReader( Cheese.class,
                              "type" );
  final Pattern pattern = new Pattern( 5,
                     new ClassObjectType( Cheese.class ) );
  // Bind the extractor to a decleration
  // Declarations know the pattern they derive their value from
  final Declaration declaration = new Declaration( "typeOfCheese",
                           extractor,
                           pattern );
  assertEquals( "typeOfCheese",
         declaration.getIdentifier() );
  assertSame( String.class,
        declaration.getDeclarationClass() );
  assertSame( extractor,
        declaration.getExtractor() );
  assertEquals( 5,
         declaration.getPattern().getOffset() );
}
origin: org.drools/drools-core

@Test
public void testPrimitiveLiteralConstraint() {
  InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
  StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newKieSession();
  final ClassFieldReader extractor = store.getReader(Cheese.class,
      "price");
origin: org.drools/drools-core

@Test @Ignore
public void testAgendaEventListener() throws Exception {
  InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
  final ClassFieldReader extractor = pkg.getClassFieldAccessorStore().getReader(Cheese.class,
      "type");
org.drools.core.baseClassFieldAccessorStoregetReader

Popular methods of ClassFieldAccessorStore

  • setClassFieldAccessorCache
  • setEagerWire
  • <init>
  • getAccessor
  • getMVELReader

Popular in Java

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • getApplicationContext (Context)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • String (java.lang)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now