@Test public void parse() { final ChannelAddress address1 = ChannelAddress.parse( "1.22" ); assertEquals( address1.getChannelId(), 1 ); assertEquals( address1.getSubChannelId(), (Integer) 22 ); final ChannelAddress address2 = ChannelAddress.parse( "0" ); assertEquals( address2.getChannelId(), 0 ); assertEquals( address2.getSubChannelId(), null ); }
@Nonnull public static ChannelAddress parse( @Nonnull final String name ) { final int offset = name.indexOf( "." ); final int channelId = Integer.parseInt( -1 == offset ? name : name.substring( 0, offset ) ); final Integer subChannelId = -1 == offset ? null : Integer.parseInt( name.substring( offset + 1 ) ); return new ChannelAddress( channelId, subChannelId ); }
ChannelAddress implements Comparable<ChannelAddress> { @Nonnull public static ChannelAddress parse( @Nonnull final String name ) { final int offset = name.indexOf( "." ); final int channelId = Integer.parseInt( -1 == offset ? name : name.substring( 0, offset ) ); final Integer subChannelId = -1 == offset ? null : Integer.parseInt( name.substring( offset + 1 ) ); return new ChannelAddress( channelId, subChannelId ); } }
ChannelAddress implements Comparable<ChannelAddress> { @Nonnull public static ChannelAddress parse( @Nonnull final String name ) { final int offset = name.indexOf( "." ); final int channelId = Integer.parseInt( -1 == offset ? name : name.substring( 0, offset ) ); final Integer subChannelId = -1 == offset ? null : Integer.parseInt( name.substring( offset + 1 ) ); return new ChannelAddress( channelId, subChannelId ); } ChannelAddress( final int channelId );  ChannelAddress( final int channelId, @Nullable final Integer subChannelId ); }
ChannelAddress implements Comparable<ChannelAddress> { @Nonnull public static ChannelAddress parse( @Nonnull final String name ) { final int offset = name.indexOf( "." ); final int channelId = Integer.parseInt( -1 == offset ? name : name.substring( 0, offset ) ); final Integer subChannelId = -1 == offset ? null : Integer.parseInt( name.substring( offset + 1 ) ); return new ChannelAddress( channelId, subChannelId ); } ChannelAddress( final int channelId );  ChannelAddress( final int channelId, @Nullable final Integer subChannelId ); @Nonnull static ChannelAddress parse( @Nonnull final String name ); int getChannelId(); @Nullable Integer getSubChannelId(); boolean hasSubChannelId(); @Override boolean equals( final Object o ); @Override int hashCode(); @Override int compareTo( @Nonnull final ChannelAddress other ); @Override String toString(); }
ChannelAddress implements Comparable<ChannelAddress> { @Nonnull public static ChannelAddress parse( @Nonnull final String name ) { final int offset = name.indexOf( "." ); final int channelId = Integer.parseInt( -1 == offset ? name : name.substring( 0, offset ) ); final Integer subChannelId = -1 == offset ? null : Integer.parseInt( name.substring( offset + 1 ) ); return new ChannelAddress( channelId, subChannelId ); } ChannelAddress( final int channelId );  ChannelAddress( final int channelId, @Nullable final Integer subChannelId ); @Nonnull static ChannelAddress parse( @Nonnull final String name ); int getChannelId(); @Nullable Integer getSubChannelId(); boolean hasSubChannelId(); @Override boolean equals( final Object o ); @Override int hashCode(); @Override int compareTo( @Nonnull final ChannelAddress other ); @Override String toString();  }