congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Foo
Code IndexAdd Tabnine to your IDE (free)

How to use
Foo
in
io.protostuff

Best Java code snippets using io.protostuff.Foo (Showing top 20 results out of 315)

Refine searchRefine arrow

  • Bar
origin: stackoverflow.com

 function Foo() {}
var foo = new Foo();

typeof Foo;             // == "function"
typeof foo;             // == "object"

foo instanceof Foo;     // == true
foo.constructor.name;   // == "Foo"
Foo.name                // == "Foo"    

Foo.prototype.isPrototypeOf(foo);   // == true

Foo.prototype.bar = function (x) {return x+x;};
foo.bar(21);            // == 42
origin: stackoverflow.com

 public class FooTest {
 @Rule
 public final ExpectedException exception = ExpectedException.none();

 @Test
 public void doStuffThrowsIndexOutOfBoundsException() {
  Foo foo = new Foo();

  exception.expect(IndexOutOfBoundsException.class);
  foo.doStuff();
 }
}
origin: stackoverflow.com

 Foo copyFoo (Foo foo){
 Foo f = new Foo();
 //for all properties in FOo
 f.set(foo.get());
 return f;
}
origin: stackoverflow.com

 public class Main{
   public static void main(String[] args){
     Foo f = new Foo("f");
     changeReference(f); // It won't change the reference!
     modifyReference(f); // It will modify the object that the reference variable "f" refers to!
   }
   public static void changeReference(Foo a){
     Foo b = new Foo("b");
     a = b;
   }
   public static void modifyReference(Foo c){
     c.setAttribute("c");
   }
}
origin: protostuff/protostuff

public void testEmptyFooInner() throws Exception
{
  Bar bar = new Bar();
  Foo foo = new Foo();
  ArrayList<Bar> bars = new ArrayList<Bar>();
  bars.add(bar);
  foo.setSomeBar(bars);
  byte[] output = toByteArray(foo);
  Foo parsedFoo = new Foo();
  mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema());
}
origin: protostuff/protostuff

public void testFooNullFields() throws Exception
{
  Foo b = new Foo();
  JsonIOUtil.mergeFrom(JsonIOUtil.DEFAULT_JSON_FACTORY.createJsonParser(
      "{\"someInt\":[null]" +
          ",\"someString\":[null]" +
          ",\"someBar\":[null]" +
          ",\"someEnum\":[null]" +
          ",\"someBytes\":[null]" +
          ",\"someBoolean\":[null]" +
          ",\"someFloat\":[null]" +
          ",\"someDouble\":[null]" +
          ",\"someLong\":[null]}"),
      b, b.cachedSchema(), false);
  assertNull(b.getSomeInt());
  assertNull(b.getSomeString());
  assertNull(b.getSomeBar());
  assertNull(b.getSomeEnum());
  assertNull(b.getSomeBytes());
  assertNull(b.getSomeBoolean());
  assertNull(b.getSomeFloat());
  assertNull(b.getSomeDouble());
  assertNull(b.getSomeLong());
}
origin: protostuff/protostuff

final CustomSchema<Bar> barSchema = new CustomSchema<Bar>(bar.cachedSchema())
baz.setId(1);
baz.setName("baz");
final Bar bar = new Bar();
bar.setSomeBaz(baz);
bar.setSomeInt(2);
bar.setSomeString("bar");
Foo foo = new Foo();
mergeFrom(coded, 0, coded.length, foo, foo.cachedSchema());
assertTrue(bar.getSomeInt() == foo.getSomeInt().get(0));
assertEquals(bar.getSomeString(), foo.getSomeString().get(0));
assertTrue(bar.getSomeDouble() == foo.getSomeDouble().get(0));
assertTrue(bar.getSomeFloat() == foo.getSomeFloat().get(0));
origin: protostuff/protostuff

public void testFoo() throws Exception
{
  Bar bar = new Bar();
  bar.setSomeInt(1);
  bar.setSomeBytes(ByteString.copyFromUtf8(ESCAPE_TARGET));
  bar.setSomeString(ESCAPE_TARGET);
  ArrayList<Bar> bars = new ArrayList<Bar>();
  bars.add(bar);
  bars.add(bar);
  ArrayList<String> strings = new ArrayList<String>();
  strings.add(ESCAPE_TARGET);
  strings.add("");
  strings.add(ESCAPE_TARGET);
  Foo foo = new Foo();
  foo.setSomeBar(bars);
  foo.setSomeString(strings);
  byte[] protostuff = ProtostuffIOUtil.toByteArray(foo, foo.cachedSchema(), buf());
  byte[] json = JsonIOUtil.toByteArray(ProtostuffIOUtil.newPipe(protostuff),
      Foo.getPipeSchema(), false);
  byte[] json2 = JsonXIOUtil.toByteArray(ProtostuffIOUtil.newPipe(protostuff),
      Foo.getPipeSchema(), false, buf());
  assertTrue(json.length == json2.length);
  String strJson = STRING.deser(json);
  String strJson2 = STRING.deser(json2);
  assertEquals(strJson, strJson2);
  System.err.println(strJson);
  System.err.println(strJson2);
}
origin: protostuff/protostuff

public void testEmptyFoo() throws Exception
{
  Foo foo = new Foo();
  byte[] output = toByteArray(foo);
  Foo parsedFoo = new Foo();
  mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema());
}
origin: protostuff/protostuff

