本文整理汇总了Java中sun.rmi.rmic.IndentingWriter.p方法的典型用法代码示例。如果您正苦于以下问题:Java IndentingWriter.p方法的具体用法?Java IndentingWriter.p怎么用?Java IndentingWriter.p使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.rmi.rmic.IndentingWriter
的用法示例。
在下文中一共展示了IndentingWriter.p方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeImplementation
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Write an IDL interface definition for a Java implementation class
* @param t The current ImplementationType
* @param p The output stream.
*/
protected void writeImplementation(
ImplementationType t,
IndentingWriter p )
throws IOException {
Hashtable inhHash = new Hashtable();
Hashtable refHash = new Hashtable();
getInterfaces( t,inhHash ); //collect interfaces
writeBanner( t,0,!isException,p );
writeInheritedIncludes( inhHash,p );
writeIfndef( t,0,!isException,!isForward,p );
writeIncOrb( p );
writeModule1( t,p );
p.pln();p.pI();
p.p( "interface " + t.getIDLName() );
writeInherits( inhHash,!forValuetype,p );
p.pln( " {" );
p.pln( "};" );
p.pO();p.pln();
writeModule2( t,p );
writeEpilog( t,refHash,p );
}
示例2: print
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Print this type.
* @param writer The stream to print to.
* @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
* @param useIDLNames If true, print IDL names; otherwise, print java names.
* @param globalIDLNames If true and useIDLNames true, prepends "::".
*/
public void print ( IndentingWriter writer,
boolean useQualifiedNames,
boolean useIDLNames,
boolean globalIDLNames) throws IOException {
if (isInner()) {
writer.p("// " + getTypeDescription() + " (INNER)");
} else {
writer.p("// " + getTypeDescription());
}
writer.pln(" (" + getRepositoryID() + ")\n");
printPackageOpen(writer,useIDLNames);
if (!useIDLNames) {
writer.p("public ");
}
String prefix = "";
writer.p("class " + getTypeName(false,useIDLNames,false));
if (printExtends(writer,useQualifiedNames,useIDLNames,globalIDLNames)) {
prefix = ",";
}
printImplements(writer,prefix,useQualifiedNames,useIDLNames,globalIDLNames);
writer.plnI(" {");
printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
writer.pln();
printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);
if (useIDLNames) {
writer.pOln("};");
} else {
writer.pOln("}");
}
printPackageClose(writer,useIDLNames);
}
示例3: print
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Print this type.
* @param writer The stream to print to.
* @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
* @param useIDLNames If true, print IDL names; otherwise, print java names.
* @param globalIDLNames If true and useIDLNames true, prepends "::".
*/
public void print ( IndentingWriter writer,
boolean useQualifiedNames,
boolean useIDLNames,
boolean globalIDLNames) throws IOException {
if (isInner()) {
writer.p("// " + getTypeDescription() + " (INNER)");
} else {
writer.p("// " + getTypeDescription() + "");
}
writer.pln(" (" + getRepositoryID() + ")\n");
printPackageOpen(writer,useIDLNames);
if (!useIDLNames) {
writer.p("public ");
}
writer.p("interface " + getTypeName(false,useIDLNames,false));
printImplements(writer,"",useQualifiedNames,useIDLNames,globalIDLNames);
writer.plnI(" {");
printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
writer.pln();
printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);
writer.pln();
if (useIDLNames) {
writer.pOln("};");
} else {
writer.pOln("}");
}
printPackageClose(writer,useIDLNames);
}
示例4: printMembers
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
protected void printMembers ( IndentingWriter writer,
boolean useQualifiedNames,
boolean useIDLNames,
boolean globalIDLNames) throws IOException {
CompoundType.Member[] members = getMembers();
for (int i = 0; i < members.length; i++) {
if (!members[i].isInnerClassDeclaration()) {
Type it = members[i].getType();
String visibility = members[i].getVisibility();
String name;
if (useIDLNames) {
name = members[i].getIDLName();
} else {
name = members[i].getName();
}
String value = members[i].getValue();
writer.p(visibility);
if (visibility.length() > 0) {
writer.p(" ");
}
it.printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
writer.p(" " + name);
if (value != null) {
writer.pln(" = " + value + ";");
} else {
writer.pln(";");
}
}
}
}
示例5: writeNCType
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Write an IDL valuetype definition for
* 1) a nonconforming Java class
* 2) a nonconforming Java interface (that is not an AbstractType)
* @param t The current NC Type (NCClassType or NCInterfaceType)
* @param p The output stream.
*/
protected void writeNCType(
CompoundType t,
IndentingWriter p )
throws IOException {
Vector conVec = getConstants( t ); //collect constants
Vector mthVec = getMethods( t ); //collect methods
Hashtable inhHash = new Hashtable();
Hashtable refHash = new Hashtable();
Hashtable spcHash = new Hashtable();
Hashtable arrHash = new Hashtable();
Hashtable excHash = new Hashtable();
getInterfaces( t,inhHash ); //collect interfaces
getInheritance( t,inhHash ); //add inheritance
getMethodReferences( mthVec,refHash,spcHash,arrHash,excHash );
writeProlog( t,refHash,spcHash,arrHash,excHash,inhHash,p );
writeModule1( t,p );
p.pln();p.pI();
p.p( "abstract valuetype " + t.getIDLName() );
writeInherits( inhHash,!forValuetype,p );
p.pln( " {" );
if ( conVec.size() + mthVec.size() > 0 ) { //any content?
p.pln();p.pI();
for ( int i1 = 0; i1 < conVec.size(); i1++ ) //write constants
writeConstant( (CompoundType.Member)conVec.elementAt( i1 ),p );
for ( int i1 = 0; i1 < mthVec.size(); i1++ ) //write methods
writeMethod( (CompoundType.Method)mthVec.elementAt( i1 ),p );
p.pO();p.pln();
}
p.pln( "};" );
p.pO();p.pln();
writeModule2( t,p );
writeEpilog( t,refHash,p );
}
示例6: writeRemote
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Write an IDL interface definition for either:
* 1) a conforming Java remote interface (RemoteType)..or
* 2) a non-conforming Java interface whose methods all throw
* java.rmi.RemoteException (AbstractType)
* @param t The current RemoteType
* @param p The output stream.
*/
protected void writeRemote(
RemoteType t,
IndentingWriter p )
throws IOException {
Vector conVec = getConstants( t ); //collect constants
Vector mthVec = getMethods( t ); //collect methods
Hashtable inhHash = new Hashtable();
Hashtable refHash = new Hashtable();
Hashtable spcHash = new Hashtable();
Hashtable arrHash = new Hashtable();
Hashtable excHash = new Hashtable();
getInterfaces( t,inhHash ); //collect interfaces
getMethodReferences( mthVec,refHash,spcHash,arrHash,excHash );
writeProlog( t,refHash,spcHash,arrHash,excHash,inhHash,p );
writeModule1( t,p );
p.pln();p.pI();
if ( t.getTypeCode() == TYPE_ABSTRACT ) p.p( "abstract " );
p.p( "interface " + t.getIDLName() );
writeInherits( inhHash,!forValuetype,p );
p.pln( " {" );
if ( conVec.size() + mthVec.size() > 0 ) { //any constants or methods?
p.pln();p.pI();
for ( int i1 = 0; i1 < conVec.size(); i1++ ) //constants
writeConstant( (CompoundType.Member)conVec.elementAt( i1 ),p );
for ( int i1 = 0; i1 < mthVec.size(); i1++ ) //methods, attributes
writeMethod( (CompoundType.Method)mthVec.elementAt( i1 ),p );
p.pO();p.pln();
}
p.pln( "};" );
p.pO();p.pln();
writeRepositoryID ( t,p );
p.pln();
writeModule2( t,p );
writeEpilog( t,refHash,p );
}
示例7: writeData
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Write an IDL data member
* @param data The current CompoundType.Member data member
* @param p The output stream.
*/
protected void writeData(
CompoundType.Member data,
IndentingWriter p )
throws IOException {
if ( data.isInnerClassDeclaration() ) return; //ignore
Type t = data.getType();
if ( data.isPublic() )
p.p( "public " );
else p.p( "private " );
p.pln( getQualifiedIDLName( t ) + " " +
data.getIDLName() + ";" );
}
示例8: writeAttribute
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Write an IDL Attribute
* @param attr The current CompoundType.Method attribute
* @param p The output stream.
*/
protected void writeAttribute(
CompoundType.Method attr,
IndentingWriter p )
throws IOException {
if ( attr.getAttributeKind() == ATTRIBUTE_SET ) return; //use getters only
Type t = attr.getReturnType();
if ( !attr.isReadWriteAttribute() ) p.p( "readonly " );
p.p( "attribute " + getQualifiedIDLName( t ) + " " );
p.pln( attr.getAttributeName() + ";" );
}
示例9: writeInclude
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Write a #include doing user specified -idlFile translation (if any) for
* IDLEntities.
* @param t Type to include.
* @param modNames Preprocessed module names (default).
* @param tName Preprocessed Type name (default).
* @param p The output stream.
*/
protected void writeInclude(
Type t,
String[] modNames,
String tName,
IndentingWriter p)
throws IOException {
if ( t.isCompound() ) {
CompoundType it = (CompoundType)t;
if ( ifHash.size() > 0 && //any -idlFile translation to apply
it.isIDLEntity() ) { //..for this IDLEntity?
String qName = t.getQualifiedName(); //fully qualified orig Java name
Enumeration k = ifHash.keys();
while ( k.hasMoreElements() ) { //loop thro user-defined -idlFiles
String from = (String)k.nextElement();
if ( qName.startsWith( from ) ) { //found a match?
String to = (String)ifHash.get( from );
p.pln( "#include \"" + to + "\"" ); //user-specified idl filename
return; //don't look for any more
}
}
}
}
else if ( t.isArray() ) ; //no -idlFile translation needed for array
else return; //no #include needed for primitive
p.p( "#include \"" ); //no -idlFile translation required
for ( int i1 = 0; i1 < modNames.length; i1++ ) p.p( modNames[i1] + "/" );
p.p( tName + ".idl\"" );
p.pln();
}
示例10: writeConstant
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Write an IDL constant
* @param constant The current CompoundType.Member constant
* @param p The output stream.
*/
protected void writeConstant(
CompoundType.Member constant,
IndentingWriter p )
throws IOException {
Type t = constant.getType();
p.p( "const " );
p.p( getQualifiedIDLName( t ) );
p.p( " " + constant.getIDLName() + " = " + constant.getValue() );
p.pln( ";" );
}
示例11: printTypeName
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Print the name of this type.
* @param writer The stream to print to.
* @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
* @param useIDLNames If true, print IDL names; otherwise, print java names.
* @param globalIDLNames If true and useIDLNames true, prepends "::".
*/
public void printTypeName ( IndentingWriter writer,
boolean useQualifiedNames,
boolean useIDLNames,
boolean globalIDLNames) throws IOException {
writer.p(getTypeName(useQualifiedNames,useIDLNames,globalIDLNames));
}
示例12: writeIfndef
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
/**
* Write #ifndef guard into the output stream for a given Type
* @param t The given Type.
* @param dim The dimension required if t is an ArrayType.
* @param isException true if writing an exception.
* @param isForward. No #define needed if it's a forward declare
* @param p The output stream.
*/
protected void writeIfndef(
Type t,
int dim,
boolean isException,
boolean isForward,
IndentingWriter p )
throws IOException {
String[] modNames = getIDLModuleNames( t ); //module name array
String fName = unEsc( t.getIDLName() ); //file name default
if ( isException && t.isClass() ) {
ClassType ct = (ClassType)t; //file name for Exception
fName = unEsc( ct.getIDLExceptionName() );
}
if ( dim > 0 && t.isArray() ) {
Type et = t.getElementType(); //file name for sequence
fName = "seq" + dim + "_" + unEsc( et.getIDLName().replace( ' ','_' ) );
}
p.pln();
p.p( "#ifndef __" );
for ( int i = 0; i < modNames.length; i++ ) p.p( modNames[i] + "_" );
p.pln( fName + "__" );
if ( !isForward ) {
p.p( "#define __" );
for ( int i = 0; i < modNames.length; i++ ) p.p( modNames[i] + "_" );
p.pln( fName + "__" );
p.pln();
}
}
示例13: allocateResult
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
void allocateResult (IndentingWriter p,
Type returnType) throws IOException {
if (!returnType.isType(TYPE_VOID)) {
String objName = testUtil(getName(returnType), returnType);
p.p(objName + " result = ");
}
}
示例14: printExtends
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
protected boolean printExtends (IndentingWriter writer,
boolean useQualifiedNames,
boolean useIDLNames,
boolean globalIDLNames) throws IOException {
ClassType parent = getSuperclass();
if (parent != null && (!useIDLNames ||
(!parent.isType(TYPE_ANY) && !parent.isType(TYPE_CORBA_OBJECT)))) {
writer.p(" extends ");
parent.printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
return true;
}
return false;
}
示例15: writeStubMethod
import sun.rmi.rmic.IndentingWriter; //导入方法依赖的package包/类
void writeStubMethod ( IndentingWriter p,
CompoundType.Method method,
CompoundType theType) throws IOException {
// Wtite the method declaration and opening brace...
String methodName = method.getName();
String methodIDLName = method.getIDLName();
Type paramTypes[] = method.getArguments();
String paramNames[] = method.getArgumentNames();
Type returnType = method.getReturnType();
ValueType[] exceptions = getStubExceptions(method,false);
boolean hasIOException = false;
addNamesInUse(method);
addNameInUse("_type_ids");
String objName = testUtil(getName(returnType), returnType);
p.p("public " + objName + " " + methodName + "(");
for(int i = 0; i < paramTypes.length; i++) {
if (i > 0)
p.p(", ");
p.p(getName(paramTypes[i]) + " " + paramNames[i]);
}
p.p(")");
if (exceptions.length > 0) {
p.p(" throws ");
for(int i = 0; i < exceptions.length; i++) {
if (i > 0) {
p.p(", ");
}
// Added for Bug 4818753
p.p(getExceptionName(exceptions[i]));
}
}
p.plnI(" {");
// Now create the method body...
if (emitPermissionCheck) {
p.pln("if ((System.getSecurityManager() != null) && (!_instantiated)) {");
p.plnI(" throw new java.io.IOError(new java.io.IOException(\"InvalidObject \"));");
p.pOln("}");
p.pln();
}
if (localStubs) {
writeLocalStubMethodBody(p,method,theType);
} else {
writeNonLocalStubMethodBody(p,method,theType);
}
// Close out the method...
p.pOln("}");
}