Skip to content

Commit 138757b

Browse files
committed
snapshot()
1 parent 663a1a7 commit 138757b

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed

avro/src/main/java/com/fasterxml/jackson/dataformat/avro/AvroFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ public AvroFactory copy() {
140140
return new AvroFactory(this);
141141
}
142142

143+
/**
144+
* Instances are immutable so just return `this`
145+
*/
146+
@Override
147+
public TokenStreamFactory snapshot() {
148+
return this;
149+
}
150+
143151
/*
144152
/**********************************************************
145153
/* Serializable overrides

cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ public CBORFactory copy() {
132132
return new CBORFactory(this);
133133
}
134134

135+
/**
136+
* Instances are immutable so just return `this`
137+
*/
138+
@Override
139+
public TokenStreamFactory snapshot() {
140+
return this;
141+
}
142+
135143
/*
136144
/**********************************************************
137145
/* Serializable overrides

ion/src/main/java/com/fasterxml/jackson/dataformat/ion/IonFactory.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,18 @@ public static IonFactoryBuilder builderForTextualWriters() {
136136
}
137137

138138
@Override
139-
public IonFactory copy()
140-
{
141-
// note: as with base class, must NOT copy mapper reference
139+
public IonFactory copy() {
142140
return new IonFactory(this);
143141
}
144142

143+
/**
144+
* Instances are immutable so just return `this`
145+
*/
146+
@Override
147+
public TokenStreamFactory snapshot() {
148+
return this;
149+
}
150+
145151
/*
146152
/**********************************************************
147153
/* Basic introspection

protobuf/src/main/java/com/fasterxml/jackson/dataformat/protobuf/ProtobufFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public ProtobufFactory copy(){
5353
return new ProtobufFactory(this);
5454
}
5555

56+
/**
57+
* Instances are immutable so just return `this`
58+
*/
59+
@Override
60+
public TokenStreamFactory snapshot() {
61+
return this;
62+
}
63+
5664
/*
5765
/**********************************************************
5866
/* Serializable overrides

smile/src/main/java/com/fasterxml/jackson/dataformat/smile/SmileFactory.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,18 @@ public static SmileFactoryBuilder builder() {
140140
}
141141

142142
@Override
143-
public SmileFactory copy()
144-
{
143+
public SmileFactory copy() {
145144
return new SmileFactory(this);
146145
}
147146

147+
/**
148+
* Instances are immutable so just return `this`
149+
*/
150+
@Override
151+
public TokenStreamFactory snapshot() {
152+
return this;
153+
}
154+
148155
/*
149156
/**********************************************************
150157
/* Serializable overrides
@@ -154,7 +161,6 @@ public SmileFactory copy()
154161
/**
155162
* Method that we need to override to actually make restoration go
156163
* through constructors etc.
157-
* Also: must be overridden by sub-classes as well.
158164
*/
159165
protected Object readResolve() {
160166
return new SmileFactory(this);

0 commit comments

Comments
 (0)