org.netbeans.modules.parsing.api/1 1.55.0 6

org.netbeans.modules.parsing.api
Class Embedding

java.lang.Object
  extended by org.netbeans.modules.parsing.api.Embedding

public final class Embedding
extends Object

Represents one block of code embedded in some other source. Performance is the only purpose of this class. You can obtain some basic information about embedded block of code before it is really created. Following example shows how to create compound Embedding from some snapshot:

 
         Embedding compoundEmbedding = Embedding.create (Arrays.asList (new Source[] {
             snapshot.create ("some prefix code", "text/x-java"),
             snapshot.create (10, 100, "text/x-java"),
             snapshot.create ("some postfix code", "text/x-java")
         })));
 


Method Summary
 boolean containsOriginalOffset(int originalOffset)
          Returns true if this embedding contains given offset related to top level source.
static Embedding create(List<Embedding> embeddings)
          Creates Embedding from a list of embeddings.
 String getMimeType()
          Returns mime type of embedded source.
 Snapshot getSnapshot()
          Returns Snapshot for embedded block of code.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static Embedding create(List<Embedding> embeddings)
Creates Embedding from a list of embeddings. All embeddings have to be created from one Smapshot. All embeddings must have the same mime type, but this mime type have to be different than current embedding mime types.

Parameters:
embeddings - A list of some embeddings created from one source.
Returns:
A new embedding compound from given pieces.
Throws:
IllegalArgumentException - if embeddings collection is empty, or mime types of embeddings are not same.
NullPointerException - embedding is null.

getSnapshot

public final Snapshot getSnapshot()
Returns Snapshot for embedded block of code.

Returns:
A Snapshot for embedded block of code..

getMimeType

public final String getMimeType()
Returns mime type of embedded source.

Returns:
A mime type of embedded source.

containsOriginalOffset

public final boolean containsOriginalOffset(int originalOffset)
Returns true if this embedding contains given offset related to top level source.

Parameters:
originalOffset - A offset in original source.
Returns:
true if this embedding contains given offset

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.parsing.api/1 1.55.0 6

Built on May 24 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.