/** * * @see RPCTargetResolverStrategy::resolveRPCTarget() */ function resolveRPCTarget(MappedClass $interface) { if ($interface->getReflectionClass()->isInterface()) { require_once GWTPHP_DIR . '/maps/com/google/gwt/user/client/rpc/IncompatibleRemoteServiceException.class.php'; throw new IncompatibleRemoteServiceException("Blocked attempt to access interface '" . $interface->getName() . "' where class expected; this is either misconfiguration or a hack attempt"); } return null; }
/** * Straight copy from * {@link com.google.gwt.dev.util.TypeInfo#getSourceRepresentation(Class)} to * avoid runtime dependency on gwt-dev. */ private static function printTypeName(MappedClass $type) { // Primitives // if ($type->isPrimitive()) { switch ($type) { case TypeSignatures::$BOOLEAN: return 'boolean'; case TypeSignatures::$BYTE: return 'byte'; case TypeSignatures::$CHAR: return 'char'; case TypeSignatures::$DOUBLE: return 'double'; case TypeSignatures::$FLOAT: return 'float'; case TypeSignatures::$INT: return 'int'; case TypeSignatures::$LONG: return 'long'; case TypeSignatures::$SHORT: return 'short'; default: 'unknown'; } } // Arrays // if ($type->isArray()) { $componentType = $type->getComponentType(); return RPC::printTypeName($componentType) + '[]'; } // Everything else // return $type->getName(); //.replace('$', '.'); }
/** * Enter description here... * * @param MappedClass $mappedClass * @return ReflectionClass */ public static function computeHasCustomFieldSerializer(MappedClass $instanceType) { assert($instanceType != null); $qualifiedTypeName = null; if ($instanceType->isArray()) { /*MappedClass*/ $componentType = $instanceType->getComponentType(); if ($componentType->isPrimitive()) { $qualifiedTypeName = 'java.lang.' . $componentType->getName(); } else { $qualifiedTypeName = 'java.lang.Object'; } $qualifiedTypeName .= '_Array'; } else { $qualifiedTypeName = $instanceType->getName(); } $classLoader = GWTPHPContext::getInstance()->getClassLoader(); $simpleSerializerName = $qualifiedTypeName . "_CustomFieldSerializer"; $customSerializer = SerializabilityUtil::getCustomFieldSerializer($classLoader, $simpleSerializerName); if ($customSerializer != null) { return $customSerializer; } // Try with the regular name /*ReflectionClass*/ $customSerializerClass = SerializabilityUtil::getCustomFieldSerializer($classLoader, SerializabilityUtil::$JRE_SERIALIZER_PACKAGE . '.' . $simpleSerializerName); if ($customSerializerClass != null) { return $customSerializerClass; } return null; }