public void testFoo() throws Exception
{
  Foo foo = SerializableObjects.foo;
  protobufRoundTrip(foo, Foo.getSchema(), Foo.getPipeSchema());
  protostuffRoundTrip(foo, Foo.getSchema(), Foo.getPipeSchema());
}
origin: protostuff/protostuff

static Foo newFoo()
{
  // one-instance of Baz.
  Baz baz = new Baz();
  baz.setId(100);
  Bar bar1 = new Bar();
  bar1.setSomeInt(1);
  bar1.setSomeBaz(baz);
  Bar bar2 = new Bar();
  bar2.setSomeInt(2);
  bar2.setSomeBaz(baz);
  ArrayList<Bar> bars = new ArrayList<Bar>();
  bars.add(bar1);
  bars.add(bar2);
  Foo foo = new Foo();
  foo.setSomeBar(bars);
  return foo;
}
origin: protostuff/protostuff

public void testJavaSerializableEmptyFooInner() throws Exception
{
  ArrayList<Bar> bars = new ArrayList<Bar>();
  Bar bar = new Bar();
  bar.setSomeBaz(new Baz());
  bars.add(bar);
  Foo foo = new Foo();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  ObjectOutputStream oout = new ObjectOutputStream(out);
  oout.writeObject(foo);
  byte[] coded = out.toByteArray();
  ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(coded));
  Foo parsedFoo = (Foo) in.readObject();
  SerializableObjects.assertEquals(parsedFoo, foo);
}
origin: stackoverflow.com

 Foo realfoo = new Foo();
IFoo ifoo = new Foo();
Bar bar =  new Bar();
origin: protostuff/protostuff

public void testReference() throws Exception
{
  Foo fooCompare = newFoo();
  // verify
  checkReference(fooCompare);
  byte[] data = toByteArray(fooCompare, Foo.getSchema());
  // from byte array
  Foo fooFromByteArray = new Foo();
  mergeFrom(data, 0, data.length, fooFromByteArray, Foo.getSchema());
  SerializableObjects.assertEquals(fooCompare, fooFromByteArray);
  // verify parsed message
  checkReference(fooFromByteArray);
  // from inputstream
  Foo fooFromStream = new Foo();
  ByteArrayInputStream in = new ByteArrayInputStream(data);
  mergeFrom(in, fooFromStream, Foo.getSchema());
  SerializableObjects.assertEquals(fooCompare, fooFromStream);
  // verify parsed message
  checkReference(fooFromStream);
}
origin: stackoverflow.com

 public static void main(String[] args) {
  final Foo f = new Foo();
  final Bar b = new Bar();
  new Thread(new Runnable() {
    public void run() {
      f.doSomethingWithBar(b);
    }
  }).start();

  new Thread(new Runnable() {
    public void run() {
      b.doSomethingWithFoo(f);
    }
  }).start();
}
origin: protostuff/protostuff

public void testFoo() throws Exception
{
  Schema<Foo> schema = Foo.getSchema();
  Foo message = foo;
  byte[] data = XmlXIOUtil.toByteArray(message, schema,
      buf());
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  XmlXIOUtil.writeTo(out, message, schema, buf());
  assertTrue(Arrays.equals(data, out.toByteArray()));
}
origin: stackoverflow.com

 Foo x = new Foo("the field");
x.setField("a new field");
System.out.println(x.getField()); // prints "a new field"
origin: protostuff/protostuff

public void testEmptyList() throws Exception
{
  ArrayList<Foo> foos = new ArrayList<Foo>();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  final int bytesWritten = writeListTo(out, foos, SerializableObjects.foo.cachedSchema());
  assertEquals(0, bytesWritten);
  byte[] data = out.toByteArray();
  ByteArrayInputStream in = new ByteArrayInputStream(data);
  List<Foo> parsedFoos = parseListFrom(in, SerializableObjects.foo.cachedSchema());
  assertTrue(parsedFoos.size() == foos.size());
  int i = 0;
  for (Foo f : parsedFoos)
    SerializableObjects.assertEquals(foos.get(i++), f);
}
origin: stackoverflow.com

 List<Foo> list = new ArrayList<Foo>();    
Foo tmp = new Foo();

for (int i = 0; i < 3; i++) {
 tmp.setValue(i);
 list.add(tmp);
}
origin: protostuff/protostuff

static void checkReference(Foo foo)
{
  Bar bar1 = foo.getSomeBar().get(0);
  assertNotNull(bar1);
  assert (bar1.getSomeInt() == 1);
  Bar bar2 = foo.getSomeBar().get(1);
  assertNotNull(bar2);
  assert (bar2.getSomeInt() == 2);
  // check if its same instance
  assertTrue(bar1.getSomeBaz() == bar2.getSomeBaz());
}
io.protostuffFoo

Javadoc

Foo - for testing

Most used methods

  • <init>
  • getSchema
  • cachedSchema
  • getPipeSchema
  • setSomeBar
  • setSomeString
  • getSomeBar
  • getSomeDouble
  • getSomeFloat
  • getSomeInt
  • getSomeString
  • Method1
  • getSomeString,
  • Method1,
  • add,
  • addBar1,
  • addBar2,
  • addPercentageChangeListener,
  • addString,
  • addToFoo,
  • allUniqueCombinations,
  • averageFood

Popular in Java

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • getResourceAsStream (ClassLoader)
  • getContentResolver (Context)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now