/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ // DO NOT EDIT IT MANUALLY. This file is generated by opendal/dev/src/generate/java.rs. package org.apache.opendal; import java.time.Instant; import java.util.Collections; import java.util.Map; import lombok.Data; /** * Metadata carries all metadata associated with a path. */ @Data public class Metadata { {% for f in fields %} /** * {{ f.doc }} */ public final {{ f.java_type }} {{ f.camel }}; {% endfor %} public Metadata( {%- for f in fields[:-1] %} {{ f.constructor_type }} {{ f.camel }}{{ "," if not loop.last else ") {" }} {%- endfor %} this( {%- for f in fields[:-1] %} {{ f.camel }}, {%- endfor %} Collections.emptyMap()); } public Metadata( {%- for f in fields %} {{ f.constructor_type }} {{ f.camel }}{{ "," if not loop.last else ") {" }} {%- endfor %} {%- for f in fields %} this.{{ f.camel }} = {{ f.constructor_value }}; {%- endfor %} } public boolean isFile() { return mode == EntryMode.FILE; } public boolean isDir() { return mode == EntryMode.DIR; } public enum EntryMode { /** * FILE means the path has data to read. */ FILE, /** * DIR means the path can be listed. */ DIR, /** * Unknown means we don't know what we can do on this path. */ UNKNOWN; public static EntryMode of(int mode) { switch (mode) { case 0: return EntryMode.FILE; case 1: return EntryMode.DIR; case 2: return EntryMode.UNKNOWN; default: throw new IllegalArgumentException("invalid EntryMode: " + mode); } } } }