Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c37f9ca authored by Hai Zhang's avatar Hai Zhang
Browse files

Add XML persistence code generation tool.

Test: m xmlpersistence_cli && xmlpersistence_cli
Change-Id: Ia54739e99f52c3ab7125f21b1bc306a474f6bf68
parent 7cdbbc1d
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * 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.android.server.utils;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Specify the XML name for the annotated field or persistence class.
 */
@Retention(RetentionPolicy.SOURCE)
@Target({ ElementType.FIELD, ElementType.TYPE })
public @interface XmlName {
    String value();
}
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * 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.android.server.utils;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Generate XML persistence for the annotated class.
 */
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface XmlPersistence {
    /**
     * Name for the generated XML persistence class.
     * <p>
     * The name defaults to the target class name appended with {@code Persistence} if unspecified.
     */
    String value();
}
+11 −0
Original line number Diff line number Diff line
java_binary_host {
    name: "xmlpersistence_cli",
    manifest: "manifest.txt",
    srcs: [
        "src/**/*.kt",
    ],
    static_libs: [
        "javaparser-symbol-solver",
        "javapoet",
    ],
}
+1 −0
Original line number Diff line number Diff line
zhanghai@google.com
+1 −0
Original line number Diff line number Diff line
Main-class: MainKt
Loading