MCPcopy Create free account
hub / github.com/Netflix/maestro / of

Method of

netflix-sel/src/main/java/com/netflix/sel/type/SelArray.java:62–91  ·  view source on GitHub ↗
(Object o, SelTypes type)

Source from the content-addressed store, hash-verified

60 }
61
62 static SelArray of(Object o, SelTypes type) {
63 switch (type) {
64 case STRING_ARRAY:
65 SelString[] arrays = new SelString[Array.getLength(o)];
66 for (int i = 0; i < arrays.length; ++i) {
67 arrays[i] = SelString.of(((String) Array.get(o, i)));
68 }
69 return new SelArray(arrays, SelTypes.STRING_ARRAY);
70 case LONG_ARRAY:
71 SelLong[] arrayl = new SelLong[Array.getLength(o)];
72 for (int i = 0; i < arrayl.length; ++i) {
73 arrayl[i] = SelLong.of(((Number) Array.get(o, i)).longValue());
74 }
75 return new SelArray(arrayl, SelTypes.LONG_ARRAY);
76 case DOUBLE_ARRAY:
77 SelDouble[] arrayd = new SelDouble[Array.getLength(o)];
78 for (int i = 0; i < arrayd.length; ++i) {
79 arrayd[i] = SelDouble.of(((Number) Array.get(o, i)).doubleValue());
80 }
81 return new SelArray(arrayd, SelTypes.DOUBLE_ARRAY);
82 case BOOLEAN_ARRAY:
83 SelBoolean[] arrayb = new SelBoolean[Array.getLength(o)];
84 for (int i = 0; i < arrayb.length; ++i) {
85 arrayb[i] = SelBoolean.of((Boolean) Array.get(o, i));
86 }
87 return new SelArray(arrayb, SelTypes.BOOLEAN_ARRAY);
88 }
89 throw new UnsupportedOperationException(
90 "Not support to copy " + o + " to an array with type " + type);
91 }
92
93 public void set(int idx, SelType obj) {
94 val[idx].assignOps(SelOp.ASSIGN, obj);

Callers 11

testCallPutMethod · 0.95
testCallPutMethod · 0.95
setUpMethod · 0.95
testCallPutMethod · 0.95
testCallArraysAsListMethod · 0.95
testJoinMethod · 0.95
testCallPutMethod · 0.95
ofMethod · 0.95
dateIntsBetweenMethod · 0.95
intsBetweenMethod · 0.95
boxMethod · 0.95

Calls 5

ofMethod · 0.95
ofMethod · 0.95
ofMethod · 0.95
ofMethod · 0.95
getMethod · 0.65

Tested by 7

testCallPutMethod · 0.76
testCallPutMethod · 0.76
setUpMethod · 0.76
testCallPutMethod · 0.76
testCallArraysAsListMethod · 0.76
testJoinMethod · 0.76
testCallPutMethod · 0.76