Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2011 the original author or 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 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.
import  org.springframework.dao.InvalidDataAccessApiUsageException;
    protected Neo4jTemplate template;
        this. = template;
	public boolean accept(final Neo4jPersistentProperty property) {
	    if (!property.isRelationship()) return false;
        final RelationshipInfo info = property.getRelationshipInfo();
        return info.isCollection() && info.isRelatedTo() && info.isReadonly();
	public FieldAccessor forField(final Neo4jPersistentProperty property) {
        final RelationshipInfo relationshipInfo = property.getRelationshipInfo();
        return new ReadOnlyRelatedToCollectionFieldAccessor(relationshipInfo.getRelationshipType(), relationshipInfo.getDirection(), (Class<?>) property.getRelationshipInfo().getTargetType().getType(), ,property);
		public ReadOnlyRelatedToCollectionFieldAccessor(final RelationshipType typefinal Direction directionfinal Class<?> elementClassfinal Neo4jTemplate templateNeo4jPersistentProperty field) {
	    public boolean isWriteable(Object entity) {
	        return false;
	    public Object setValue(final Object entityfinal Object newValMappingPolicy mappingPolicy) {
			throw new InvalidDataAccessApiUsageException("Cannot set read-only relationship entity field.");
		public Object getDefaultValue() {
		    return null;
New to GrepCode? Check out our FAQ X