Skip to content

Commit 8d6b813

Browse files
committed
update Java version
1 parent 9b7ae04 commit 8d6b813

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

src/test/java/com/upokecenter/test/CBORObjectTest.java

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -10636,63 +10636,3 @@ public void TestToObject_TypeMapper() {
1063610636
}
1063710637
}
1063810638
}
10639-
}
10640-
10641-
public class Tests {
10642-
@Test
10643-
public void ToObjectWithReadOnly() {
10644-
Foo { foo = new Foo {
10645-
Bars = new ArrayList<Bar> {new Bar {Strings = new ArrayList<String> {,
10646-
"Mumbo"}}, }
10647-
};
10648-
10649-
CBORTypeMapper typeMapper = new CBORTypeMapper();
10650-
typeMapper.AddTypeName(Foo.class.getFullName());
10651-
typeMapper.AddTypeName(Bar.class.getFullName());
10652-
{
10653-
Object objectTemp = (new java.lang.reflect.ParameterizedType() {public java.lang.reflect.Type[] getActualTypeArguments() {return new java.lang.reflect.Type[] { Bar.class };}public java.lang.reflect.Type getRawType() { return IReadOnlyCollection.class; } public java.lang.reflect.Type getOwnerType() { return null; }});
10654-
Object objectTemp2 = new
10655-
ReadOnlyCollectionConverter<Bar>(typeMapper);
10656-
typeMapper.AddConverter(objectTemp, objectTemp2);
10657-
}
10658-
// typeMapper.AddConverter((new java.lang.reflect.ParameterizedType() {public java.lang.reflect.Type[] getActualTypeArguments() {return new java.lang.reflect.Type[] { String.class };}public java.lang.reflect.Type getRawType() { return IReadOnlyCollection.class; } public java.lang.reflect.Type getOwnerType() { return null; }}), new
10659-
// ReadOnlyCollectionConverter<String>(typeMapper));
10660-
java.io.ByteArrayOutputStream stream = new java.io.ByteArrayOutputStream();
10661-
CBORObject.FromObject(foo, typeMapper).WriteTo(stream);
10662-
stream.setPosition(0);
10663-
CBORObject.Read(stream).ToObject(foo.getClass(), typeMapper);
10664-
}
10665-
}
10666-
10667-
public class Foo {
10668-
public final IReadOnlyCollection<Bar> getBars() { return propVarbars; }
10669-
public final void setBars(IReadOnlyCollection<Bar> value) { propVarbars = value; }
10670-
private IReadOnlyCollection<Bar> propVarbars;
10671-
}
10672-
10673-
public class Bar {
10674-
public final IReadOnlyCollection<String> getStrings() { return propVarstrings; }
10675-
public final void setStrings(IReadOnlyCollection<String> value) { propVarstrings = value; }
10676-
private IReadOnlyCollection<String> propVarstrings;
10677-
}
10678-
10679-
public class ReadOnlyCollectionConverter<T> implements ICBORToFromConverter<IReadOnlyCollection<T>>
10680-
{
10681-
private CBORTypeMapper tm;
10682-
10683-
public ReadOnlyCollectionConverter(CBORTypeMapper tm) {
10684-
this.tm = tm;
10685-
}
10686-
10687-
public CBORObject ToCBORObject(IReadOnlyCollection<T> obj) {
10688-
var array = CBORObject.NewArray();
10689-
for (Object item : obj) {
10690-
array.Add(CBORObject.FromObject(item, this.tm));
10691-
}
10692-
10693-
return array;
10694-
}
10695-
10696-
public IReadOnlyCollection<T> FromCBORObject(CBORObject obj) {
10697-
return obj.getValues().Select(x => x.getToObject()<T>(this.tm)).ToList();
10698-
}

0 commit comments

Comments
 (0)