| /* |
| * Copyright 2003-2007 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 |
| * |
| * 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 groovy.lang; |
| |
| import java.lang.reflect.Method; |
| |
| /** |
| * <p>An interface that defines methods that implementors of mutable Meta classes should specifiy. It provides operations to perform mutations |
| * on the MetaClass instance.</p> |
| * |
| * <p>Whether a MetaClass allows mutation is up to the MetaClass itself and considerations of Thread safety |
| * need to be taken into account when making a MetaClass mutable</p> |
| * |
| * <p>The default implementation allows mutation of MetaClass instances before initialisation (before the initialize() method is called) |
| * but not after, thus ensuring Thread safety once a MetaClass has been constructed and placed in the registry</p> |
| * |
| * |
| * @see MetaClassImpl |
| * @see MetaClass |
| * |
| * @author Graeme Rocher |
| * @since 1.1 |
| * |
| * <p/> |
| * Created: Feb 24, 2007 |
| * Time: 4:05:44 PM |
| */ |
| public interface MutableMetaClass extends MetaClass { |
| |
| /** |
| * Return whether the MetaClass has been modified or not |
| * @return True if it has |
| */ |
| boolean isModified(); |
| |
| /** |
| * adds a new instance method to this MetaClass. Instance |
| * methods are able to overwrite the original methods of the |
| * class. Calling this method should not be done after |
| * initlise was called. |
| * |
| * @param method the method to be added |
| */ |
| void addNewInstanceMethod(Method method); |
| |
| /** |
| * adds a new static method to this MetaClass. This is only |
| * possible as long as initilise was not called. |
| * |
| * @param method the method to be added |
| */ |
| void addNewStaticMethod(Method method); |
| |
| /** |
| * Adds a new MetaMethod to the MetaClass |
| * |
| * @param metaMethod The MetaMethod to add |
| */ |
| void addMetaMethod(MetaMethod metaMethod); |
| |
| /** |
| * Adds a new MetaBeanProperty to the MetaClass |
| * |
| * @param metaBeanProperty The MetaBeanProperty instance |
| */ |
| void addMetaBeanProperty(MetaBeanProperty metaBeanProperty); |
| |
| // TODO: Add methods like addMetaConstructor, addMetaAttribute, addMetaAnnotation etc. |
| } |