public class StandardSerializationPolicy extends SerializationPolicy implements TypeNameObfuscator
SerializationPolicy
.SERVICE_INTERFACE_ID
Constructor and Description |
---|
StandardSerializationPolicy(Map<Class<?>,Boolean> serializationWhitelist,
Map<Class<?>,Boolean> deserializationWhitelist,
Map<Class<?>,String> obfuscatedTypeIds)
Constructs a
SerializationPolicy from several Map s. |
StandardSerializationPolicy(Map<Class<?>,Boolean> serializationWhitelist,
Map<Class<?>,Boolean> deserializationWhitelist,
Map<Class<?>,String> obfuscatedTypeIds,
Map<Class<?>,Set<String>> clientFields)
Constructs a
SerializationPolicy from several Map s. |
StandardSerializationPolicy(Map<Class<?>,Boolean> serializationWhitelist,
Map<Class<?>,Boolean> deserializationWhitelist,
Map<Class<?>,String> obfuscatedTypeIds,
Map<Class<?>,Set<String>> clientFields,
boolean shouldSerializeFinalFields)
Constructs a
SerializationPolicy from several Map s. |
Modifier and Type | Method and Description |
---|---|
String |
getClassNameForTypeId(String id)
Returns the name of the class that should be instantiated based on an
obfuscated identifier.
|
Set<String> |
getClientFieldNamesForEnhancedClass(Class<?> clazz)
Returns the field names of the given class known to the client for classes
that are expected to be enhanced on the server to have additional fields,
or null for classes that are not expected to be enhanced.
|
String |
getTypeIdForClass(Class<?> clazz)
Returns the obfuscated identifier to be used to encode a class in the RPC
wire format.
|
boolean |
shouldDeserializeFields(Class<?> clazz)
Returns
true if the class' fields should be deserialized. |
boolean |
shouldSerializeFields(Class<?> clazz)
Returns
true if the class' fields should be serialized. |
boolean |
shouldSerializeFinalFields()
Returns whether the client was compiled with
rpc.XserializeFinalFields = true . |
void |
validateDeserialize(Class<?> clazz)
Validates that the specified class should be deserialized from a stream.
|
void |
validateSerialize(Class<?> clazz)
Validates that the specified class should be serialized into a stream.
|
public StandardSerializationPolicy(Map<Class<?>,Boolean> serializationWhitelist, Map<Class<?>,Boolean> deserializationWhitelist, Map<Class<?>,String> obfuscatedTypeIds)
SerializationPolicy
from several Map
s.public StandardSerializationPolicy(Map<Class<?>,Boolean> serializationWhitelist, Map<Class<?>,Boolean> deserializationWhitelist, Map<Class<?>,String> obfuscatedTypeIds, Map<Class<?>,Set<String>> clientFields)
SerializationPolicy
from several Map
s.public StandardSerializationPolicy(Map<Class<?>,Boolean> serializationWhitelist, Map<Class<?>,Boolean> deserializationWhitelist, Map<Class<?>,String> obfuscatedTypeIds, Map<Class<?>,Set<String>> clientFields, boolean shouldSerializeFinalFields)
SerializationPolicy
from several Map
s.public final String getClassNameForTypeId(String id) throws SerializationException
TypeNameObfuscator
getClassNameForTypeId
in interface TypeNameObfuscator
id
- the type id that was present in the RPC payloadClass#forName
,
to be instantiatedSerializationException
- if there is no class that corresponds to the
obfuscated idpublic Set<String> getClientFieldNamesForEnhancedClass(Class<?> clazz)
SerializationPolicy
getClientFieldNamesForEnhancedClass
in class SerializationPolicy
clazz
- the class to testpublic final String getTypeIdForClass(Class<?> clazz) throws SerializationException
TypeNameObfuscator
getTypeIdForClass
in interface TypeNameObfuscator
clazz
- the class to be transmittedSerializationException
public boolean shouldDeserializeFields(Class<?> clazz)
SerializationPolicy
true
if the class' fields should be deserialized.shouldDeserializeFields
in class SerializationPolicy
clazz
- the class to testtrue
if the class' fields should be deserializedpublic boolean shouldSerializeFields(Class<?> clazz)
SerializationPolicy
true
if the class' fields should be serialized.shouldSerializeFields
in class SerializationPolicy
clazz
- the class to testtrue
if the class' fields should be serializedpublic boolean shouldSerializeFinalFields()
SerializationPolicy
rpc.XserializeFinalFields = true
.shouldSerializeFinalFields
in class SerializationPolicy
public void validateDeserialize(Class<?> clazz) throws SerializationException
SerializationPolicy
validateDeserialize
in class SerializationPolicy
clazz
- the class to validateSerializationException
- if the class is not allowed to be
deserializedpublic void validateSerialize(Class<?> clazz) throws SerializationException
SerializationPolicy
validateSerialize
in class SerializationPolicy
clazz
- the class to validateSerializationException
- if the class is not allowed to be serializedCopyright © 2018. All rights reserved.