io.micronaut.eclipsestore.rest.RootObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micronaut-eclipsestore-rest Show documentation
Show all versions of micronaut-eclipsestore-rest Show documentation
Micronaut integration with EclipseStore
The newest version!
/*
* Copyright 2017-2022 original 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
*
* https://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.micronaut.eclipsestore.rest;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.serde.annotation.Serdeable;
import org.eclipse.store.storage.restadapter.types.ViewerRootDescription;
import jakarta.validation.constraints.NotBlank;
/**
* This object represents a root object for the EclipseStore REST api.
*
* @author Tim Yates
* @since 1.0.0
*/
@Serdeable
public class RootObject {
/**
* root name.
*/
@NonNull
@NotBlank
private final String name;
/**
* the root object id.
*/
@NonNull
@NotBlank
private final String objectId;
/**
* Construct a root object from a name and id.
*
* @param name the name of the root object
* @param objectId the id of the root object
*/
public RootObject(@NonNull String name, @NonNull String objectId) {
this.name = name;
this.objectId = objectId;
}
/**
* Construct a root object from the EclipseStore description.
*
* @param userRoot the root description from EclipseStore
*/
public RootObject(@NonNull ViewerRootDescription userRoot) {
this.name = userRoot.getName();
this.objectId = Long.toString(userRoot.getObjectId());
}
/**
* @return the name of the root object
*/
@NonNull
public String getName() {
return name;
}
/**
* @return the id of the root object
*/
@NonNull
public String getObjectId() {
return objectId;
}
}