All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mercateo.common.rest.schemagen.link.relation.Relation Maven / Gradle / Ivy

There is a newer version: 0.20.0
Show newest version
package com.mercateo.common.rest.schemagen.link.relation;

public interface Relation {

    RelationType DEFAULT_TYPE = RelType.SELF.getRelationType();

    String getName();

    RelationType getType();

    static  & RelationContainer> Relation of(E relation) {
        return of(relation, DEFAULT_TYPE);
    }

    static  & RelationContainer> Relation of(E relation, RelationTypeContainer typeContainer) {
        return of(relation, typeContainer.getRelationType());
    }

    static  & RelationContainer> Relation of(E relation, RelationType type) {
        return of(relation.name().toLowerCase().replace('_', '-'), type);
    }

    static Relation of(String name, RelationTypeContainer typeContainer) {
        return of(name, typeContainer.getRelationType());
    }

    static Relation of(String name) {
        return new RelationDefault(name, DEFAULT_TYPE);
    }

    static Relation of(String name, RelationType type) {
        return new RelationDefault(name, type);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy