Skip to content

Commit

Permalink
style: improve imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ngmr committed Oct 17, 2024
1 parent 53ad3ca commit 2b788cd
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions yoko-core/src/main/java/org/apache/yoko/orb/IMR/ServerIDHelper.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 IBM Corporation and others.
* Copyright 2024 IBM Corporation and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,42 +17,52 @@
*/
package org.apache.yoko.orb.IMR;

import static org.apache.yoko.util.MinorCodes.MinorTypeMismatch;
import static org.apache.yoko.util.MinorCodes.describeBadOperation;
import static org.omg.CORBA.CompletionStatus.COMPLETED_NO;
import static org.omg.CORBA.TCKind.tk_long;

import org.apache.yoko.util.MinorCodes;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;

//
// IDL:orb.yoko.apache.org/IMR/ServerID:1.0
//
final public class ServerIDHelper
public final class ServerIDHelper
{
public static void
insert(org.omg.CORBA.Any any, int val)
insert(Any any, int val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}

public static int
extract(org.omg.CORBA.Any any)
extract(Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION(
MinorCodes
.describeBadOperation(MinorCodes.MinorTypeMismatch),
MinorCodes.MinorTypeMismatch, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
throw new BAD_OPERATION(
describeBadOperation(MinorTypeMismatch),
MinorTypeMismatch, COMPLETED_NO);
}

private static org.omg.CORBA.TypeCode typeCode_;
private static TypeCode typeCode_;

public static org.omg.CORBA.TypeCode
public static TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "ServerID", orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long));
ORB orb = ORB.init();
typeCode_ = orb.create_alias_tc(id(), "ServerID", orb.get_primitive_tc(tk_long));
}

return typeCode_;
Expand All @@ -65,15 +75,15 @@ final public class ServerIDHelper
}

public static int
read(org.omg.CORBA.portable.InputStream in)
read(InputStream in)
{
int _ob_v;
_ob_v = in.read_long();
return _ob_v;
}

public static void
write(org.omg.CORBA.portable.OutputStream out, int val)
write(OutputStream out, int val)
{
out.write_long(val);
}
Expand Down

0 comments on commit 2b788cd

Please sign in to comment.