📄 classbuilder.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.//// $Id: ClassBuilder.java,v 1.2 2003/11/07 21:34:22 per_nyfelt Exp $package org.ozoneDB.tools.OPP.srcgen;import org.ozoneDB.tools.OPP.srcgen.BuilderException;import org.ozoneDB.tools.OPP.message.MessageWriter;import java.lang.reflect.Modifier;/** * The builder part of the builder director pattern. * * Provides a common interface for building class related structures. * ClassBuilders are commonly used together with a ClassDirector. <br> * This nicely separates the concerns of what is being built and what * the source of directions is. * @see ClassDirector * @author Joakim Ohlrogge */public interface ClassBuilder { /** * Represents a parameter. Contains information about the type, the name and * the modifiers for the parameter. There is no control wheather the modifiers * given are valid for a parameter. * * @see java.lang.reflect.Modifier */ public class Parameter { private String type; private String name; private String origName; private int modifier; public String getType() { return type; } public String getName() { return name; } /** * @see java.lang.reflect.Modifier * @return the integer value representing the modifiers */ public int getModifier() { return modifier; } /** * The original string representation of the parameter. * Dirty hack, will have to reconsider some design descisions... */ public String getOrigTypeName() { return origName; } /** * * @param type The type of the parameter * @param name The parameter name * @param modifier The integer value representing the parameters modifiers * @see java.lang.reflect.Modifier */ public Parameter(String type, String name, String origName, int modifier) { this.type = type; this.name = name; this.modifier = modifier; this.origName = origName; } public String toString() { return (Modifier.toString(modifier) + " " + type + " " + name); } } /** * Initializes the builder for each new build. This method may be called several times during the lifetime of the * builder but only once for each build. This method may be used reset any internal state that the builder may have. * * @param msgWriter The writer the builder should use to report messages. */ void init(MessageWriter msgWriter); /** * Called for each new class. May be called moore than once if the class has inner classes. * * @param modifier The modifiers for this class * @param fullName The full name including package path of this class * @param superClass The full name including package pathh for this class * @param interfaces The interfaces implemented by this class */ void beginClass(int modifier, final String fullName, String superClass, String interfaces[]) throws BuilderException; /** * Called for each constructor in the current class * @param modifier The modifier for this constructor * @param parameters The parameters for this constructor * @param exceptions The exceptions thrown by this constructor */ void makeConstructor(int modifier, Parameter parameters[], String exceptions[]) throws BuilderException; /** * Called for each method in the current class * @param modifier The modifiers for the method * @param name The name of the method * @param parameters The parameter list for the method * @param returnType The return type of the method, use null for void * @param exceptions The exceptions thrown by the method * @param lockLevel The lock level for this method */ void makeMethod(int modifier, String name, Parameter parameters[], String returnType, String exceptions[], int lockLevel) throws BuilderException; /** * Called at the end of each generated class. * Must be called once and once only for each beginClass. */ void endClass() throws BuilderException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -