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

com.buschmais.xo.neo4j.spi.helper.MetadataHelper Maven / Gradle / Ivy

There is a newer version: 2.2.9
Show newest version
package com.buschmais.xo.neo4j.spi.helper;

import com.buschmais.xo.api.XOException;
import com.buschmais.xo.api.metadata.method.IndexedPropertyMethodMetadata;
import com.buschmais.xo.api.metadata.method.PrimitivePropertyMethodMetadata;
import com.buschmais.xo.api.metadata.type.EntityTypeMetadata;
import com.buschmais.xo.neo4j.api.model.Neo4jLabel;
import com.buschmais.xo.neo4j.spi.metadata.NodeMetadata;
import com.buschmais.xo.neo4j.spi.metadata.PropertyMetadata;

public class MetadataHelper {

    private MetadataHelper() {
    }

    public static  PropertyMetadata getIndexedPropertyMetadata(EntityTypeMetadata> type,
        PrimitivePropertyMethodMetadata propertyMethodMetadata) {
        if (propertyMethodMetadata == null) {
            IndexedPropertyMethodMetadata indexedProperty = type.getDatastoreMetadata()
                .getUsingIndexedPropertyOf();
            if (indexedProperty == null) {
                throw new XOException("Type " + type.getAnnotatedType()
                    .getAnnotatedElement()
                    .getName() + " has no indexed property.");
            }
            propertyMethodMetadata = indexedProperty.getPropertyMethodMetadata();
        }
        return propertyMethodMetadata.getDatastoreMetadata();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy