private static AnnotationDecoration getDecoration(final Node container) { return (AnnotationDecoration) container .astGetDecoration(ANNOTATION_DECORATION_NAME); }
/** * Get the parent of the given component * * @param arg the component * @return the parent component */ public static Node getParent(final Node arg) { final Object parent = arg.astGetDecoration("parent"); if (parent instanceof Node) { return (Node) parent; } else return null; }
public static String[] getDebugDecoration(final Node node) { return (String[]) node.astGetDecoration(DEBUG_DECORATION); }
/** * Returns the value of the {@link #INPUT_RESOURCES_DECORATION input * resources} decoration associated to the given node. May be * <code>null</code>. * * @param node a node. * @return a set of name. May be <code>null</code>. */ @SuppressWarnings("unchecked") public static Set<InputResource> getInputResources(final Node node) { return (Set<InputResource>) node .astGetDecoration(INPUT_RESOURCES_DECORATION); }
/** * Return the {@link CommentDecoration} object that is attached to the given * node. * * @param node a node. * @return the {@link CommentDecoration} object that is attached to the given * node, or <code>null</code> if the given node has no decoration * called {@link #COMMENT_DECORATION_NAME}. * @throws IllegalArgumentException if the given node has a decoration called * {@link #COMMENT_DECORATION_NAME} that is not a * {@link CommentDecoration}. */ public static CommentDecoration getCommentDecoration(final Node node) { final Object deco = node.astGetDecoration(COMMENT_DECORATION_NAME); if (deco == null) return null; if (!(deco instanceof CommentDecoration)) throw new IllegalArgumentException("Given node contains a \"" + COMMENT_DECORATION_NAME + "\" decoration that is not a CommentDecoration."); return (CommentDecoration) deco; } }
/** * Return the comment that is attached to the given node. * * @param node a node. * @return the comment that is attached to the given node, or * <code>null</code> if the given node has no decoration called * {@link #COMMENT_DECORATION_NAME}. * @throws IllegalArgumentException if the given node has a decoration called * {@link #COMMENT_DECORATION_NAME} that is not a * {@link CommentDecoration}. */ public static String getComment(final Node node) { final Object deco = node.astGetDecoration(COMMENT_DECORATION_NAME); if (deco == null) return null; if (!(deco instanceof CommentDecoration)) throw new IllegalArgumentException("Given node contains a \"" + COMMENT_DECORATION_NAME + "\" decoration that is not a CommentDecoration."); return ((CommentDecoration) deco).getComment(); }
/** * Attach the given comment to the given node. * * @param node a node. * @param comment the comment to attach. * @throws IllegalArgumentException if the given node already has a decoration * called {@link #COMMENT_DECORATION_NAME}. */ public static void setComment(final Node node, final String comment) { final Object o = node.astGetDecoration(COMMENT_DECORATION_NAME); if (o != null) throw new IllegalArgumentException("Given node already contains a \"" + COMMENT_DECORATION_NAME + "\" decoration."); node.astSetDecoration(COMMENT_DECORATION_NAME, new CommentDecoration( comment, node)); }
/** * Get the server interface bounded to the given client interface * * @param arg the client interface * @return the server interface */ public static Interface getDeployableServerInterface(Node arg) { do { if (isClientInterface(arg)) { /* itf is client */ arg = getServerItf(((Binding) arg.astGetDecoration("bind"))); } else if (isServerInterface(arg)) { /* itf is server */ if (isDeployableComponent(getParent(arg))) { return (Interface) arg; } else if (isPrimitive(getParent(arg))) { return null; } else { arg = getServerItf((Binding) arg.astGetDecoration("bind")); } } } while (arg != null); return null; }
} else { definition = (String) ((Node) container) .astGetDecoration("definition");