-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release the SerializableAutoValue extension.
RELNOTES=Release the SerializableAutoValue extension. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=304211473
- Loading branch information
Showing
28 changed files
with
2,296 additions
and
3 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
30 changes: 30 additions & 0 deletions
30
value/src/main/java/com/google/auto/value/extension/serializable/SerializableAutoValue.java
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,30 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* | ||
* 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 com.google.auto.value.extension.serializable; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Annotates {@link com.google.auto.value.AutoValue @AutoValue} classes that implement {@link | ||
* java.io.Serializable}. A serializable subclass is generated for classes with normally | ||
* un-serializable fields like {@link java.util.Optional}. | ||
*/ | ||
@Retention(RetentionPolicy.SOURCE) | ||
@Target(ElementType.TYPE) | ||
public @interface SerializableAutoValue {} |
24 changes: 24 additions & 0 deletions
24
value/src/main/java/com/google/auto/value/extension/serializable/processor/ClassNames.java
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,24 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* | ||
* 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 com.google.auto.value.extension.serializable.processor; | ||
|
||
/** Names of classes that are referenced in /processor. */ | ||
final class ClassNames { | ||
static final String SERIALIZABLE_AUTO_VALUE_NAME = | ||
"com.google.auto.value.extension.serializable.SerializableAutoValue"; | ||
|
||
private ClassNames() {} | ||
} |
56 changes: 56 additions & 0 deletions
56
.../src/main/java/com/google/auto/value/extension/serializable/processor/PropertyMirror.java
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,56 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* | ||
* 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 com.google.auto.value.extension.serializable.processor; | ||
|
||
import javax.lang.model.type.TypeMirror; | ||
|
||
/** | ||
* A POJO containing information about an AutoValue's property. | ||
* | ||
* <p>For example, given this AutoValue property: <code>abstract T getX();</code> | ||
* | ||
* <ol> | ||
* <li>The type would be T. | ||
* <li>The name would be x. | ||
* <li>The method would be getX. | ||
*/ | ||
final class PropertyMirror { | ||
|
||
private final TypeMirror type; | ||
private final String name; | ||
private final String method; | ||
|
||
PropertyMirror(TypeMirror type, String name, String method) { | ||
this.type = type; | ||
this.name = name; | ||
this.method = method; | ||
} | ||
|
||
/** Gets the AutoValue property's type. */ | ||
TypeMirror getType() { | ||
return type; | ||
} | ||
|
||
/** Gets the AutoValue property's name. */ | ||
String getName() { | ||
return name; | ||
} | ||
|
||
/** Gets the AutoValue property accessor method. */ | ||
String getMethod() { | ||
return method; | ||
} | ||
} |
Oops, something went wrong.