Example usage for java.util.concurrent ConcurrentLinkedDeque push

List of usage examples for java.util.concurrent ConcurrentLinkedDeque push

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentLinkedDeque push.

Prototype

public void push(E e) 

Source Link

Usage

From source file:com.yahoo.elide.core.EntityBinding.java

/**
 * Bind an attribute or relationship./*from  w  w  w .  j  a v a  2  s  .  c o m*/
 *
 * @param cls Class type to bind fields
 * @param fieldOrMethod Field or method to bind
 */
private void bindAttrOrRelation(Class<?> cls, AccessibleObject fieldOrMethod) {
    boolean manyToMany = fieldOrMethod.isAnnotationPresent(ManyToMany.class);
    boolean manyToOne = fieldOrMethod.isAnnotationPresent(ManyToOne.class);
    boolean oneToMany = fieldOrMethod.isAnnotationPresent(OneToMany.class);
    boolean oneToOne = fieldOrMethod.isAnnotationPresent(OneToOne.class);
    boolean isRelation = manyToMany || manyToOne || oneToMany || oneToOne;

    String fieldName = getFieldName(fieldOrMethod);

    if (fieldName == null || fieldName.equals("id") || fieldName.equals("class")
            || OBJ_METHODS.contains(fieldOrMethod)
            || parameterizedFieldContainsAnnotation(fieldOrMethod, Arrays.asList(Exclude.class))) {
        return; // Reserved. Not attributes. Otherwise, potentially excluded.
    }

    Class<?> fieldType = getFieldType(fieldOrMethod);

    ConcurrentLinkedDeque<String> fieldList;
    if (isRelation) {
        fieldList = relationshipsDeque;
        RelationshipType type;
        String mappedBy;
        if (oneToMany) {
            type = RelationshipType.ONE_TO_MANY;
            mappedBy = fieldOrMethod.getAnnotation(OneToMany.class).mappedBy();
        } else if (oneToOne) {
            type = RelationshipType.ONE_TO_ONE;
            mappedBy = fieldOrMethod.getAnnotation(OneToOne.class).mappedBy();
        } else if (manyToMany) {
            type = RelationshipType.MANY_TO_MANY;
            mappedBy = fieldOrMethod.getAnnotation(ManyToMany.class).mappedBy();
        } else if (manyToOne) {
            type = RelationshipType.MANY_TO_ONE;
            mappedBy = "";
        } else {
            type = RelationshipType.NONE;
            mappedBy = "";
        }
        relationshipTypes.put(fieldName, type);
        relationshipToInverse.put(fieldName, mappedBy);
    } else {
        fieldList = attrsDeque;
    }

    fieldList.push(fieldName);
    fieldsToValues.put(fieldName, fieldOrMethod);
    fieldsToTypes.put(fieldName, fieldType);
}