public static function jsniName(Clazz $clazz) { if ($clazz->isPrimitive()) { if ($clazz === Boolean::typeClass()) { return 'Z'; } else { if ($clazz === Byte::typeClass()) { return 'B'; } else { if ($clazz === Character::typeClass()) { return 'C'; } else { if ($clazz === Short::typeClass()) { return 'S'; } else { if ($clazz === Integer::typeClass()) { return 'I'; } else { if ($clazz === Long::typeClass()) { return 'J'; } else { if ($clazz === Float::typeClass()) { return 'F'; } else { if ($clazz === Double::typeClass()) { return 'D'; } } } } } } } } throw new RuntimeException('Unhandled primitive tye ' + $clazz->getName()); } else { if ($clazz->isArray()) { return '[' . self::jsniName($clazz->getComponentType()); } else { return 'L' . str_replace('.', '/', $clazz->getFullName()) . ';'; } } }
private function getJavahSignatureName(Clazz $clazz) { if ($clazz->isArray()) { $leafType = $clazz; $dims = 0; do { $dims++; $leafType = $leafType->getComponentType(); } while (!is_null($leafType->getComponentType())); assert($dims > 0); $s = $this->getJavahSignatureName($leafType); for ($i = 0; $i < $dims; ++$i) { $s = '_3' . $s; } return $s; } else { if ($clazz->isPrimitive()) { return WebModeClientOracle::jsniName($clazz); } else { $name = $clazz->getFullName(); $name = str_replace('_', '_1', $name); $name = str_replace('.', '_', $name); return 'L' . $name . '_2'; } } }
private function isInstantiable(Clazz $clazz) { if ($clazz->isPrimitive()) { return true; } if ($clazz->isArray()) { return $this->isInstantiable($clazz->getComponentType()); } if (Classes::classOf('IsSerializable')->isAssignableFrom($clazz)) { return true; } return Serializability::hasCustomFieldSerializer($clazz) != null; }
public static function getSerializedTypeName(Clazz $instanceType) { if ($instanceType->isPrimitive()) { return self::$SERIALIZED_PRIMITIVE_TYPE_NAMES->get($instanceType->getFullName()); } return $instanceType->getFullName(); }