001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008-2009 Sun Microsystems, Inc. 015 */ 016 017package org.forgerock.opendj.config; 018 019/** 020 * A visitor of relation definitions, in the style of the visitor design 021 * pattern. Classes implementing this interface can query relation definitions 022 * in a type-safe manner when the kind of relation definition is unknown at 023 * compile time. When a visitor is passed to a relation definition's accept 024 * method, the corresponding visit method most applicable to that relation 025 * definition is invoked. 026 * 027 * @param <R> 028 * The return type of this visitor's methods. Use 029 * {@link java.lang.Void} for visitors that do not need to return 030 * results. 031 * @param <P> 032 * The type of the additional parameter to this visitor's methods. 033 * Use {@link java.lang.Void} for visitors that do not need an 034 * additional parameter. 035 */ 036public interface RelationDefinitionVisitor<R, P> { 037 038 /** 039 * Visit an instantiable relation definition. 040 * 041 * @param <C> 042 * The type of client managed object configuration that the 043 * relation definition refers to. 044 * @param <S> 045 * The type of server managed object configuration that the 046 * relation definition refers to. 047 * @param rd 048 * The instantiable relation definition to visit. 049 * @param p 050 * A visitor specified parameter. 051 * @return Returns a visitor specified result. 052 */ 053 <C extends ConfigurationClient, S extends Configuration> R visitInstantiable( 054 InstantiableRelationDefinition<C, S> rd, P p); 055 056 /** 057 * Visit a set relation definition. 058 * 059 * @param <C> 060 * The type of client managed object configuration that the 061 * relation definition refers to. 062 * @param <S> 063 * The type of server managed object configuration that the 064 * relation definition refers to. 065 * @param rd 066 * The set relation definition to visit. 067 * @param p 068 * A visitor specified parameter. 069 * @return Returns a visitor specified result. 070 */ 071 <C extends ConfigurationClient, S extends Configuration> R visitSet(SetRelationDefinition<C, S> rd, P p); 072 073 /** 074 * Visit an optional relation definition. 075 * 076 * @param <C> 077 * The type of client managed object configuration that the 078 * relation definition refers to. 079 * @param <S> 080 * The type of server managed object configuration that the 081 * relation definition refers to. 082 * @param rd 083 * The optional relation definition to visit. 084 * @param p 085 * A visitor specified parameter. 086 * @return Returns a visitor specified result. 087 */ 088 <C extends ConfigurationClient, S extends Configuration> R visitOptional(OptionalRelationDefinition<C, S> rd, P p); 089 090 /** 091 * Visit a singleton relation definition. 092 * 093 * @param <C> 094 * The type of client managed object configuration that the 095 * relation definition refers to. 096 * @param <S> 097 * The type of server managed object configuration that the 098 * relation definition refers to. 099 * @param rd 100 * The singleton relation definition to visit. 101 * @param p 102 * A visitor specified parameter. 103 * @return Returns a visitor specified result. 104 */ 105 <C extends ConfigurationClient, S extends Configuration> R visitSingleton(SingletonRelationDefinition<C, S> rd, 106 P p); 107 108}