[
https://issues.apache.org/jira/browse/OAK-3390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14738974#comment-14738974
]
Julian Reschke commented on OAK-3390:
-------------------------------------
Proposed interface:
{code}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
package org.apache.jackrabbit.oak.commons;
/**
* Identifies objects which can be adapted to other types or representations of
the same object.
* <p>
* <em>Inspired by Apache Sling's Adaptable and Java SQL's Wrapper
interfaces.</em>
*/
public interface Adaptable {
/**
* Checks whether the adaptable can be converted to the specified type.
*
* @param type
* The generic type to check for
* @return {@code true} if a call to {link {@link #adaptTo(Class)}} is
* likely to succeed
*/
public boolean isAdaptable(Class<?> type);
/**
* Adapts the adaptable to another type.
* <p>
* Please note that it is explicitly left as an implementation detail
* whether each call to this method with the same type yields the same
* object or a new object on each call.
* <p>
* Implementations of this method should document their adapted types as
* well as their behavior with respect to returning newly created or not
* instance on each call.
*
* @param <AdapterType>
* The generic type to which this object is adapted to
* @param type
* The generic type to which this object is adapted to
* @return The adapter target or {@code null} if the object cannot adapt to
* the requested type
*/
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type);
}
{code}
> Avoid instanceof check in DocumentNodeStore
> -------------------------------------------
>
> Key: OAK-3390
> URL: https://issues.apache.org/jira/browse/OAK-3390
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: core, mongomk
> Affects Versions: 1.3.4
> Reporter: Marcel Reutegger
> Fix For: 1.3.7
>
>
> The instanceof MongoDocumentStore check does not work anymore when the store
> is wrapped with e.g. the LeaseCheckDocumentStoreWrapper.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)