forked from json-iterator/java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExtension.java
More file actions
54 lines (47 loc) · 1.43 KB
/
Extension.java
File metadata and controls
54 lines (47 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.jsoniter.spi;
import java.lang.reflect.Type;
public interface Extension {
/**
* Choose the implementation class for interface types
*
* @param type the type to decode to, could be class or parameterized type
* @return the implementation type to use
*/
Type chooseImplementation(Type type);
/**
* Can this extension create object instance for given interface type
*
* @param clazz the interface
* @return true if can create, false if can not
*/
boolean canCreate(Class clazz);
/**
* Create object instance for given interface type
*
* @param clazz the interface
* @return the object instance, throw exception if can not create
*/
Object create(Class clazz);
/**
* Customize type decoding
*
* @param cacheKey name of the decoder
* @param type change how to decode the type
* @return null, if no special customization needed
*/
Decoder createDecoder(String cacheKey, Type type);
/**
* Customize type encoding
*
* @param cacheKey name of the encoder
* @param type change how to encode the type
* @return null, if not special customization needed
*/
Encoder createEncoder(String cacheKey, Type type);
/**
* Update how binding is done for the class
*
* @param desc binding information
*/
void updateClassDescriptor(ClassDescriptor desc);
}