use of org.osgl.util.FastStr in project actframework by actframework.
the class JsonDTOClassGenerator method typeDesc.
private static String typeDesc(BeanSpec spec) {
String root = classDesc(spec.rawType());
List<java.lang.reflect.Type> typeParams = spec.typeParams();
if (typeParams.isEmpty()) {
return root;
}
S.Buffer sb = S.newBuffer("<");
for (java.lang.reflect.Type type : typeParams) {
BeanSpec specx = BeanSpec.of(type, null, spec.injector());
sb.append(typeDesc(specx));
}
sb.append(">");
FastStr str = FastStr.of(root);
str = str.take(str.length() - 1).append(sb.toString()).append(";");
return str.toString();
}
use of org.osgl.util.FastStr in project actframework by actframework.
the class DataObjectEnhancer method hashCodeMethodEnd.
static void hashCodeMethodEnd(MethodVisitor mv, int fieldCnt) {
FastStr signature;
if (fieldCnt < 6) {
signature = FastStr.of("Ljava/lang/Object;").times(fieldCnt);
} else {
signature = FastStr.of("Ljava/lang/Object;").times(5).append("[Ljava/lang/Object;");
}
signature = signature.prepend("(").append(")I");
mv.visitMethodInsn(INVOKESTATIC, "org/osgl/Osgl", "hc", signature.toString(), false);
mv.visitInsn(IRETURN);
// just pass any number and have ASM to calculate
mv.visitMaxs(0, 0);
mv.visitEnd();
}
use of org.osgl.util.FastStr in project actframework by actframework.
the class FileGetter method contentType.
static H.Format contentType(String path) {
H.Format retVal = null;
if (path.contains(".")) {
FastStr s = FastStr.unsafeOf(path).afterLast('.');
retVal = H.Format.of(s.toString());
}
return null == retVal ? H.Format.BINARY : retVal;
}
use of org.osgl.util.FastStr in project actframework by actframework.
the class ActTestBase method root.
public static File root() {
FastStr fs = FastStr.of(ActTestBase.class.getClassLoader().getResource("routes").getPath());
FastStr classRoot = fs.beforeLast("/");
FastStr target = classRoot.beforeLast("/");
return new File(target.toString());
}
use of org.osgl.util.FastStr in project actframework by actframework.
the class FastJsonPropertyPreFilter method apply.
@Override
public boolean apply(JSONSerializer serializer, Object source, String name) {
if (source == null) {
return true;
}
// if context path is "$.bar.zee" or "$[0].bar.zee" and name is "foo"
// then path should be "bar.zee.foo"
String path;
FastStr fs = FastStr.of(serializer.getContext().toString()).append('.').append(name);
// skip the first "."
path = fs.substring(fs.indexOf('.') + 1);
return matches(path);
}