public static Segment fromScopedName(String qualifiedName) {
        if (StreamSegmentNameUtils.isTransactionSegment(qualifiedName)) {
            String originalSegmentName = StreamSegmentNameUtils.getParentStreamSegmentName(qualifiedName);
            return fromScopedName(originalSegmentName);
        } else {
            List<String> tokens = StreamSegmentNameUtils.extractSegmentTokens(qualifiedName);
            if (tokens.size() == 2) { // scope not present
                String scope = null;
                String streamName = tokens.get(0);
                long segmentId = Long.parseLong(tokens.get(1));
                return new Segment(scope, streamName, segmentId);
            } else { // scope present
                String scope = tokens.get(0);
                String streamName = tokens.get(1);
                long segmentId = Long.parseLong(tokens.get(2));
                return new Segment(scope, streamName, segmentId);
            }
        }
    }
public static Segment fromScopedName ( String qualifiedName ) { if ( StreamSegmentNameUtils . isTransactionSegment ( qualifiedName ) ) { String originalSegmentName = StreamSegmentNameUtils . getParentStreamSegmentName ( qualifiedName ) ; return fromScopedName ( originalSegmentName ) ; } else { List < String > tokens = StreamSegmentNameUtils . extractSegmentTokens ( qualifiedName ) ; if ( tokens . size ( ) == 2 ) { String scope = null ; String streamName = tokens . get ( 0 ) ; long segmentId = Long . parseLong ( tokens . get ( 1 ) ) ; return new Segment ( scope , streamName , segmentId ) ; } else { String scope = tokens . get ( 0 ) ; String streamName = tokens . get ( 1 ) ; long segmentId = Long . parseLong ( tokens . get ( 2 ) ) ; return new Segment ( scope , streamName , segmentId ) ; } } }
Parses fully scoped name, and creates the segment.

@param qualifiedName Fully scoped segment name
@return Segment name.