本文整理汇总了Java中sun.rmi.rmic.IndentingWriter类的典型用法代码示例。如果您正苦于以下问题:Java IndentingWriter类的具体用法?Java IndentingWriter怎么用?Java IndentingWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndentingWriter类属于sun.rmi.rmic包,在下文中一共展示了IndentingWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeForwardReferences
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Write forward references for referenced interfaces and valuetypes
* ...but not if the reference is to a boxed IDLEntity,
* @param refHash Hashtable loaded with referenced types
* @param p The output stream.
*/
protected void writeForwardReferences(
Hashtable refHash,
IndentingWriter p )
throws IOException {
Enumeration refEnum = refHash.elements();
nextReference:
while ( refEnum.hasMoreElements() ) {
Type t = (Type)refEnum.nextElement();
if ( t.isCompound() ) {
CompoundType ct = (CompoundType)t;
if ( ct.isIDLEntity() )
continue nextReference; //ignore IDLEntity reference
}
writeForwardReference( t,p );
}
}
示例2: writeForwardReference
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Write forward reference for given type
* @param t Given type
* @param p The output stream.
*/
protected void writeForwardReference(
Type t,
IndentingWriter p )
throws IOException {
String qName = t.getQualifiedName();
if ( "java.lang.String".equals( qName ) ) ;
else if ( "org.omg.CORBA.Object".equals( qName ) ) return ; //no fwd dcl
writeIfndef( t,0,!isException,isForward,p );
writeModule1( t,p );
p.pln();p.pI();
switch ( t.getTypeCode() ) {
case TYPE_NC_CLASS:
case TYPE_NC_INTERFACE: p.p( "abstract valuetype " ); break;
case TYPE_ABSTRACT: p.p( "abstract interface " ); break;
case TYPE_VALUE: p.p( "valuetype " ); break;
case TYPE_REMOTE:
case TYPE_CORBA_OBJECT: p.p( "interface " ); break;
default: ; //all other types were filtered
}
p.pln( t.getIDLName() + ";" );
p.pO();p.pln();
writeModule2( t,p );
writeEndif( p );
}
示例3: write_tie_deactivate_method
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
public void write_tie_deactivate_method(IndentingWriter p)
throws IOException
{
if(POATie){
p.plnI("public void deactivate() {");
p.pln("try{");
p.pln("_poa().deactivate_object(_poa().servant_to_id(this));");
p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
catchWrongPolicy(p);
p.pln("}catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception){");
catchObjectNotActive(p);
p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
catchServantNotActive(p);
p.pln("}");
p.pOln("}");
} else {
p.plnI("public void deactivate() {");
p.pln("_orb().disconnect(this);");
p.pln("_set_delegate(null);");
p.pln("target = null;");
p.pOln("}");
}
}
示例4: writeBoxedRMIIncludes
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Write includes for boxedRMI valuetypes for IDL sequences.
* Write only the maximum dimension found for an ArrayType.
* @param arrHash Hashtable loaded with array types
* @param p The output stream.
*/
protected void writeBoxedRMIIncludes(
Hashtable arrHash,
IndentingWriter p)
throws IOException {
Enumeration e1 = arrHash.elements();
nextSequence:
while ( e1.hasMoreElements() ) {
ArrayType at = (ArrayType)e1.nextElement();
int dim = at.getArrayDimension();
Type et = at.getElementType();
Enumeration e2 = arrHash.elements();
while ( e2.hasMoreElements() ) { //eliminate duplicates
ArrayType at2 = (ArrayType)e2.nextElement();
if ( et == at2.getElementType() && //same element type &
dim < at2.getArrayDimension() ) //smaller dimension?
continue nextSequence; //ignore this one
}
writeInclude( at,dim,!isThrown,p );
}
}
示例5: printPackageOpen
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Print the "opening" of the package or module of this type.
* @param writer The stream to print to.
* @param useIDLNames If true, print IDL names; otherwise, print java names.
*/
protected void printPackageOpen ( IndentingWriter writer,
boolean useIDLNames) throws IOException {
if (useIDLNames) {
String[] moduleNames = getIDLModuleNames();
for (int i = 0; i < moduleNames.length; i++ ) {
writer.plnI("module " + moduleNames[i] + " {");
}
} else {
String packageName = getPackageName();
if (packageName != null) {
writer.pln("package " + packageName + ";");
}
}
}
示例6: write_tie_thisObject_method
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
public void write_tie_thisObject_method(IndentingWriter p,
Identifier idCorbaObject)
throws IOException
{
if(POATie){
p.plnI("public " + idCorbaObject + " thisObject() {");
/*
p.pln("org.omg.CORBA.Object objref = null;");
p.pln("try{");
p.pln("objref = _poa().servant_to_reference(this);");
p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
catchWrongPolicy(p);
p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
catchServantNotActive(p);
p.pln("}");
p.pln("return objref;");
*/
p.pln("return _this_object();");
p.pOln("}");
} else {
p.plnI("public " + idCorbaObject + " thisObject() {");
p.pln("return this;");
p.pOln("}");
}
}
示例7: writeMarshalArguments
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Write Java statements to marshal a series of values in order as
* named in the "names" array, with types as specified in the "types"
* array", to the java.io.ObjectOutput stream named "stream".
*/
void writeMarshalArguments(IndentingWriter p,
String streamName,
Type[] types, String[] names)
throws IOException
{
if (types.length != names.length) {
throw new Error("paramter type and name arrays different sizes");
}
for (int i = 0; i < types.length; i++) {
writeMarshalArgument(p, streamName, types[i], names[i]);
if (i != types.length -1) {
p.pln();
}
}
}
示例8: 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 );
}
示例9: writeProlog
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Write IDL prolog for a CompoundType.
* @param t The CompoundType.
* @param refHash Hashtable loaded with type references.
* @param spcHash Hashtable loaded with special type references.
* @param arrHash Hashtable loaded with array references.
* @param excHash Hashtable loaded with exceptions thrown.
* @param inhHash Hashtable loaded with inherited types.
* @param p The output stream.
*/
protected void writeProlog(
CompoundType t,
Hashtable refHash,
Hashtable spcHash,
Hashtable arrHash,
Hashtable excHash,
Hashtable inhHash,
IndentingWriter p )
throws IOException {
writeBanner( t,0,!isException,p );
writeForwardReferences( refHash,p );
writeIncludes( excHash,isThrown,p ); //#includes for exceptions thrown
writeInheritedIncludes( inhHash,p );
writeIncludes( spcHash,!isThrown,p ); //#includes for special types
writeBoxedRMIIncludes( arrHash,p );
writeIDLEntityIncludes( refHash,p );
writeIncOrb( p );
writeIfndef( t,0,!isException,!isForward,p );
}
示例10: writeSpecial
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Write special typedef
* @param t A special Type.
* @param p The output stream.
*/
protected void writeSpecial(
Type t,
IndentingWriter p )
throws IOException {
String spcName = t.getQualifiedName();
if ( "java.io.Serializable".equals( spcName ) )
writeJavaIoSerializable( t,p );
else if ( "java.io.Externalizable".equals( spcName ) )
writeJavaIoExternalizable( t,p );
else if ( "java.lang.Object".equals( spcName) )
writeJavaLangObject( t,p );
else if ( "java.rmi.Remote".equals( spcName) )
writeJavaRmiRemote( t,p );
else if ( "org.omg.CORBA.portable.IDLEntity".equals( spcName) )
writeIDLEntity( t,p );
}
示例11: writeIDLEntityIncludes
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Write #includes for boxed IDLEntity references.
* @param refHash Hashtable loaded with referenced types
* @param p The output stream.
*/
protected void writeIDLEntityIncludes(
Hashtable refHash,
IndentingWriter p )
throws IOException {
Enumeration refEnum = refHash.elements();
while ( refEnum.hasMoreElements() ) {
Type t = (Type)refEnum.nextElement();
if ( t.isCompound() ) {
CompoundType ct = (CompoundType)t;
if ( ct.isIDLEntity() ) { //select IDLEntities
writeInclude( ct,0,!isThrown,p );
refHash.remove( ct.getQualifiedName() ); //avoid another #include
}
}
}
}
示例12: writeException
import sun.rmi.rmic.IndentingWriter; //导入依赖的package包/类
/**
* Write an exception.
* @param t Given ClassType representing the exception.
* @param p The output stream.
*/
protected void writeException(
ClassType t,
IndentingWriter p)
throws IOException {
writeBanner( t,0,isException,p );
writeIfndef( t,0,isException,!isForward,p );
writeForwardReference( t,p );
writeModule1( t,p );
p.pln();p.pI();
p.pln( "exception " + t.getIDLExceptionName() + " {" );
p.pln();p.pI();
p.pln( t.getIDLName() + " value;" );
p.pO();p.pln();
p.pln( "};" );
p.pO();p.pln();
writeModule2( t,p );
writeInclude( t,0,!isThrown,p ); //include valuetype idl file
writeEndif( p );
}
示例13: 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);
}
示例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: 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));
}