use of com.acgist.snail.pojo.bean.M3u8.Type in project tomee by apache.
the class DynamicSubclass method visitConstructor.
private static MethodVisitor visitConstructor(final ClassWriter cw, final String proxyClassFileName, final String classFileName, final Constructor<?> constructor) {
final String descriptor = Type.getConstructorDescriptor(constructor);
final String[] exceptions = new String[constructor.getExceptionTypes().length];
for (int i = 0; i < exceptions.length; i++) {
exceptions[i] = Type.getInternalName(constructor.getExceptionTypes()[i]);
}
final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", descriptor, null, exceptions);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
int index = 1;
for (final Type type : Type.getArgumentTypes(descriptor)) {
mv.visitVarInsn(type.getOpcode(ILOAD), index);
index += size(type);
}
mv.visitMethodInsn(INVOKESPECIAL, classFileName, "<init>", descriptor, false);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(PUTFIELD, proxyClassFileName, "this$handler", "Ljava/lang/reflect/InvocationHandler;");
mv.visitInsn(RETURN);
mv.visitMaxs(2, 1);
return mv;
}
use of com.acgist.snail.pojo.bean.M3u8.Type in project tomee by apache.
the class DependencyVisitor method addMethodDesc.
private void addMethodDesc(final String desc) {
addType(Type.getReturnType(desc));
final Type[] types = Type.getArgumentTypes(desc);
for (Type type : types) {
addType(type);
}
}
use of com.acgist.snail.pojo.bean.M3u8.Type in project tomee by apache.
the class CmrField method createSignature.
private static String createSignature(final Type type, final Type... genericTypes) {
final StringBuilder builder = new StringBuilder();
builder.append("L").append(type.getInternalName());
if (genericTypes.length > 0) {
builder.append("<");
for (final Type genericType : genericTypes) {
builder.append(genericType.getDescriptor());
}
builder.append(">");
}
builder.append(";");
return builder.toString();
}
use of com.acgist.snail.pojo.bean.M3u8.Type in project java-spanner-jdbc by googleapis.
the class PgNumericPreparedStatementTest method assertRequestWithScalar.
private void assertRequestWithScalar(String value) {
final ExecuteSqlRequest request = mockSpanner.getRequestsOfType(ExecuteSqlRequest.class).get(0);
final String actualSql = request.getSql();
final Struct actualParams = request.getParams();
final Map<String, Type> actualParamTypes = request.getParamTypesMap();
final Value parameterValue = protoValueFromString(value);
final Struct expectedParams = Struct.newBuilder().putFields("p1", parameterValue).build();
final ImmutableMap<String, Type> expectedTypes = ImmutableMap.of("p1", Type.newBuilder().setCode(TypeCode.NUMERIC).setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC).build());
assertEquals(REWRITTEN_QUERY, actualSql);
assertEquals(expectedParams, actualParams);
assertEquals(expectedTypes, actualParamTypes);
}
use of com.acgist.snail.pojo.bean.M3u8.Type in project java-spanner-jdbc by googleapis.
the class PgNumericPreparedStatementTest method assertRequestWithArray.
private void assertRequestWithArray(Iterable<String> value) {
final ExecuteSqlRequest request = mockSpanner.getRequestsOfType(ExecuteSqlRequest.class).get(0);
final String actualSql = request.getSql();
final Struct actualParams = request.getParams();
final Map<String, Type> actualParamTypes = request.getParamTypesMap();
Value parameterValue;
if (value != null) {
final ListValue.Builder builder = ListValue.newBuilder();
value.forEach(v -> builder.addValues(protoValueFromString(v)));
parameterValue = Value.newBuilder().setListValue(builder.build()).build();
} else {
parameterValue = Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build();
}
final Struct expectedParams = Struct.newBuilder().putFields("p1", parameterValue).build();
final ImmutableMap<String, Type> expectedTypes = ImmutableMap.of("p1", Type.newBuilder().setCode(TypeCode.ARRAY).setArrayElementType(Type.newBuilder().setCode(TypeCode.NUMERIC).setTypeAnnotation(TypeAnnotationCode.PG_NUMERIC)).build());
assertEquals(REWRITTEN_QUERY, actualSql);
assertEquals(expectedParams, actualParams);
assertEquals(expectedTypes, actualParamTypes);
}
Aggregations