From 2b788cd39e5c9e1fb55ec8752946617059683e74 Mon Sep 17 00:00:00 2001 From: Neil Richards <7203556+ngmr@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:27:13 +0100 Subject: [PATCH] style: improve imports --- .../apache/yoko/orb/IMR/ServerIDHelper.java | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/IMR/ServerIDHelper.java b/yoko-core/src/main/java/org/apache/yoko/orb/IMR/ServerIDHelper.java index a9e0d004f..e53984b34 100644 --- a/yoko-core/src/main/java/org/apache/yoko/orb/IMR/ServerIDHelper.java +++ b/yoko-core/src/main/java/org/apache/yoko/orb/IMR/ServerIDHelper.java @@ -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. @@ -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_; @@ -65,7 +75,7 @@ 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(); @@ -73,7 +83,7 @@ final public class ServerIDHelper } public static void - write(org.omg.CORBA.portable.OutputStream out, int val) + write(OutputStream out, int val) { out.write_long(val); }