-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java] Support jdk record metashare mode (#855)
* add record info * refactor record utils * support meta share for record and support record default value
- Loading branch information
1 parent
8394dd2
commit 6343585
Showing
7 changed files
with
208 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2023 The Fury Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.fury.util; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Record build information. | ||
* | ||
* @author chaokunyang | ||
*/ | ||
public class RecordInfo { | ||
private final int[] recordComponentsIndex; | ||
private final Object[] recordComponentsDefaultValues; | ||
private final Object[] recordComponents; | ||
|
||
public RecordInfo(Class<?> cls, List<String> fieldNames) { | ||
recordComponentsDefaultValues = RecordUtils.buildRecordComponentDefaultValues(cls); | ||
recordComponentsIndex = RecordUtils.buildRecordComponentMapping(cls, fieldNames); | ||
assert recordComponentsIndex != null; | ||
recordComponents = new Object[recordComponentsIndex.length]; | ||
} | ||
|
||
public int[] getRecordComponentsIndex() { | ||
return recordComponentsIndex; | ||
} | ||
|
||
public Object[] getRecordComponentsDefaultValues() { | ||
return recordComponentsDefaultValues; | ||
} | ||
|
||
public Object[] getRecordComponents() { | ||
return recordComponents; | ||
} | ||
} |
Oops, something went wrong.