Skip to content

Commit

Permalink
[wpiutil] Add serializable marker interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson committed Dec 19, 2023
1 parent f029841 commit 155f62f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions wpiutil/src/main/java/edu/wpi/first/util/WPISerializable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package edu.wpi.first.util;

/** Marker interface to indicate a class is serializable using WPI serialization methods. */
public interface WPISerializable<T> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package edu.wpi.first.util.protobuf;

import edu.wpi.first.util.WPISerializable;

/**
* Marker interface to indicate a class is serializable using Protobuf serialization.
*
* <p>While this cannot be enforced by the interface, any class implementing this interface should
* provide a public final static `proto` member variable.
*/
public interface ProtobufSerializable<T> extends WPISerializable<T> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package edu.wpi.first.util.struct;

import edu.wpi.first.util.WPISerializable;

/**
* Marker interface to indicate a class is serializable using Struct serialization.
*
* <p>While this cannot be enforced by the interface, any class implementing this interface should
* provide a public final static `struct` member variable.
*/
public interface StructSerializable<T> extends WPISerializable<T> {}

0 comments on commit 155f62f

Please sign in to comment.