Package org.bson.types

Examples of org.bson.types.Symbol


      return parseValue( value );
      }
    }
  else if( currentType == org.bson.types.Symbol.class )
    {
    return new Symbol( value );
    }
  else
    {
    return parseValue( value );
    }
View Full Code Here


        b.append( "long3254525", 3254525L );
        b.append( "float324_582", 324.582f );
        b.append( "double245_6289", 245.6289 );
        b.append( "oid", test_oid );
        // Symbol wonky
        b.append( "symbol", new Symbol( "foobar" ) );
        // Code wonky
        b.append( "code", new Code( "var x = 12345;"  ) );
        // TODO - Shell doesn't work with Code W/ Scope, return to this test later
        /*
        b.append( "code_scoped", new CodeWScope( "return x * 500;", test_doc ) );*/
 
View Full Code Here

            case BSON.OID:
                return new ObjectId( _input.getIntBE( record.valueOffset ),
                                     _input.getIntBE( record.valueOffset + 4 ),
                                     _input.getIntBE( record.valueOffset + 8 ) );
            case BSON.SYMBOL:
                return new Symbol( _input.getUTF8String( record.valueOffset ) );
            case BSON.CODE:
                return new Code( _input.getUTF8String( record.valueOffset ) );
            case BSON.STRING:
                return _input.getUTF8String( record.valueOffset );
            case BSON.CODE_W_SCOPE:
View Full Code Here

        assertEquals(object.getScope().get("t"), object2.getScope().get("t"));
    }

    @Test
    public void testSerializeSymbol() throws Exception {
        Symbol object = new Symbol("symbol");

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);

        objectOutputStream.writeObject(object);

        ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
        ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
        Symbol object2 = (Symbol) objectInputStream.readObject();

        assertEquals(object.getSymbol(), object2.getSymbol());
    }
View Full Code Here

 
  @Test
  public void parseComplex() throws Exception {
    BSONObject o = new BasicBSONObject();
    o.put("Timestamp", new BSONTimestamp(0xAABB, 0xCCDD));
    o.put("Symbol", new Symbol("Test"));
    o.put("ObjectId", new org.bson.types.ObjectId(Integer.MAX_VALUE, -2, Integer.MIN_VALUE));
    Pattern p = Pattern.compile(".*", Pattern.CASE_INSENSITIVE |
        Pattern.DOTALL | Pattern.MULTILINE | Pattern.UNICODE_CASE);
    o.put("Regex", p);
   
View Full Code Here

TOP

Related Classes of org.bson.types.Symbol

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.